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>
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>
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>
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>
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>
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.
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.
Replace runtime powf() calls in light gamma correction with
pre-computed uint16[256] PROGMEM lookup tables generated at
Python codegen time. The gamma value is a compile-time constant,
so the tables can be computed once and shared across all lights
with the same gamma value.
This eliminates powf/ieee754_powf (~2.3KB) from the binary.
Two 512-byte PROGMEM tables (forward + reverse) are shared per
unique gamma value, for a net savings of ~1.3KB flash and zero
RAM impact.
The LUT uses linear interpolation between table entries,
achieving zero PWM errors at both 8-bit and 16-bit resolution
compared to the old powf-based approach.
Breaking change: gamma parameter removed from
LightColorValues::as_*() methods since gamma correction is now
applied externally via LightState::gamma_correct_lut().
gamma_correct() and gamma_uncorrect() in helpers.h are
deprecated (removal in 2026.12.0).
Replace powf(10.0f, accuracy_decimals) with integer divisor computation
to avoid pulling in __ieee754_powf (~2.2KB) on builds where this is
the only powf call site.
Tested on ESP8266 with web_server: -3.1KB flash, -16 bytes RAM.