Commit Graph
26515 Commits
Author SHA1 Message Date
J. Nick Koston 0bccf4a42d power of 2 2026-03-16 12:06:18 -10:00
J. Nick Koston bdeea29836 Revert "Replace modulo with compare-and-reset for circular buffer indices"
This reverts commit c03dd86796.
2026-03-16 12:04:32 -10:00
J. Nick Koston c03dd86796 Replace modulo with compare-and-reset for circular buffer indices
Modulo generates a full division on ESP8266 since API_MAX_SEND_QUEUE
is not a power of 2. Use increment + compare instead.
2026-03-16 12:03:10 -10:00
J. Nick Koston 49dd23d2a1 Fix doc comment: LWIP not kernel 2026-03-16 12:01:51 -10:00
J. Nick Koston 0eed9e8eb6 [api] Extract overflow buffer from frame helper into APIOverflowBuffer
The TCP send overflow buffer code was embedded directly in
APIFrameHelper, making it appear to be part of the primary send path.
In reality, it is rarely used in production — only when the kernel TCP
send buffer is full due to a slow client, congested network, or heavy
logging. Extract it into a dedicated APIOverflowBuffer class with clear
documentation about its purpose and usage frequency.
2026-03-16 12:00:20 -10:00
KamilCuk f81e04b036 [web_server] Fix wrong printf format specifier (#14836) 2026-03-16 11:30:31 -10:00
J. Nick Koston 75efdd8662 tweaks 2026-03-16 11:01:21 -10:00
J. Nick Koston 86e4341a52 tweaks 2026-03-16 11:00:57 -10:00
J. Nick Koston 402398b389 tweaks 2026-03-16 10:55:33 -10:00
J. Nick Koston dde81d3f63 tweaks 2026-03-16 10:51:54 -10:00
J. Nick Koston eef806c806 Merge branch 'dev' into socket-lwip-raw-udp 2026-03-16 10:44:13 -10:00
Jonathan SwobodaandJ. Nick Koston c3327d0b43 [i2s_audio] Fix ESP-IDF 6.0 compatibility for I2S port types (#14818)
Co-authored-by: J. Nick Koston <nick+github@koston.org>
2026-03-16 16:04:20 -04:00
Jonathan Swoboda 8577c26358 [i2c] Handle ESP_ERR_INVALID_RESPONSE as NACK for IDF 6.0 (#14867) 2026-03-16 20:03:09 +00:00
Jonathan Swoboda 80730fd012 [seeed_mr24hpc1] Fix frame parser length handling bugs (#14863) 2026-03-16 09:57:53 -10:00
dependabot[bot] 5ee3e94ca1 Bump actions/create-github-app-token from 2.2.1 to 3.0.0 (#14868)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-03-16 09:57:33 -10:00
dependabot[bot] 037f75e0ff Bump github/codeql-action from 4.32.6 to 4.33.0 (#14869)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-03-16 09:57:17 -10:00
Jonathan Swoboda c47f4fbc1c [core] Support both dot and dash separators in Version.parse (#14858) 2026-03-16 09:45:16 -10:00
Jonathan Swoboda 2f86e48a83 [as3935] Fix ENERGY_MASK dropping bit 4 of lightning energy MMSB (#14861) 2026-03-16 09:44:55 -10:00
Jonathan Swoboda 0bbba75757 [am43] Fix battery update throttle using wrong type (#14864) 2026-03-16 09:42:13 -10:00
Jonathan Swoboda 9362d9745e [ci] Fix clang-tidy hash check 403 error on fork PRs (#14860) 2026-03-16 09:41:21 -10:00
Jonathan Swoboda c8f708c13c [lilygo_t5_47] Fix Y coordinate mapping and clamp touch point count (#14865) 2026-03-16 09:40:24 -10:00
Jonathan Swoboda 05590a3a21 [gpio][dallas_temp] Fix one_wire read64() and DS18S20 division by zero (#14866) 2026-03-16 09:39:26 -10:00
Jonathan Swoboda cdf2867baf [hub75] Bump esp-hub75 to 0.3.4 (#14862) 2026-03-16 15:05:56 -04:00
J. Nick Koston b142557979 [ethernet] Add RP2040 W5500 Ethernet support (#14820) 2026-03-16 18:26:06 +00:00
J. Nick Koston 8b931b7ac0 Merge branch 'dev' into lightweight-callback-manager 2026-03-16 08:09:16 -10:00
J. Nick Koston 2bdf1d0e42 [core] Add std::launder, fix static_assert comment, document call()
- Add std::launder to reinterpret_cast in inline callback path for
  formal C++20 correctness (generates identical code)
- Fix static_assert comment: sizeof equality ensures round-trip through
  uintptr_t, not absence of trap representations per se
- Document that call() is only valid on Callbacks from create()
2026-03-16 08:07:03 -10:00
J. Nick Koston 742a8492d7 Merge remote-tracking branch 'upstream/dev' into integration 2026-03-16 07:57:44 -10:00
J. Nick KostonandClaude Opus 4.6 db405c483e [core] Cache errno to avoid duplicate __errno() calls (#14751)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 07:35:34 -10:00
J. Nick KostonandClaude Opus 4.6 808c7b67b3 [core] Inline WarnIfComponentBlockingGuard::finish() into header (#14798)
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 07:35:19 -10:00
J. Nick Koston 7131eafc09 [logger] Reduce per-message overhead by inlining hot path helpers (#14851) 2026-03-16 07:35:04 -10:00
J. Nick KostonandCopilot Autofix powered by AI 7b4af76a61 [core] Inline Mutex on all embedded platforms (#14756)
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-03-16 07:33:10 -10:00
J. Nick Koston 2cd93daa5e [api] Optimize plaintext varint encoding and devirtualize write_protobuf_packet (#14758) 2026-03-16 07:32:58 -10:00
J. Nick KostonandCopilot Autofix powered by AI f86bb2bdb0 [ethernet] Add IDF 6.0 registry component dependencies (#14847)
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-03-16 08:02:59 -04:00
J. Nick Koston 52045b02f6 Merge branch 'lightweight-callback-manager' into integration 2026-03-15 23:17:35 -10:00
J. Nick Koston 29882cf036 [core] Rename Callback fields to fn_ and ctx_ for consistency 2026-03-15 23:10:13 -10:00
J. Nick Koston 7edcc15cee [core] Address review nits
- Remove stale #include <functional> from microphone headers
- Add default initializers to Callback::fn and Callback::ctx
- Remove redundant cb.ctx = nullptr (now default-initialized)
2026-03-15 23:08:48 -10:00
J. Nick Koston 610258b683 [core] Convert remaining callback registration methods to templates
Convert rotary_encoder register_listener, canbus add_callback,
sdl add_key_listener, and udp add_listener from std::function to
templates to avoid the heap-allocation fallback path.

MQTT backend set_on_* methods are virtual and cannot be templatized.
2026-03-15 23:04:47 -10:00
J. Nick Koston 073dd3995e [microphone] Remove unnecessary std::function wrapping in callbacks
Pass wrapping lambdas directly to CallbackManager::add() instead of
first wrapping in std::function. The lambdas capture [this, callback]
(two pointers) so they hit the heap path either way, but this avoids
double-wrapping and the extra std::function overhead.

Also fix "deallaction" typo.
2026-03-15 22:59:19 -10:00
J. Nick Koston 1357de1fcd [microphone] Remove empty microphone.cpp
The only function was inlined into the header as a template.
2026-03-15 22:53:59 -10:00
J. Nick Koston fd51f0603e [core] Convert remaining add_*_callback methods to templates
Convert haier, nextion, microphone, ezo, uart, speaker, zigbee,
and hlk_fm22x callback methods that were missed by the initial
conversion (they used add_*_callback instead of add_on_*_callback).
2026-03-15 22:48:58 -10:00
J. Nick Koston 30e6e0a6b7 [core] Add static_assert for void* / uintptr_t size parity
Ensures the inline Callback storage path is only used on platforms
where void* has no trap representations (all bit patterns valid).
2026-03-15 22:41:15 -10:00
J. Nick Koston 70733fa913 [core] Fix Callback invocation for function pointer callables
Use (*ptr)(args...) instead of ptr->operator()(args...) so the
inline path works correctly for function pointers, which are
trivially copyable and pointer-sized but lack operator().
2026-03-15 22:39:31 -10:00
J. Nick Koston 3cebea9538 [core] Use __builtin_memcpy in Callback::create for cleaner code
Replace char-by-char loops with __builtin_memcpy in the inline
Callback storage path. Generates identical code but is cleaner
and avoids clang-analyzer false positives without NOLINT annotations.
2026-03-15 22:38:11 -10:00
J. Nick Koston 3c90438947 [core] Convert remaining add_on_*_callback methods to templates
Convert all remaining component add_on_*_callback methods from
std::function to templates so lambdas flow through without wrapping.
This avoids a heap allocation regression where passing std::function
through Callback::create would heap-allocate the std::function itself.

Also add NOLINT annotations for clang-analyzer false positive on
byte-wise copy in Callback::create.
2026-03-15 22:36:48 -10:00
J. Nick Koston bfc5a210bc [core] Replace std::function with lightweight Callback in CallbackManager
Replace std::function with a lightweight type-erased Callback struct
(8 bytes on 32-bit vs 16 for std::function) in CallbackManager and
LazyCallbackManager. Using C++20 if constexpr, small trivially-copyable
callables like [this] lambdas (81% of all callback registrations) are
stored inline in the function pointer context without heap allocation.

This eliminates std::function null checks (and __throw_bad_function_call)
from all entity callback paths, and templatizes add_on_*_callback methods
across all entity types so lambdas flow through without being wrapped in
std::function first.

Also converts EntityStateBase from hand-rolled nullable CallbackManager
pointers to LazyCallbackManager for consistency.

Measured flash savings:
- ESP8266 simple:        -160 B
- ESP8266 ratgdo:        -592 B
- ESP32 IDF (large):     -456 B
- ESP32 IDF (minimal):   -212 B
2026-03-15 22:20:42 -10:00
tomaszduda23 414182fe6d [ble_nus] fix uart debug (#14850) 2026-03-15 21:08:05 -10:00
J. Nick Koston a24a694bfe Merge remote-tracking branch 'upstream/inline-ansi-reset' into integration 2026-03-15 20:55:38 -10:00
J. Nick Koston 2643758e55 Merge remote-tracking branch 'upstream/inline-ansi-reset' into inline-ansi-reset 2026-03-15 20:53:16 -10:00
J. Nick Koston f6fe76b2fc [logger] Move write_msg_() to inline platform headers
Create per-platform logger_*.h headers with inline write_msg_()
for ESP32, ESP8266, RP2040, and LibreTiny. These are all one-liners
that benefit from inlining into write_to_console_(), eliminating
function call overhead on every log message.

Host and Zephyr implementations remain in .cpp files as they are
more complex (timestamp formatting, printk + uart loop).
2026-03-15 20:52:36 -10:00
J. Nick Koston 067f09151a [logger] Move write_msg_() to inline platform headers
Create per-platform logger_*.h headers with inline write_msg_()
for ESP32, ESP8266, RP2040, and LibreTiny. These are all one-liners
that benefit from inlining into write_to_console_(), eliminating
function call overhead on every log message.

Host and Zephyr implementations remain in .cpp files as they are
more complex (timestamp formatting, printk + uart loop).
2026-03-15 20:52:24 -10:00