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.
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.
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.
- 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
- 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
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.
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>
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>
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).
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.
Replace std::unique_ptr<Socket> with raw Socket* for listen sockets
that are created once in setup() and live for the program lifetime.
The unique_ptr move-assign generates dead code to destroy the previous
value (which is always nullptr in setup), including a virtual destructor
call through the vtable that the compiler cannot eliminate because
__uniq_ptr_impl::reset is not inlined.
Changes:
- Use .release() to extract raw pointer from socket factory return
- Add socket_failed_/server_failed_ helpers that combine error logging,
cleanup, and mark_failed into a single call
- Convert error messages to LOG_STR for flash storage on ESP8266
- Socket destructor already calls close(), so explicit close() before
delete is unnecessary
Saves 20 bytes on ESP32-IDF, 180 bytes on ESP8266.
Resolve conflict in defines.h - keep both new NRF52 defines
(USE_LOGGER_EARLY_MESSAGE, USE_LOGGER_WAIT_FOR_CDC from dev) and
existing defines (USE_LOGGER_UART_SELECTION_USB_CDC, USE_LOGGER_USB_CDC
from this branch).
Remove unnecessary template parameters from mark_matching_items_removed_locked_
since all callers use the same concrete type (std::vector<std::unique_ptr<SchedulerItem>>).
Eliminate has_cancelled_timeout_in_container_locked_ entirely by inlining its
logic into the only caller (is_retry_cancelled_locked_), which is deprecated
and will be removed in 2026.8.0.
Saves 32 bytes of flash.
Reduce CPU usage when USB components are idle by disabling the
component loop when there are no events or data to process. The
loop is re-enabled from USB task callbacks via
enable_loop_soon_any_context() when new events or data arrive.
- Extract process_usb_events_() from USBClient::loop() returning
bool so subclasses can combine with their own work checks for a
single disable_loop() decision
- Add enable_loop_soon_any_context() calls in client_event_cb and
USB data input callback
- Start with loop disabled in setup(), enabled by first event
- Reorder USBClient members by thread-safety context
- Reorder TransferStatus fields for optimal struct packing
- Fix missing early return after mark_failed() in setup()
Reduce CPU usage when USB components are idle by disabling the
component loop when there are no events or data to process. The
loop is re-enabled from USB task callbacks via
enable_loop_soon_any_context() when new events or data arrive.
- Extract process_usb_events_() from USBClient::loop() returning
bool so subclasses can combine with their own work checks for a
single disable_loop() decision
- Add enable_loop_soon_any_context() calls in client_event_cb and
USB data input callback
- Start with loop disabled in setup(), enabled by first event
- Reorder USBClient members by thread-safety context
- Reorder TransferStatus fields for optimal struct packing
- Fix missing early return after mark_failed() in setup()