Commit Graph
24873 Commits
Author SHA1 Message Date
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
J. Nick Koston 77bbd70810 Merge remote-tracking branch 'origin/inline-ansi-reset' into integration 2026-03-15 20:42:27 -10:00
J. Nick Koston 712be2d2bc Merge branch 'dev' into inline-ansi-reset 2026-03-15 20:42:08 -10:00
J. Nick Koston 4d9b3b39a6 Merge branch 'inline-ansi-reset' into integration 2026-03-15 20:41:52 -10:00
J. Nick Koston d00c8ffe5c [logger] Inline write_() into write_body(), remove single-use helper 2026-03-15 20:41:38 -10:00
J. Nick Koston 62b6d93f1a Merge remote-tracking branch 'origin/ethernet-idf6-registry-components' into integration 2026-03-15 20:35:19 -10:00
J. Nick Koston 0cb5318e97 Merge remote-tracking branch 'upstream/inline-ansi-reset' into integration 2026-03-15 20:34:53 -10:00
J. Nick Koston 67386f0dd1 fix copilots manged suggestion 2026-03-15 20:34:25 -10:00
J. Nick KostonandCopilot Autofix powered by AI 968c0c2452 Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-03-15 20:27:07 -10:00
J. Nick Koston d201cc5d64 [logger] Use constexpr for ANSI reset sequence length 2026-03-15 20:19:34 -10:00
J. Nick Koston 1244b2c25d [logger] Inline ANSI reset sequence in LogBuffer::finalize_()
Replace write_() call with direct char stores for the 4-byte
ANSI reset sequence ("\033[0m"). This eliminates function call
overhead (entry/retw, bounds check, memcpy setup) on every log
message and avoids a rodata string reference that consumes RAM
on ESP8266.
2026-03-15 20:18:03 -10:00
dependabot[bot] 2ee0df1da3 Bump aioesphomeapi from 44.5.1 to 44.5.2 (#14849)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-03-16 05:43:38 +00:00
Jonathan Swoboda e1252e32d1 [deep_sleep] Fix ESP-IDF 6.0 GPIO wakeup API rename (#14846) 2026-03-15 19:10:30 -10:00
Jonathan Swoboda 1183ef825b [usb_host] Fix ESP-IDF 6.0 compatibility for external USB host component (#14844) 2026-03-15 19:09:55 -10:00
Keith Burzinski c09edb94c1 [tinyusb] Fix regression from bump to 2.x in #14796 (#14848) 2026-03-16 00:04:07 -05:00
9948adc6a0 [runtime_image] Add esp-dsp dependency for JPEGDEC SIMD on ESP32 (#14840)
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2026-03-15 18:15:01 -10:00
J. Nick Koston ccb467b219 [fastled] Include esp_lcd IDF component for ESP32-S3 compatibility (#14839) 2026-03-15 18:14:41 -10:00
J. Nick Koston 97458f71d0 Merge remote-tracking branch 'origin/inline-finish-guard' into integration 2026-03-15 18:12:04 -10:00
J. Nick Koston a6c051ddce Merge remote-tracking branch 'origin/ethernet-mark-final' into integration 2026-03-15 18:12:01 -10:00
J. Nick Koston 0c72491498 Merge branch 'dev' into inline-finish-guard 2026-03-15 18:10:38 -10:00
J. Nick Koston 422147c370 bot comments 2026-03-15 18:10:14 -10:00
J. Nick Koston b7960ee19b [ethernet] Keep CONFIG_ETH_SPI_ETHERNET_* in defines.h for static analysis
On IDF 5.x, the ESP-IDF headers use CONFIG_ETH_SPI_ETHERNET_W5500 and
CONFIG_ETH_SPI_ETHERNET_DM9051 to conditionally expose the W5500/DM9051
types. Static analysis (clang-tidy) needs both the new USE_ETHERNET_*
defines and the old CONFIG_* defines to resolve all symbols.
2026-03-15 17:57:52 -10:00
J. Nick Koston d4bce7f042 [ethernet] Guard per-chip PHY/MAC includes with IDF >= 6.0
On IDF 5.x these headers don't exist as standalone files — they are
included internally via esp_eth.h. On IDF 6.0 they moved to registry
components and need explicit includes.

LAN867x is unchanged (external component since IDF 5.3).
2026-03-15 17:16:21 -10:00
J. Nick Koston 63a2abf19c [ethernet] Fix JL1101 on IDF 6.0: pioarduino doesn't have it patched
pioarduino only patches esp_eth_phy_new_jl1101() into IDF 5.4.2-5.x,
not IDF 6.0. Update guards in both the .c driver and .h declaration
to also compile when IDF >= 6.0.

Guard logic: compile custom driver when JL1101 configured AND
(IDF >= 6.0 OR IDF < 5.4.2 OR not PlatformIO)
2026-03-15 17:13:00 -10:00
J. Nick Koston 0183d2ca61 [ethernet] Only compile JL1101 driver when needed
- Exclude esp_eth_phy_jl1101.c when JL1101 is not configured
- Exclude on IDF 5.4.2-5.x where pioarduino has it builtin
- Keep custom driver for IDF < 5.4.2 and IDF 6.0+ (pioarduino may
  not have patched JL1101 into their IDF 6.0 fork yet)
- Always use esp_eth_phy_new_jl1101() in C++ (no generic fallback)
- Namespace ethernet type in CORE.data[KEY_ETHERNET]
2026-03-15 17:09:59 -10:00
J. Nick Koston 6e8ef55381 [ethernet] Fix AttributeError: CORE has no using_platformio
Only exclude esp_eth_phy_jl1101.c at the Python level on IDF >= 6.0.
On IDF 5.4.2+ with PlatformIO, the file's own preprocessor guard
(checking the C-level PLATFORMIO define) compiles it to empty.
2026-03-15 17:03:21 -10:00
J. Nick Koston d27b3e8c0f [ethernet] Add explicit PHY/MAC includes and exclude JL1101 driver when unused
- Add explicit includes for per-chip PHY/MAC headers (required on IDF 6.0
  where they are no longer pulled in via esp_eth.h, also works on IDF 5.x)
- Exclude esp_eth_phy_jl1101.c from compilation on IDF >= 6.0 (uses
  generic PHY) and IDF >= 5.4.2 with PlatformIO (uses builtin driver)
2026-03-15 17:01:29 -10:00