mirror of
https://github.com/esphome/esphome.git
synced 2026-09-23 21:14:03 +00:00
partition
This commit is contained in:
@@ -136,17 +136,21 @@ void Component::mark_failed() {
|
||||
this->component_state_ &= ~COMPONENT_STATE_MASK;
|
||||
this->component_state_ |= COMPONENT_STATE_FAILED;
|
||||
this->status_set_error();
|
||||
// Also remove from loop since failed components shouldn't loop
|
||||
App.disable_component_loop(this);
|
||||
}
|
||||
void Component::disable_loop() {
|
||||
ESP_LOGD(TAG, "%s loop disabled", this->get_component_source());
|
||||
this->component_state_ &= ~COMPONENT_STATE_MASK;
|
||||
this->component_state_ |= COMPONENT_STATE_LOOP_DONE;
|
||||
App.disable_component_loop(this);
|
||||
}
|
||||
void Component::enable_loop() {
|
||||
if ((this->component_state_ & COMPONENT_STATE_MASK) == COMPONENT_STATE_LOOP_DONE) {
|
||||
ESP_LOGD(TAG, "%s loop enabled", this->get_component_source());
|
||||
this->component_state_ &= ~COMPONENT_STATE_MASK;
|
||||
this->component_state_ |= COMPONENT_STATE_LOOP;
|
||||
App.enable_component_loop(this);
|
||||
}
|
||||
}
|
||||
void Component::reset_to_construction_state() {
|
||||
@@ -185,10 +189,6 @@ bool Component::is_ready() const {
|
||||
return (this->component_state_ & COMPONENT_STATE_MASK) == COMPONENT_STATE_LOOP ||
|
||||
(this->component_state_ & COMPONENT_STATE_MASK) == COMPONENT_STATE_SETUP;
|
||||
}
|
||||
bool Component::should_skip_loop() const {
|
||||
uint8_t state = this->component_state_ & COMPONENT_STATE_MASK;
|
||||
return state == COMPONENT_STATE_FAILED || state == COMPONENT_STATE_LOOP_DONE;
|
||||
}
|
||||
bool Component::can_proceed() { return true; }
|
||||
bool Component::status_has_warning() const { return this->component_state_ & STATUS_LED_WARNING; }
|
||||
bool Component::status_has_error() const { return this->component_state_ & STATUS_LED_ERROR; }
|
||||
|
||||
Reference in New Issue
Block a user