Commit Graph
23507 Commits
Author SHA1 Message Date
J. Nick KostonandClaude Opus 4.6 38984b61c9 [wifi] Track lwIP-internal DHCP+DNS UDP PCBs via socket consumer API
Register the 2 UDP PCBs that lwIP allocates internally for DHCP and DNS
as a wifi.lwip_internal socket consumer, eliminating the magic +2 in
libretiny's MEMP_NUM_UDP_PCB calculation. Also corrects SDK default
values in the comparison table after line-by-line verification against
all three SDK source files.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 13:33:50 -06:00
J. Nick KostonandClaude Opus 4.6 4114620aee [libretiny] Fix RTL87xx BD_RAM overflow — use per-SDK lwIP defaults
The original table treated BK/RTL/LN SDK defaults as identical, but
they differ significantly:

- BK72XX: MEM_SIZE=32KB, TCP_SND_BUF=10×MSS — wildly oversized
- RTL87XX: MEM_SIZE=5KB, TCP_SND_BUF=5×MSS — already conservative
- LN882H: MEM_LIBC_MALLOC=1, TCP_SND_BUF=7×MSS — uses system heap

Setting MEM_SIZE=16KB on RTL87XX was an 11KB *increase* from its 5KB
SDK default, causing BD_RAM overflow on the mqtt test.

