Commit Graph
22810 Commits
Author SHA1 Message Date
J. Nick Koston d51b0e51b1 Merge remote-tracking branch 'origin/api_varint_split_32_64' into integration 2026-02-19 20:25:25 -06:00
J. Nick Koston 21b9a4139a Address review feedback: fix unconditional guard bug, add ifndef guard, clarify comment
- Fix get_varint64_ifdef() to return unconditional guard when any 64-bit
  varint field has no ifdef (None in ifdefs set)
- Wrap USE_API_VARINT64 define with #ifndef to avoid redefinition warnings
  when esphome/core/defines.h also defines it (test/IDE builds)
- Clarify proto.h comment about uint32_t shift behavior at byte 4
- Add namespace to generated api_pb2_defines.h for linter compliance
2026-02-19 20:23:17 -06:00
J. Nick Koston 4e3b2abd5f Fix ODR violation: generate api_pb2_defines.h for consistent ProtoVarInt layout
USE_API_VARINT64 was only defined in api_pb2.h, but proto.cpp (where
decode() and parse_wide() live) includes proto.h directly. This caused:

1. parse_wide() not compiled in proto.cpp (guarded by #ifdef)
2. decode() used 32-bit-only parse(), returning {} for varints > 5 bytes
3. ODR violation: ProtoVarInt was 4 bytes in proto.cpp but 8 bytes in
   api_pb2*.cpp translation units

For bluetooth_proxy, 48-bit BLE addresses encode as 7-byte varints.
The failed parse caused decode() to return early, leaving request_type
at its default value of 0 (BLUETOOTH_DEVICE_REQUEST_TYPE_CONNECT),
producing spurious "V1 connections removed" errors.

Fix: Generate api_pb2_defines.h with the USE_API_VARINT64 define and
include it from proto.h, ensuring all translation units see a consistent
ProtoVarInt layout.
2026-02-19 20:08:29 -06:00
J. Nick Koston 63fcec755a Merge remote-tracking branch 'swoboda1337/esp-idf-5.5.3' into integration 2026-02-19 19:37:29 -06:00
J. Nick Koston d233e1e6ae Merge remote-tracking branch 'origin/integration' into integration 2026-02-19 19:13:22 -06:00
J. Nick Koston 55f1ef2969 Merge branch 'e131-drain-socket-buffer' into integration 2026-02-19 19:13:11 -06:00
J. Nick Koston 9c445648c2 [e131] Move read_() to header for inlining 2026-02-19 19:12:47 -06:00
J. Nick Koston 47dd62d27a Merge remote-tracking branch 'origin/e131-drain-socket-buffer' into integration 2026-02-19 19:12:01 -06:00
J. Nick Koston 6fa6213348 Merge remote-tracking branch 'origin/e131-drain-socket-buffer' into integration 2026-02-19 19:07:56 -06:00
J. Nick Koston b8859b990e [e131] Drain all queued packets per loop iteration
Previously the BSD socket path read only one UDP packet per loop()
call. With multi-universe setups (e.g. 380 RGBW LEDs across 3
universes), this caused the light to re-render the entire strip
for each universe packet separately, resulting in visible tearing
and ~3x unnecessary RMT writes.

Now both socket backends drain all available packets before returning,
so multi-universe frames are applied atomically and the light only
writes once per frame. The duplicated packet processing logic is
consolidated into a shared loop with a platform-specific read_()
helper.

Tested on ESP32-IDF with 380 SK6812 RGBW LEDs (3 universes):
- Light total CPU dropped from 5820ms to 1108ms per 60s (~5x)
- Combined e131+light dropped from 6944ms to 4811ms per 60s
- Visible tearing eliminated
2026-02-19 19:04:59 -06:00
J. Nick KostonandClaude Opus 4.6 c1265a9490 [core] Use constexpr for hand-written PROGMEM arrays in C++ (#14129)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 18:54:57 -06:00
J. Nick KostonandClaude Opus 4.6 94712b3961 [esp8266][web_server] Use constexpr for PROGMEM arrays in codegen (#14128)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 18:54:44 -06:00
J. Nick KostonandClaude Opus 4.6 d29288547e [core] Use constexpr for PROGMEM arrays (#14127)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 18:54:33 -06:00
Jonathan SwobodaandClaude Opus 4.6 1b4de55efd [pulse_counter] Fix PCNT glitch filter calculation off by 1000x (#14132)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 00:12:37 +00:00
J. Nick Koston cceb109303 [uart] Always call pin setup for UART0 default pins on ESP-IDF (#14130) 2026-02-19 23:48:18 +00:00
Jonathan SwobodaandClaude Opus 4.6 d9920591b9 [esp32] Bump ESP-IDF to 5.5.3
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 18:35:41 -05:00
J. Nick Koston 57727cba8e Merge remote-tracking branch 'upstream/fix-uart0-pin-setup' into integration 2026-02-19 17:22:18 -06:00
J. Nick KostonandClaude Opus 4.6 dcff159a33 [uart] Make is_default_uart0_pin constexpr
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 17:20:54 -06:00
J. Nick KostonandClaude Opus 4.6 d7f8ddb15f [uart] Always call pin setup for UART0 default pins on ESP-IDF
Fix UART0 communication failure on ESP-IDF 5.4.2+ that affected LD2410
and other UART sensors on default UART0 pins across all ESP32 variants.

The gpio_reset_pin() workaround from PR #12519 sets GPIO_MODE_DISABLE
which disables the input buffer. Without a subsequent pin->setup() call,
uart_set_pin() on IOMUX-connected UART0 default pins does not re-enable
the input buffer, so the RX pin cannot receive data.

PR #11914 made pin->setup() conditional on pull/open-drain flags, which
meant most users' UART0 RX pins never got their input buffer re-enabled.

The fix: always call pin->setup() for pins matching U0TXD_GPIO_NUM or
U0RXD_GPIO_NUM to restore proper GPIO direction after gpio_reset_pin().
For non-UART0 pins, the conditional behavior is preserved to avoid
breaking external components (issue #11823).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 17:19:47 -06:00
J. Nick Koston 3def55754c Merge branch 'fix-uart0-pin-setup' into integration 2026-02-19 17:16:36 -06:00
J. Nick KostonandClaude Opus 4.6 e81eff22c3 [uart] Always call pin setup for UART0 default pins on ESP-IDF
Fix UART0 communication failure on ESP-IDF 5.4.2+ that affected LD2410
and other UART sensors on default UART0 pins across all ESP32 variants.

The gpio_reset_pin() workaround from PR #12519 sets GPIO_MODE_DISABLE
which disables the input buffer. Without a subsequent pin->setup() call,
uart_set_pin() on IOMUX-connected UART0 default pins does not re-enable
the input buffer, so the RX pin cannot receive data.

PR #11914 made pin->setup() conditional on pull/open-drain flags, which
meant most users' UART0 RX pins never got their input buffer re-enabled.

The fix: always call pin->setup() for pins matching U0TXD_GPIO_NUM or
U0RXD_GPIO_NUM to restore proper GPIO direction after gpio_reset_pin().
For non-UART0 pins, the conditional behavior is preserved to avoid
breaking external components (issue #11823).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 17:13:32 -06:00
J. Nick Koston 57e20e4192 Merge remote-tracking branch 'upstream/constexpr-progmem-codegen' into integration 2026-02-19 17:04:13 -06:00
J. Nick KostonandClaude Opus 4.6 051cba20a3 Also use constexpr for size variables
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 17:02:48 -06:00
J. Nick Koston 9523670546 Merge branch 'remove-powf-normalize-accuracy' into integration 2026-02-19 16:50:04 -06:00
J. Nick KostonandClaude Opus 4.6 9ce63603a6 Fix pow10_int comment accuracy
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 16:48:55 -06:00
J. Nick Koston 5a8fa6a9cd Merge remote-tracking branch 'origin/integration' into integration 2026-02-19 16:40:45 -06:00
J. Nick Koston 0e6d0a0918 Merge branch 'constexpr-progmem' into integration 2026-02-19 16:40:31 -06:00
J. Nick Koston c92ff7db81 Merge branch 'constexpr-progmem-codegen' into integration 2026-02-19 16:40:26 -06:00
J. Nick Koston 2866be72d9 Merge branch 'constexpr-progmem-cpp' into integration 2026-02-19 16:40:20 -06:00
J. Nick KostonandClaude Opus 4.6 9e0237d68f [core] Use constexpr for hand-written PROGMEM arrays in C++
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 16:38:46 -06:00
J. Nick KostonandClaude Opus 4.6 ad3b3387df [esp8266][web_server] Use constexpr for hand-written PROGMEM arrays in codegen
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 16:35:48 -06:00
J. Nick KostonandClaude Opus 4.6 41346716cc [core] Use constexpr for PROGMEM arrays
Change progmem_array codegen from `static const` to `static constexpr`.
This ensures the compiler evaluates the array at compile time with no
runtime initialization, and is the correct qualifier for constant data
known at compile time.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 16:33:38 -06:00
J. Nick Koston bc72ad0035 Merge remote-tracking branch 'origin/constexpr-progmem' into integration 2026-02-19 16:31:21 -06:00
J. Nick KostonandClaude Opus 4.6 6608b3493c [core] Use constexpr for PROGMEM arrays
Change progmem_array codegen from `static const` to `static constexpr`.
This ensures the compiler evaluates the array at compile time with no
runtime initialization, and is the correct qualifier for constant data
known at compile time.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 16:30:16 -06:00
J. Nick Koston ce6f7e3523 Merge remote-tracking branch 'origin/light-gamma-lut' into integration 2026-02-19 16:20:58 -06:00
J. Nick KostonandClaude Opus 4.6 0af520f716 [light] Guard gamma LUT behind USE_LIGHT_GAMMA_LUT define
Only set when at least one light has gamma_correct configured.
On-off lights with no gamma get inline passthrough that the
compiler eliminates entirely — zero gamma code in the binary.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 16:16:39 -06:00
J. Nick Koston e520c7e982 Merge remote-tracking branch 'origin/remove-powf-dlms-kamstrup' into integration 2026-02-19 16:03:15 -06:00
J. Nick Koston d2b0dd106a Merge remote-tracking branch 'origin/light-gamma-lut' into integration 2026-02-19 16:03:04 -06:00
J. Nick Koston 9b4dc0e40e [dlms_meter/kamstrup_kmp] Replace powf with pow10_int
Use the pow10_int() helper to replace the remaining powf(10, exp)
calls in dlms_meter and kamstrup_kmp components.

Also removes the now-unused <cmath> include from dlms_meter.

On builds where these are the only remaining powf call sites,
this eliminates powf/__ieee754_powf from the binary entirely.
2026-02-19 15:44:05 -06:00
J. Nick KostonandClaude Opus 4.6 a7ffd9f674 [zephyr] Add missing progmem_read_uint16 implementation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 15:40:45 -06:00
J. Nick Koston e95879ba6f Merge remote-tracking branch 'origin/remove-powf-normalize-accuracy' into integration 2026-02-19 15:32:33 -06:00
J. Nick Koston 6a8844e2fc [sensor] Replace powf with pow10_int in sensor filters
Add shared pow10_int() helper to helpers.h that computes 10^exp
using iterative multiplication/division instead of powf.

Replace powf(10, exp) calls in:
- sensor/filter.cpp: ValueListFilter and RoundFilter
- helpers.cpp: normalize_accuracy_decimals (refactored to use
  pow10_int for the general case, keeping -1/-2 fast paths)

Eliminates powf/__ieee754_powf from builds where sensor filters
are the only remaining powf call site.
2026-02-19 15:28:12 -06:00
J. Nick Koston a81e422d33 Merge branch 'dev' into light-gamma-lut 2026-02-19 15:21:41 -06:00
J. Nick Koston 3730fff25d [light] Avoid unnecessary PROGMEM read in gamma_uncorrect_lut
Move the lo >= 255 early return before the first table read so
we don't waste a PROGMEM read that gets immediately discarded.
2026-02-19 15:17:25 -06:00
J. Nick Koston c47e779cbc [light] Avoid unnecessary PROGMEM read in gamma_uncorrect_lut
Move the lo >= 255 early return before the first table read so
we don't waste a PROGMEM read that gets immediately discarded.
2026-02-19 15:17:14 -06:00
J. Nick Koston 4e09370252 Merge remote-tracking branch 'origin/light-gamma-lut' into integration 2026-02-19 15:09:06 -06:00
J. Nick Koston ffb75eed3d Merge branch 'remove-powf-normalize-accuracy' into integration 2026-02-19 15:09:02 -06:00
J. Nick Koston 71c6a54990 [core] Fix deprecation dates for gamma_correct/gamma_uncorrect
Ships in 2026.3.0, so deprecation starts at 2026.3.0 with
6-month removal window at 2026.9.0.
2026-02-19 15:05:06 -06:00
J. Nick Koston 96f52da647 [light] Fix outdated comment on gamma_tables dict
Only the forward table is stored now; reverse gamma is computed
via binary search on the forward table.
2026-02-19 15:04:41 -06:00
J. Nick Koston 08c193d1d8 [light] Fix clang-format in gamma_table_reverse_search
Add braces to if/else in inline binary search function to
satisfy clang-format requirements.
2026-02-19 15:02:36 -06:00