Commit Graph
26527 Commits
Author SHA1 Message Date
J. Nick Koston 85d9f36028 Merge remote-tracking branch 'upstream/api-proto-max-value-codegen' into integration 2026-04-03 12:48:23 -10:00
J. Nick Koston 9ece286a26 [api] Simplify _get_single_byte_varint_size 2026-04-03 12:32:32 -10:00
J. Nick Koston fa80caf0ff [api] Fall back to RAW_ENCODE_MAP when SMALL_MAP has no entry 2026-04-03 12:31:44 -10:00
J. Nick Koston f3238a857e [api] Select encode map before lookup 2026-04-03 12:31:01 -10:00
J. Nick Koston 02b424388e [api] Use RAW_ENCODE_SMALL_MAP for max_value encode optimization
Replace inline encode_func check with a lookup table, matching the
existing RAW_ENCODE_MAP pattern.
2026-04-03 12:28:51 -10:00
J. Nick Koston 363d811cc1 [api] Use _get_simple_size_calculation for FixedArrayBytesType fallback
Replace inline calc_length/calc_length_force formatting with the
existing helper method.
2026-04-03 12:27:55 -10:00
J. Nick Koston 1e68a90ac9 [api] Extract _get_single_byte_varint_size helper in codegen
Refactor the constant-size varint pattern into a reusable helper
method on the TypeInfo base class, used by both UInt32Type (max_value)
and FixedArrayBytesType (fixed_array_size < 128).
2026-04-03 12:26:51 -10:00
J. Nick Koston e35aa729f3 [api] Add max_value proto option for constant-size varint codegen
Add a max_value field option to api_options.proto that tells the code
generator the maximum value a field can have. When max_value < 128,
the generated calculate_size() uses constant arithmetic instead of
calling varint size functions, and encode() uses direct byte writes
instead of varint encoding.

Also optimize FixedArrayBytesType: when fixed_array_size < 128, the
length varint is always 1 byte, so calculate_size() uses constant
arithmetic and encode() uses write_raw_byte for the length.

Applied to BluetoothLERawAdvertisement.address_type (max_value=4).

Measured on ESP32 (upstairsdesk89proxy):
- BluetoothLERawAdvertisement::calculate_size: 88 → 71 bytes (-19%)
- BluetoothLERawAdvertisement::encode: 199 → 179 bytes (-10%)
- Total BLE proxy hot path: 1807 → 1770 bytes (-37 bytes)
2026-04-03 12:21:37 -10:00
J. Nick Koston 2364a54ee9 Merge remote-tracking branch 'upstream/libretiny-wifi-queue-abstraction' into integration 2026-04-03 10:24:52 -10:00
J. Nick Koston 3ee213f6f4 Merge branch 'esp32_ble_loop_skip_memw' into integration 2026-04-03 10:24:47 -10:00
J. Nick Koston 669a308209 Use pop() instead of empty() for wifi_loop_ fast path
Replace empty() + pop() with pop() directly as the fast-path check:

- LockFreeQueue: pop() costs 1 memw (acquire on tail_) vs empty()'s
  2 memw (acquire on both head_ and tail_) on Xtensa
- FreeRTOSQueue: pop() is 1 critical section vs empty() + pop() = 2

Also move dropped count check after the drain loop since drops can
only occur when the queue was full, and only this loop drains it.
2026-04-03 10:23:49 -10:00
J. Nick Koston d341ee8c76 [esp32_ble] Skip dropped count check when queue is empty
On Xtensa (dual-core ESP32), even relaxed atomic loads emit a memw
barrier instruction. The dropped_count_ check in get_and_reset_dropped_count()
was executing every loop() iteration even when the queue was empty.

Since drops only occur when the queue is full, and only the main loop
drains the queue, an empty queue guarantees no new drops since the last
reset. Restructure the loop to early-return when pop() returns nullptr,
skipping the unnecessary memw.