Fix: only set MEM_SIZE on BK72XX (where the 32KB→12KB reduction is
needed). RTL87XX keeps its SDK 5KB default, LN882H doesn't use it.
The comparison table is updated with accurate per-SDK columns.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 13:23:42 -06:00
tomaszduda23 48ba007c22 [nrf52] print line number after crash in logs (#14165) 2026-02-21 14:16:20 -05:00
J. Nick Koston 482721d1ce [libretiny] Tune oversized lwIP defaults for ESPHome
The Beken/RTL SDKs ship lwIP defaults tuned for a general-purpose WiFi
SoC: TCP_SND_BUF=10*MSS (14.6KB), MEM_SIZE=32KB, 12 TCP + 22 UDP
sockets. These waste significant RAM on memory-constrained chips.
ESPAsyncWebServer allocates malloc(tcp_sndbuf()) per response chunk,
and at 14.6KB this causes OOM on BK7231N.

This tunes lwIP to match ESP32/ESP8266 ranges:
- TCP_SND_BUF/TCP_WND: 4*MSS (was 10*MSS)
- MEM_SIZE: 12KB BK72XX / 16KB RTL,LN (was 32KB)
- Socket counts: dynamic from component registrations
- All derived pool sizes adjusted accordingly

Also splits socket consumer tracking into TCP/UDP, adds
get_socket_counts() API, and updates ESP32 to use it.

Closes https://github.com/esphome/esphome/issues/14095
2026-02-21 11:50:29 -06:00
J. Nick Koston 9f17994082 Merge branch 'dev' into api-stringref-user-services 2026-02-21 11:18:04 -06:00
Clyde Stubbs 6ff17fbf7c [epaper_spi] Fix color mapping for weact (#14134) 2026-02-22 04:17:54 +11:00
J. Nick Koston 416b97311b [mqtt] Remove broken ESP8266 ssl_fingerprints option (#14182) 2026-02-21 11:12:35 -06:00
J. Nick Koston 7fb09da7cf [dsmr] Add deprecated std::string overload for set_decryption_key (#14180) 2026-02-21 11:08:13 -06:00
Jonathan Swoboda 4aba6ce127 Merge branch 'dev' into esp32_touch_new_driver 2026-02-21 08:51:51 -05:00
Sxt FovandJonathan Swoboda 6ecb01dedc [cc1101] actions to change general and tuner settings (#14141)
Co-authored-by: Jonathan Swoboda <154711427+swoboda1337@users.noreply.github.com>
2026-02-21 08:45:15 -05:00
Clyde Stubbs 518f08b909 [mipi_dsi] Disallow swap_xy (#14124) 2026-02-21 19:51:13 +11:00
J. Nick Koston d01d2189b9 Guard device_class/UoM fields and lookups with #ifdef like icon 2026-02-21 01:22:18 -06:00
J. Nick Koston 1d547642e3 Use uint8_t for lookup indices and escape strings in codegen
- Change lookup function signatures from uint16_t to uint8_t since
  indices are stored in uint8_t fields (max 255 per category)
- Use cpp_string_escape() for string table entries to prevent
  compilation errors from special characters in user-provided strings
2026-02-21 01:11:06 -06:00
J. Nick Koston 95ee73e07f Store entity string indices as 3 uint8_t fields in struct padding
Replace uint32_t entity_string_packed_ with 3 separate uint8_t
fields (device_class_idx_, uom_idx_, icon_idx_) placed after the
1-byte EntityFlags struct. These fill the 3 padding bytes that
the compiler would insert anyway for alignment, saving 4 bytes
per entity with zero layout overhead.

The set_entity_strings(uint32_t) API is preserved — it unpacks
into the individual fields.
2026-02-21 00:28:16 -06:00
J. Nick Koston 2e93a7db78 Narrow packed fields to 8 bits each, reserve 8 bits for future use
8 bits per field (max 255) is more than sufficient — even large
configs use fewer than 40 unique icons, 14 device classes, and
11 units of measurement. This frees up 8 bits in the packed
uint32_t for future use.
2026-02-21 00:18:44 -06:00
J. Nick Koston 9adb2dd3f1 Merge remote-tracking branch 'upstream/dev' into integration 2026-02-20 23:45:45 -06:00
J. Nick Koston 6c92e284c7 tweaks 2026-02-20 23:35:40 -06:00
J. Nick Koston 2906f56b3f tweaks 2026-02-20 23:32:28 -06:00
J. Nick Koston 7a9a0f9e75 Remove deprecated offsetof hack from NumberTraits
NumberTraits no longer needs get_device_class_ref() or
get_unit_of_measurement_ref() — no internal callers exist.
Callers should use number->get_device_class_ref() directly.
Eliminates offsetof warning on non-standard-layout type.
2026-02-20 23:21:53 -06:00
J. Nick Koston 6100d1c1d7 Remove leading null from blobs and EMPTY_REF from getters
- Blobs now start directly with first string (no wasted \0 prefix)
- Lookup functions handle index 0 by pointing to trailing null of blob
- get_*_ref() simplified: just calls lookup, no separate empty check
- Removes EMPTY_REF constant and per-getter branch
2026-02-20 23:09:30 -06:00
J. Nick Koston 22e9c30af1 Merge branch 'dev' into pack-entity-strings 2026-02-20 22:49:52 -06:00
J. Nick Koston 70fb8cc7c4 Remove empty EntityBase_DeviceClass/EntityBase_UnitOfMeasurement shells
These empty classes were only used internally by entity base classes,
not exposed to external components. No need for backward compat shells.
2026-02-20 22:48:46 -06:00
J. Nick Koston f1578351aa empty 2026-02-20 22:46:59 -06:00
J. Nick Koston e0f67da7b6 Use named constants and coroutine_with_priority for table generation
- Replace DeferredStatement with FINAL-priority coroutine job
- Add named constants for bit shifts and max values
- Use _DC_SHIFT in packed calculation for consistency
- Restore Args docstring on _setup_entity_impl
2026-02-20 22:38:25 -06:00
J. Nick Koston 4eac632939 pack_entity_strings 2026-02-20 22:36:15 -06:00
Rodrigo Martín 2eac106f11 [mqtt] add missing precision in HA autodiscovery (#14010) 2026-02-20 23:20:27 -05:00
J. Nick Koston 681bdf16aa Merge remote-tracking branch 'upstream/dev' into integration 2026-02-20 21:40:33 -06:00
J. Nick Koston f77da803c9 [api] Write protobuf encode output to pre-sized buffer directly (#14018) 2026-02-20 21:39:18 -06:00
J. Nick Koston f8f98bf428 [logger] Reduce UART driver heap waste on ESP32 (#14168) 2026-02-21 03:16:49 +00:00
J. Nick Koston abe37c9841 [uptime] Use scheduler millis_64() for rollover-safe uptime tracking (#14170) 2026-02-21 03:08:49 +00:00
J. Nick Koston 8589f80d8f [api,ota,captive_portal] Fix fd leaks and clean up socket_ip_loop_monitored setup paths (#14167) 2026-02-20 20:59:49 -06:00
J. Nick Koston f3b1ae6ba5 Merge branch 'setup_heap_stats' into integration 2026-02-20 20:51:54 -06:00
J. Nick Koston 487d311dbc tweak 2026-02-20 20:51:36 -06:00
J. Nick Koston dd7ef3d982 Merge branch 'fix_logger_uart_event_queue' into integration 2026-02-20 20:32:08 -06:00
J. Nick Koston ee8db03d84 Reduce logger UART RX buffer to minimum 129
The logger only writes to UART, never reads. Previously it used
tx_buffer_size (512 bytes) for both RX and TX buffers. Since ESP-IDF
requires rx_buffer_size > UART_HW_FIFO_LEN (128), use the minimum
of 129 bytes instead of 512, saving ~383 bytes of heap.
2026-02-20 20:31:48 -06:00
J. Nick Koston 730effe2a5 Merge branch 'fix_logger_uart_event_queue' into integration 2026-02-20 20:31:19 -06:00
J. Nick KostonandClaude Opus 4.6 da5f67af69 Reduce logger UART RX buffer to minimum
The logger only writes to UART, never reads. Previously it used
tx_buffer_size (512 bytes) for both RX and TX buffers. Since ESP-IDF
requires rx_buffer_size > UART_HW_FIFO_LEN (128), use the minimum
of 129 bytes instead of 512, saving ~383 bytes of heap.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 20:30:29 -06:00
J. Nick Koston addd80684b Merge remote-tracking branch 'upstream/uptime_use_millis_64' into integration 2026-02-20 20:22:35 -06:00
J. Nick KostonandJ. Nick Koston 7a58a3ef56 [uptime] Use scheduler millis_64() for rollover-safe uptime tracking
Expose the scheduler's existing 64-bit millisecond tracking as a public
API and use it in the uptime sensors, replacing their manual rollover
handling.

Co-Authored-By: J. Nick Koston <nick@koston.org>
2026-02-20 20:19:49 -06:00
J. Nick Koston 75ab691776 Merge branch 'fix_logger_uart_event_queue' into integration 2026-02-20 19:50:36 -06:00
J. Nick Koston 5de56714c0 Merge branch 'setup_heap_stats' into integration 2026-02-20 19:31:55 -06:00
J. Nick Koston c6c01f85af [setup_heap_stats] Add component to track per-component heap allocation during boot
Tracks heap usage per component during both construction and setup() phases.
Logs deltas inline as components are registered and set up, then prints a
sorted summary after setup() completes. Storage is freed after the summary.

This is a diagnostic tool - not intended for production use. It was used to
discover the logger's unused UART event queue allocation (#14168).
2026-02-20 19:29:41 -06:00
J. Nick Koston 0e38acd67a [api] Warn when clients connect with outdated API version (#14145) 2026-02-20 19:21:56 -06:00
J. Nick Koston a3f279c1cf [usb_host] Implement disable_loop/enable_loop pattern for USB components (#14163) 2026-02-20 19:21:14 -06:00
J. Nick KostonandClaude Opus 4.6 35037d1a5b [core] Deduplicate base64 encode/decode logic (#14143)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 19:20:58 -06:00
J. Nick Koston d206c75b0b [logger] Fix loop disable optimization using wrong preprocessor guard (#14158) 2026-02-20 19:20:44 -06:00
J. Nick Koston 0fa7ba6837 [logger] Remove unused UART event queue allocation
The logger's uart_driver_install() was allocating a 10-item FreeRTOS
event queue but passing nullptr as the queue handle, meaning nothing
could ever read from it. Setting the queue size to 0 saves ~212 bytes
of heap.
2026-02-20 19:18:38 -06:00
J. Nick Koston 3855701f60 Merge branch 'loop_monitored_socket_cleanups' into integration 2026-02-20 18:21:18 -06:00
J. Nick Koston 5ea4b5b74b Improve comments explaining why explicit close() is unnecessary before delete 2026-02-20 18:20:56 -06:00
J. Nick Koston 4dd2b532c9 Merge branch 'loop_monitored_socket_cleanups' into integration 2026-02-20 18:18:12 -06:00