Commit Graph
1117 Commits
Author SHA1 Message Date
J. Nick Koston 9d43ed77c6 Merge remote-tracking branch 'origin/scheduler-interval-direct-heap' into integration 2026-04-06 20:58:44 -10:00
J. Nick Koston c79e7f4018 [core] Reschedule fired intervals directly into heap instead of to_add_
When an interval fires in Scheduler::call(), push it directly back into
items_ via push_back() + push_heap() instead of routing through the
to_add_ staging vector and process_to_add_slow_path_().

This eliminates per-cycle overhead of process_to_add_slow_path_() which
acquires a lock, iterates to_add_, pushes each item into the heap, clears
the vector, and resets the atomic counter.
2026-04-06 20:37:04 -10:00
J. Nick Koston d3df97f534 Merge remote-tracking branch 'origin/api-max-data-length-force' into integration 2026-04-06 18:42:13 -10:00
J. Nick Koston cf9e79beda Merge branch 'dev' into api-max-data-length-force 2026-04-06 18:34:36 -10:00
J. Nick Koston cfcf9216f3 [core] Add cv.ByteLength validator, switch all proto-backed length checks to byte length
Add cv.ByteLength() validator that checks UTF-8 byte length instead
of character count. This ensures multibyte characters don't cause
the encoded string to exceed the proto max_data_length limit.

Switch all length validators that feed into proto fields with
max_data_length annotations to use byte length:
- Entity names, friendly names, area names, device names
- Icons, device classes, units of measurement
- Board names, project name/version
2026-04-06 18:33:04 -10:00
J. Nick Koston 5a92a3b16e [api] Add max_data_length/force to model and project fields, validate board/project lengths
Add BOARD_MAX_LENGTH and PROJECT_MAX_LENGTH constants (127) and
enforce them in YAML validation for all platform board schemas
and project name/version.

