Replace std::bind(&MultiClickTrigger::on_state_, this, _1) with a
[this] lambda for the add_on_state_callback registration. The [this]
lambda fits within the Callback inline storage threshold
(sizeof(void*)), avoiding a permanent heap allocation.
FixedVector requires init() before push_back(). Update all test cases
to call set_sensor_count()/set_binary_sensor_count() before adding
sensors, matching what the Python codegen does.
The lambdas are defined inside PacketTransport::setup() so they
inherit member-function access rights. The friend declarations
are not needed for accessing protected members through parent pointer.
The sensor and binary sensor counts are known at config time, so
pre-allocate with FixedVector::init() instead of using std::vector
which pulls in _M_realloc_insert template instantiation code.
The source count is known at config time, so pre-allocate with
FixedVector::init() instead of using std::vector which pulls in
_M_realloc_insert template instantiation code.
Replace std::pair<Sensor*, std::function> with a SensorSource struct
that includes a back-pointer to the parent component. This allows
KalmanCombinationComponent::setup() to capture only [&source] (one
pointer) instead of [this, stddev] (this + a full std::function copy),
enabling inline Callback storage and avoiding a heap allocation per
sensor callback registration.
Add a back-pointer to PacketTransport in the Sensor and BinarySensor
structs so the state callback lambdas can capture only [&sensor] (one
pointer) instead of [this, &sensor] (two pointers). This brings the
capture size within the Callback inline threshold (sizeof(void*)),
avoiding a heap allocation per callback registration.
- Remove dead ENC28J60 entry from _IDF6_ETHERNET_COMPONENTS
- Simplify get_duplex_mode() — both chips are full-duplex on RP2040
- Add #error guard for unsupported RP2040 SPI Ethernet type
- Remove dead ENC28J60 entry from _IDF6_ETHERNET_COMPONENTS
- Simplify get_duplex_mode() — both chips are full-duplex on RP2040
- Add #error guard for unsupported RP2040 SPI Ethernet type
Move calculate_looping_components_() from application.cpp to
application.h as an inline method. This function has only one
caller (setup()) and is small enough for the compiler to inline,
saving ~20 bytes of flash by eliminating the function call overhead.
The write_interval == 0 case (sync every loop) is only used on host
or for testing. For the vast majority of real devices using the default
60s interval, loop() and the runtime branch are unnecessary overhead.
Use a compile-time define to separate the two modes so that:
- Normal case: no loop() override, no write_interval_ member, just set_interval
- Zero interval case: loop() syncs every iteration, no interval needed
Move get_use_address()/set_use_address() definitions to headers for
wifi, ethernet, and openthread components so the compiler can inline
them. Also inline network::get_use_address() in the header, matching
the existing pattern used by network::is_connected().
This allows the compiler to collapse the two-level indirection
(network::get_use_address -> component->get_use_address -> field load)
into a single pointer dereference at each call site.
Saves 24 bytes of flash on ESP32-S3.