1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-16 10:12:21 +01:00

Reduce component_iterator memory usage

This commit is contained in:
J. Nick Koston
2025-06-25 19:35:40 +02:00
parent a35e476be5
commit 9074ef792f
2 changed files with 3 additions and 3 deletions

View File

@@ -375,7 +375,7 @@ void ComponentIterator::advance() {
} }
if (advance_platform) { if (advance_platform) {
this->state_ = static_cast<IteratorState>(static_cast<uint32_t>(this->state_) + 1); this->state_ = static_cast<IteratorState>(static_cast<uint16_t>(this->state_) + 1);
this->at_ = 0; this->at_ = 0;
} else if (success) { } else if (success) {
this->at_++; this->at_++;

View File

@@ -93,7 +93,7 @@ class ComponentIterator {
virtual bool on_end(); virtual bool on_end();
protected: protected:
enum class IteratorState { enum class IteratorState : uint8_t {
NONE = 0, NONE = 0,
BEGIN, BEGIN,
#ifdef USE_BINARY_SENSOR #ifdef USE_BINARY_SENSOR
@@ -167,7 +167,7 @@ class ComponentIterator {
#endif #endif
MAX, MAX,
} state_{IteratorState::NONE}; } state_{IteratorState::NONE};
size_t at_{0}; uint16_t at_{0};
bool include_internal_{false}; bool include_internal_{false};
}; };