Add max_data_length + force proto options to model, project_name,
and project_version fields in DeviceInfoResponse.
2026-04-06 18:14:18 -10:00
J. Nick Koston f94e1dfab6 [core] Move ControllerRegistry notify methods inline into header (#15505) 2026-04-07 16:12:01 +12:00
J. Nick Koston 10b38e1588 [api] Add max_data_length proto option and optimize entity name/object_id (#15426) 2026-04-07 03:31:01 +00:00
J. Nick Koston 3c55828d81 Merge remote-tracking branch 'origin/controller-registry-inline-notify' into integration 2026-04-06 16:23:19 -10:00
J. Nick Koston e3e191b783 Merge remote-tracking branch 'upstream/dev' into integration 2026-04-06 16:23:07 -10:00
J. Nick Koston ef29b18e18 [core] Move ControllerRegistry notify methods inline into header
Move the notify_*_update() method definitions from controller_registry.cpp
into controller_registry.h as inline functions. These are tiny loops over
1-2 controllers that each have a single call site in the entity's
notify_frontend_() method.

When defined in a separate TU, the compiler cannot inline them at the call
site without LTO, resulting in an unnecessary function-call frame on every
state publish. CodSpeed profiling of the CallbackManager container change
(#15272) showed this extra frame accounting for ~12% regression in text
sensor publish benchmarks.

controller_registry.h is only ever included from .cpp files (never from
other headers), so including controller.h after the class definition is
safe and introduces no circular dependencies.
2026-04-06 16:09:32 -10:00
J. Nick Koston 96c3986481 [core] Replace std::vector in CallbackManager with trivial-copy container (#15272) 2026-04-07 01:58:17 +00:00
J. Nick Koston 82dc80a413 [scheduler] Skip cancel for anonymous items, add empty-container fast path (#15397) 2026-04-07 01:26:40 +00:00
J. Nick Koston 13e35db055 Restore IRAM_ATTR on wake_loop functions 2026-04-06 14:03:19 -10:00
J. Nick Koston 7c671cd0e6 Merge branch 'api-proto-max-length' into integration
# Conflicts:
#	esphome/components/api/api_connection.cpp
#	esphome/components/api/api_pb2.cpp
#	esphome/components/api/proto.h
#	esphome/core/application.h
#	esphome/core/component.cpp
#	script/api_protobuf/api_protobuf.py
2026-04-06 14:02:14 -10:00
J. Nick Koston 87622c9a74 [api] Add max_data_length proto option and optimize entity string encoding
Add a max_data_length field option to api_options.proto for string/bytes
fields. When max_data_length < 128 and force = true, the code generator
uses encode_short_string_force() — a single call that writes the tag
byte, 1-byte length varint, and raw string data with no branching. Size
calculation simplifies from calc_length(1, size) to 2 + size.

Annotate entity fields across all 25 ListEntities*Response messages:
- name and object_id: max_data_length = 120, force = true (50 fields)
- icon: max_data_length = 63 (25 fields)

The 120 and 63 values match NAME_MAX_LENGTH and ICON_MAX_LENGTH in
esphome/core/config.py, validated at config time.
2026-04-06 13:28:50 -10:00
J. Nick KostonandJonathan Swoboda ab45591507 [core] Move wake_loop out of socket component into core (#15446)
Co-authored-by: Jonathan Swoboda <154711427+swoboda1337@users.noreply.github.com>
2026-04-06 21:01:03 +00:00
J. Nick Koston bc47757af1 Merge remote-tracking branch 'upstream/dev' into integration 2026-04-05 18:39:27 -10:00
J. Nick Koston 10f08e0802 [esp8266] Add crash handler for post-mortem diagnostics (#15465) 2026-04-06 03:30:56 +00:00
Keith BurzinskiandClaude Opus 4.6 07f6be679f [esp32] Add signed app verification without hardware secure boot (#15357)
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-05 21:20:48 -05:00
J. Nick Koston f81e1c37da Merge remote-tracking branch 'upstream/esp8266-crash-handler' into integration 2026-04-05 13:39:46 -10:00
J. Nick Koston 50073a24b5 [esp8266] Add crash handler for post-mortem diagnostics
Add a crash handler for ESP8266 that captures and logs crash data
from previous boots, matching the existing ESP32 and RP2040
implementations. Uses the SDK's rst_info (always available after
reboot) for basic crash info and Arduino's custom_crash_callback
to scan the stack for return addresses stored in RTC user memory.
2026-04-05 11:50:35 -10:00
J. Nick Koston 2b4448db02 Merge remote-tracking branch 'upstream/move-wake-to-core' into integration 2026-04-04 13:43:10 -10:00
J. Nick Koston c17df9aaa3 Deduplicate RP2040 wake: wake_loop_threadsafe delegates to wake_loop_any_context 2026-04-04 13:19:03 -10:00
J. Nick Koston 2ead905e44 Fix ESP8266 wakeable_delay wake loss, use BaseType_t* for ISR-safe API 2026-04-04 13:13:41 -10:00
J. Nick Koston 0b90dbf328 Document LibreTiny IRAM_ATTR and ISR-safe wake limitations 2026-04-04 13:03:11 -10:00
J. Nick Koston e2c71419b6 Revert LibreTiny ISR change: FreeRTOS port lacks vTaskNotifyGiveFromISR/portYIELD_FROM_ISR 2026-04-04 13:00:57 -10:00
J. Nick Koston 670a23b4c1 Fix LibreTiny ISR safety: use vTaskNotifyGiveFromISR in wake_loop_any_context, update stale comment 2026-04-04 12:59:34 -10:00
J. Nick Koston 59969d4743 Simplify loop(): single yield_with_select_ call 2026-04-04 12:22:44 -10:00
J. Nick Koston c74889de67 Fix clang-tidy: rename wake_loop_impl_ to wake_loop_impl (no trailing underscore on free functions) 2026-04-04 12:10:42 -10:00
J. Nick Koston 58ab4866a6 Document Zephyr as the only platform without wake 2026-04-04 11:59:04 -10:00
J. Nick Koston 36b3d35d15 Fix Zephyr build: add fallback wakeable_delay and wake_loop_threadsafe 2026-04-04 11:58:33 -10:00
J. Nick Koston ac95bde627 Move RP2040 wakeable_delay to wake.cpp (file-scope state for alarm callback) 2026-04-04 11:49:22 -10:00
J. Nick Koston 113edd2076 Fix CI: remove redundant (void) in main_task.h, restore lwip_fast_select.h include for socket monitoring 2026-04-04 11:46:21 -10:00
J. Nick Koston 277c4f6343 Filter main_task.c and lwip_fast_select.c from platforms that don't need them 2026-04-04 11:45:44 -10:00
J. Nick Koston 1dc0559e20 Inline main_task notify helpers in header, simplify wake.h 2026-04-04 11:40:55 -10:00
J. Nick Koston 6dcdefe179 Move task notification helpers to main_task.c/h, deduplicate ESP32/LibreTiny in wake.h 2026-04-04 11:39:10 -10:00
J. Nick Koston a1e6a89fc8 Share task handle between wake.h and lwip_fast_select via main_task.h 2026-04-04 11:36:49 -10:00
J. Nick Koston 36d2b78c18 Unify ESP32/LibreTiny wake: always use g_main_task_handle, remove lwip_fast_select dependency 2026-04-04 11:34:10 -10:00
J. Nick Koston 63b8275e23 Fix ISR safety: ESP32 without fast select needs xPortInIsrContext detection 2026-04-04 11:30:45 -10:00
J. Nick Koston aa0e56bfde Fix ESP32/LibreTiny without fast select: use FreeRTOS task notifications directly 2026-04-04 11:28:21 -10:00
J. Nick Koston 80ff9f365b Fix wake.cpp: move includes outside namespace to fix cpptests build 2026-04-04 11:21:52 -10:00
J. Nick Koston cb3791ae8a Deduplicate g_main_loop_woke definition in wake.cpp 2026-04-04 11:18:54 -10:00
J. Nick Koston 75a2b23bdb Replace USE_SOCKET_SELECT_SUPPORT with USE_HOST 2026-04-04 11:16:41 -10:00
J. Nick Koston 5dd43bca2d Simplify wake.h file doc 2026-04-04 11:11:13 -10:00
J. Nick Koston 7e8d3ba13e Inline RP2040 wakeable_delay using function-local static + lambda callback 2026-04-04 11:08:41 -10:00
J. Nick Koston 0bf0fc7eb8 Inline ESP8266 wakeable_delay (no static state, 5 lines) 2026-04-04 11:07:41 -10:00
J. Nick Koston aaead7b5eb Move wakeable_delay into namespace internal to signal it's not public API 2026-04-04 11:07:01 -10:00
J. Nick Koston 95e8a22250 Fix wake_loop_isrsafe comment: ESP32 only, not LibreTiny 2026-04-04 11:03:07 -10:00
J. Nick Koston ad3c92e3f7 Remove unused wakeable_delay on host 2026-04-04 11:01:11 -10:00