Also moves advertising_->loop() before the queue drain so it runs
unconditionally without duplication, and converts while to do/while
since the first element is known non-null after the nullptr check.
2026-04-03 10:21:20 -10:00
J. Nick Koston 4d4ff0303d Merge remote-tracking branch 'upstream/dev' into integration 2026-04-03 10:03:23 -10:00
dependabot[bot] f8f65c1a7b Bump click from 8.3.1 to 8.3.2 (#15421)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-03 09:42:37 -10:00
J. Nick Koston d90e2a6a9a [core] Use __builtin_ctz for FiniteSetMask bit scanning (#15400) 2026-04-03 08:28:54 -10:00
J. Nick Koston 4969fd6e99 [light] Use reciprocal multiply in normalize_color (#15401) 2026-04-03 08:28:41 -10:00
J. Nick Koston 95683b7416 [light] Pass LightTraits to avoid redundant virtual get_traits() calls (#15403) 2026-04-03 08:28:29 -10:00
J. Nick Koston 38f4dc3217 [uptime] Pass known length to publish_state to avoid redundant strlen (#15410) 2026-04-03 08:28:07 -10:00
J. Nick Koston f2a0d9943d [benchmarks] Add host platform benchmarks for text_sensor and button (#15407) 2026-04-03 08:27:55 -10:00
J. Nick Koston ea0227a206 [benchmarks] Add host platform benchmarks for number, select, and switch (#15405) 2026-04-03 08:27:44 -10:00
J. Nick Koston 5a23669747 [scheduler] Fix unrealistic scheduler benchmarks missing periodic drain (#15396) 2026-04-03 08:27:29 -10:00
J. Nick Koston 2a5933e4f7 [host] Add graceful shutdown on SIGINT/SIGTERM (#15387) 2026-04-03 08:27:13 -10:00
Jonathan Swoboda 6fecd72049 [ezo_pmp] Fix change_i2c_address action using wrong template type (#15393) 2026-04-03 08:35:16 -04:00
Clyde Stubbs 8360502a94 [ci] Fix deprecated-component matcher (#15417) 2026-04-03 08:01:04 -04:00
Jonathan Swoboda 5548a32771 [ili9xxx] Fix SPI MOSI pin validation never executing (#15399) 2026-04-03 21:15:51 +11:00
Clyde Stubbs 6f05e3d204 [ci] Run ci-custom.py as a pre-commit check (#15411) 2026-04-03 12:54:44 +11:00
Jonathan Swobodaandclydebarrow bcd8ddeabe [lvgl] Fix ext_click_area property application (#15394)
Co-authored-by: clydebarrow <2366188+clydebarrow@users.noreply.github.com>
2026-04-03 12:44:54 +11:00
Clyde Stubbs af662da90d [mipi_spi] Rotation and buffer size changes (#15047) 2026-04-03 12:28:45 +11:00
J. Nick Koston 3ba41c6f7e Merge remote-tracking branch 'upstream/select-switch-logv-downgrade' into integration 2026-04-02 15:12:38 -10:00
J. Nick Koston 363309a870 Merge remote-tracking branch 'upstream/uptime-text-sensor-pass-size' into integration 2026-04-02 15:12:30 -10:00
J. Nick Koston 5e471f45be Merge remote-tracking branch 'upstream/button-logv-downgrade' into integration 2026-04-02 15:12:17 -10:00
J. Nick Koston 288d98f5ef [uptime] Pass known length to publish_state to avoid redundant strlen 2026-04-02 15:11:00 -10:00
J. Nick Koston 59c33628a6 Downgrade button press logging from DEBUG to VERBOSE 2026-04-02 15:04:14 -10:00
J. Nick Koston 27522d7462 Add host platform benchmarks for text_sensor and button components 2026-04-02 14:57:39 -10:00
J. Nick Koston c8db8faab2 Merge branch 'bench-number-select-switch' into select-switch-logv-downgrade 2026-04-02 14:55:04 -10:00
J. Nick Koston 2058eda7fa Address review: fix misleading comment, remove unused constants 2026-04-02 14:54:28 -10:00
J. Nick Koston 46f8e46548 Downgrade select and switch control path logging from DEBUG to VERBOSE
The ESP_LOGD calls in SelectCall::perform() and Switch::turn_on/turn_off/toggle
are redundant with aioesphomeapi's state_log_formatter which already logs both
commands and state changes on the HA side. Benchmarks show these ESP_LOGD calls
dominate the control path cost (~13M ops/s for SelectCall vs ~180M ops/s for
publish_state).

This aligns select and switch with climate and fan which already use ESP_LOGV
for their call perform() paths.
2026-04-02 14:48:43 -10:00
J. Nick Koston 8a0d3158a0 Add host platform benchmarks for number, select, and switch components 2026-04-02 14:39:48 -10:00
J. Nick Koston 9e050c0106 Merge remote-tracking branch 'upstream/light-pass-traits' into integration 2026-04-02 14:03:53 -10:00
J. Nick Koston 9c757eae16 Merge remote-tracking branch 'upstream/light-normalize-mul' into integration 2026-04-02 14:03:49 -10:00
J. Nick Koston ea75bb83c4 Merge remote-tracking branch 'upstream/finite-set-mask-ctz' into integration 2026-04-02 14:03:44 -10:00
J. Nick Koston ded6465056 Fix clang-tidy: use uint64_t instead of unsigned long long 2026-04-02 13:59:41 -10:00
J. Nick Koston af41cc2d66 Address review: clamp to MAX_BITS, add ctzll branch for >32-bit masks
Clamp the __builtin_ctz result to MAX_BITS to match the original loop
semantics if out-of-range bits are ever present. Add ctzll branch for
hypothetical >32-bit bitmask types.
2026-04-02 13:48:36 -10:00
J. Nick Koston c35b36b8e7 [light] Pass LightTraits to compute_color_mode_ and transform_parameters_
Pass the already-fetched LightTraits from validate_() to
compute_color_mode_() and transform_parameters_() instead of each
calling get_traits() independently. This eliminates 2 redundant
virtual calls through output_->get_traits().

As a side effect, the compiler inlines both functions into validate_(),
eliminating their call overhead. Total hot path shrinks by 451 bytes.
2026-04-02 13:46:30 -10:00
J. Nick Koston bce8e6ecb6 Fix clang-tidy: add braces, use uint32_t instead of unsigned long 2026-04-02 13:41:18 -10:00
J. Nick Koston 4981b3c671 [light] Use reciprocal multiply in normalize_color
Replace 3 software float divides (__divsf3) with 1 divide + 3 native
mul.s instructions. Xtensa has no FPU divide, so __divsf3 is a ~20-30
cycle software routine. This saves ~40-60 cycles per normalize_color
call for +8 bytes of flash.
2026-04-02 13:36:48 -10:00
J. Nick Koston b4fa217ab3 [core] Use __builtin_ctz for find_lowest_set_bit in FiniteSetMask
Replace the linear bit-scanning loop in find_next_set_bit with
__builtin_ctz (compiles to single-cycle NSAU on Xtensa). Also rename
to find_lowest_set_bit and drop the unused start_bit parameter since
all call sites pass 0.

This eliminates the standalone find_next_set_bit function and replaces
3 function calls + loops in compute_color_mode_ with inline NSAU
instructions.
2026-04-02 13:33:42 -10:00
Keith Burzinski 710186998b [ota] Use modernized namespace syntax (#15398) 2026-04-02 19:12:05 -04:00
J. Nick Koston 8f49aab070 Merge branch 'scheduler-cancel-fast-path' into integration 2026-04-02 12:23:15 -10:00
J. Nick Koston 0fb534bb28 [scheduler] Skip cancel for anonymous items, add empty-container fast path
Two optimizations to reduce overhead in the scheduler hot path:

1. Skip cancel_item_locked_ entirely for anonymous items (STATIC_STRING
   with nullptr name) in set_timer_common_. These can never match any
   existing item, so the scan is pure waste. This is the common path
   for Component::defer(func).

2. Split mark_matching_items_removed_locked_ into an inline wrapper
   that checks for empty containers and a noinline slow path. This
   avoids the function call overhead when containers are empty, which
   is the common case for defer_queue_ and to_add_ after draining.
2026-04-02 11:57:57 -10:00