Commit Graph
23564 Commits
Author SHA1 Message Date
J. Nick Koston f3377e22b8 fix mege 2026-02-28 16:47:54 -10:00
J. Nick Koston c2a6295b37 Merge remote-tracking branch 'upstream/remove-virtual-destructor-proto-message' into integration 2026-02-28 16:40:48 -10:00
J. Nick Koston 29b6017ea3 Merge remote-tracking branch 'upstream/esp8266-wake-loop-any-context' into integration 2026-02-28 16:40:43 -10:00
J. Nick Koston 28178b8c1c fixes 2026-02-28 16:39:13 -10:00
J. Nick Koston 04010664ce [core] Add ESP8266 support to wake_loop_any_context()
Wire Application::wake_loop_any_context() to socket::socket_wake()
on ESP8266. This allows any component calling wake_loop_any_context()
from an ISR or callback to immediately wake the main loop from
esp_delay() sleep, instead of waiting up to 16ms for the timeout.

Changes:
- Add IRAM_ATTR to socket_wake() so it's safe to call from ISR context
- Add ESP8266 wake_loop_any_context() backed by socket::socket_wake()
- Extend enable_loop_soon_any_context() to wake the loop on ESP8266
2026-02-28 16:35:44 -10:00
J. Nick Koston fde32555dc Restrict wake_loop_any_context to ESP32 only
LibreTiny lacks IRAM_ATTR support needed for ISR-safe paths,
and BK72xx doesn't support the mrs ipsr instruction in Thumb mode.
The existing fast select functionality on LibreTiny is unaffected.
2026-02-28 16:32:05 -10:00
J. Nick Koston f3c175ab39 [api] Remove virtual destructor from ProtoMessage
API protobuf messages are never deleted through base class pointers —
they are always stack-allocated and passed by reference. The virtual
destructor occupies 2 vtable slots (complete + deleting destructor)
on 32-bit platforms using the Itanium ABI, costing 8 bytes per vtable.

With 122 message classes, removing the virtual destructor saves
~976 bytes of flash. Each vtable shrinks from 24 bytes to 16 bytes.
2026-02-28 16:29:19 -10:00
J. Nick Koston 50dd56c59d Merge remote-tracking branch 'origin/esp8266-wake-loop-any-context' into integration 2026-02-28 15:46:49 -10:00
J. Nick Koston e36b0d09a7 [core] Add ESP8266 support to wake_loop_any_context()
Wire Application::wake_loop_any_context() to socket::socket_wake()
on ESP8266. This allows any component calling wake_loop_any_context()
from an ISR or callback to immediately wake the main loop from
esp_delay() sleep, instead of waiting up to 16ms for the timeout.

Changes:
- Add IRAM_ATTR to socket_wake() so it's safe to call from ISR context
- Add ESP8266 wake_loop_any_context() backed by socket::socket_wake()
- Extend enable_loop_soon_any_context() to wake the loop on ESP8266
2026-02-28 15:46:38 -10:00
J. Nick Koston 6e4e9ddeb5 Merge remote-tracking branch 'origin/esp8266-wake-loop-any-context' into integration 2026-02-28 15:41:28 -10:00
J. Nick Koston e04568cb83 [core] Add ESP8266 support to wake_loop_any_context()
Wire Application::wake_loop_any_context() to socket::socket_wake()
on ESP8266. This allows any component calling wake_loop_any_context()
from an ISR or callback to immediately wake the main loop from
esp_delay() sleep, instead of waiting up to 16ms for the timeout.

Changes:
- Add IRAM_ATTR to socket_wake() so it's safe to call from ISR context
- Add ESP8266 wake_loop_any_context() backed by socket::socket_wake()
- Extend enable_loop_soon_any_context() to wake the loop on ESP8266
2026-02-28 15:41:12 -10:00
J. Nick Koston 1034b559de Merge remote-tracking branch 'origin/uart-isr-wake-on-rx-default' into integration 2026-02-28 15:36:20 -10:00
J. Nick Koston bf180724a8 Merge remote-tracking branch 'origin/esp8266-wake-loop-any-context' into integration 2026-02-28 15:36:17 -10:00
J. Nick Koston fcb21998f8 Guard portYIELD_FROM_ISR with USE_ESP32
LibreTiny's FreeRTOS port does not provide portYIELD_FROM_ISR.
On ARM Cortex-M, FreeRTOS internally sets the PendSV bit when
vTaskNotifyGiveFromISR wakes a higher-priority task, so the
context switch happens automatically when the ISR returns.
2026-02-28 15:35:48 -10:00
J. Nick Koston bbb870594e [core] Add ESP8266 support to wake_loop_any_context()
Wire Application::wake_loop_any_context() to socket::socket_wake()
on ESP8266. This allows any component calling wake_loop_any_context()
from an ISR or callback to immediately wake the main loop from
esp_delay() sleep, instead of waiting up to 16ms for the timeout.

Changes:
- Add IRAM_ATTR to socket_wake() so it's safe to call from ISR context
- Add ESP8266 wake_loop_any_context() backed by socket::socket_wake()
- Extend enable_loop_soon_any_context() to wake the loop on ESP8266
2026-02-28 15:25:23 -10:00
J. Nick Koston bf7982a7b9 Merge remote-tracking branch 'upstream/isr-wake-enable-loop-soon' into integration 2026-02-28 15:14:11 -10:00
J. Nick Koston d570137d2b [uart] Enable wake-on-RX by default on ESP32
Now that the ISR callback mechanism (from #14382) costs essentially
zero — just a function pointer registration, no task or queue — enable
wake-on-RX by default for all ESP32 UART instances.

This reduces RX buffer overflow risk by waking the main loop
immediately when data arrives instead of waiting for the ~16ms
select timeout.

Remove the opt-in request_wake_loop_on_rx() API since all ESP32
UART instances now get this automatically.
2026-02-28 15:10:35 -10:00
J. Nick Koston 54126fef36 Only set USE_LWIP_FAST_SELECT when select support is available
The fast select code paths and wake_loop_any_context() require
USE_SOCKET_SELECT_SUPPORT. Gate USE_LWIP_FAST_SELECT on not using
lwip_tcp implementation which does not provide select() support.
2026-02-28 15:08:30 -10:00
J. Nick Koston 9f7508e50b Add IRAM_ATTR to esphome_get_ipsr for future-proofing
Currently a no-op on LibreTiny but ensures the function stays
in IRAM if the platform later defines IRAM_ATTR.
2026-02-28 15:01:52 -10:00
J. Nick Koston fb998468b5 Fix comment about function calls and initialize ipsr
- Update ISR safety comment: point 3 now reflects that
  wake_loop_any_context() is called (ISR-safe)
- Initialize ipsr = 0 as safety net before inline asm
2026-02-28 15:01:37 -10:00
J. Nick Koston 3ff8cde1cf Fix comment about function calls and initialize ipsr
- Update ISR safety comment: point 3 now reflects that
  wake_loop_any_context() is called (ISR-safe)
- Initialize ipsr = 0 as safety net before inline asm
2026-02-28 15:01:12 -10:00
J. Nick Koston 9b8fe6230c Merge remote-tracking branch 'upstream/isr-wake-enable-loop-soon' into integration 2026-02-28 14:56:19 -10:00
J. Nick Koston bdeba1710e Address review feedback for ISR wake support
- Replace __get_IPSR() with inline asm to avoid CMSIS header dependency
  on LibreTiny chip families that may not declare it (e.g. beken-72xx)
- Pass local variable to wake_from_isr and call portYIELD_FROM_ISR for
  immediate context switch instead of passing NULL
- Update comment in component.cpp to mention both ESP32 and LibreTiny
  platform-specific context detection
- Switch USE_LWIP_FAST_SELECT from cg.add_define to cg.add_build_flag
  so it is visible in .c translation units, aligning guards across all
  source files
2026-02-28 14:54:05 -10:00
J. Nick Koston 6017ce2c74 Merge branch 'isr-wake-enable-loop-soon' into integration 2026-02-28 14:35:03 -10:00
J. Nick Koston ec8d2b5f0d Merge remote-tracking branch 'upstream/dev' into isr-wake-enable-loop-soon 2026-02-28 14:29:15 -10:00
J. Nick KostonandCopilot 3f97b3b706 [core] Extract set_status_flag_ helper to deduplicate status_set methods (#14384)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-02-28 14:27:06 -10:00
J. Nick Koston 82e620bcf5 [ld2450] Single-pass zone target counting (#14387) 2026-02-28 14:26:55 -10:00
J. Nick Koston 80e0761bf1 [ld2450] Use integer dedup for direction text sensor updates (#14386) 2026-02-28 14:26:31 -10:00
J. Nick Koston c0781d3680 [ld2450] Use atan2f for angle calculation (#14388) 2026-02-28 14:26:08 -10:00
J. Nick Koston b7cb65ec49 [ci] Fix TypeError in ci-custom.py when POST lint checks fail (#14378) 2026-02-28 14:23:20 -10:00
J. Nick Koston fdbfac15db [uart] Replace wake-on-RX task+queue with direct ISR callback (#14382) 2026-03-01 00:21:08 +00:00
J. Nick Koston 4cf6376477 Merge remote-tracking branch 'origin/ld2450-atan2f-angle' into integration 2026-02-28 14:07:39 -10:00
J. Nick Koston b83904f533 Merge remote-tracking branch 'origin/ld2450-direction-dedup' into integration 2026-02-28 14:07:30 -10:00
J. Nick Koston d046e3f530 Merge remote-tracking branch 'origin/ld2450-single-pass-zone-counting' into integration 2026-02-28 14:07:20 -10:00
J. Nick Koston 5b3cb1c9d9 Merge remote-tracking branch 'origin/integration' into integration 2026-02-28 13:52:19 -10:00
J. Nick Koston ccf523124c Merge branch 'uart-isr-wake-on-rx' into integration 2026-02-28 13:52:04 -10:00
J. Nick Koston 19016d5296 Merge remote-tracking branch 'origin/pack-entity-strings' into integration 2026-02-28 13:52:01 -10:00
J. Nick KostonandCopilot 28424d6acd [ld2410][ld2412] Fix signed char causing incorrect distance values (#14380)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-02-28 23:50:12 +00:00
J. Nick Koston 6248177356 Merge branch 'dev' into uart-isr-wake-on-rx 2026-02-28 13:27:56 -10:00
J. Nick Koston b679b04d14 [core] Move CONF_STOP_BITS, CONF_DATA_BITS, CONF_PARITY to const.py (#14379) 2026-02-28 13:27:33 -10:00
J. Nick Koston de71389c14 [ld2450] Use atan2f for angle calculation
Replace acosf(y/distance) + sign flip with atan2f(-x, y) which
computes the angle from the Y axis directly. This eliminates the
division by distance, the acosf call, the sign branch, and the
calculate_angle helper function entirely.

atan2f also handles all quadrants correctly by definition, avoiding
the edge-case guard that silently returned 0 when y was negative.
2026-02-28 13:26:11 -10:00
J. Nick Koston 0c705d7766 [ld2450] Single-pass zone target counting
Merge the two separate count_targets_in_zone_ calls (one for still,
one for moving) into a single pass that counts both simultaneously.
This halves the number of iterations through the target list per zone
(from 6 calls to 3 for 3 zones).
2026-02-28 13:19:16 -10:00
J. Nick Koston 90307f493b Merge branch 'pack-entity-strings' into integration 2026-02-28 13:16:44 -10:00
J. Nick Koston d43aa2ea90 Merge branch 'uart-isr-wake-on-rx' into isr-wake-enable-loop-soon 2026-02-28 13:16:24 -10:00
J. Nick Koston 4ac226dbd5 Merge branch 'dev' into pack-entity-strings 2026-02-28 13:13:35 -10:00
J. Nick Koston 128259870e [ld2450] Use integer dedup for direction text sensor updates
Replace per-frame string comparison with Deduplicator<uint8_t> on
the direction enum value. The previous code called get_state() and
compared std::string against const char* on every frame for each
target (~75 times/sec). The new approach does a single uint8_t
comparison and only looks up the direction string and publishes
when the direction actually changes.

Also use MAX_TARGETS instead of hardcoded 3 for direction_text_sensors_
array size for consistency with all other sensor arrays.
2026-02-28 13:11:18 -10:00
Jonathan SwobodaandCopilot b7d651dd17 [core] Defer entity automation codegen to prevent sibling ID deadlocks (#14381)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-02-28 13:10:53 -10:00
J. Nick Koston 2d466c0f85 Merge branch 'uart-isr-wake-on-rx' into integration 2026-02-28 12:26:54 -10:00
J. Nick Koston e7fc69e453 reorder 2026-02-28 12:26:31 -10:00
J. Nick Koston 8a30e74464 Merge remote-tracking branch 'upstream/core-set-status-flag-helper' into integration 2026-02-28 12:08:33 -10:00