mirror of
https://github.com/esphome/esphome.git
synced 2026-09-30 08:20:21 +00:00
[core] Inline trivial Component state accessors (#14425)
This commit is contained in:
@@ -233,7 +233,6 @@ void Component::call_dump_config_() {
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t Component::get_component_state() const { return this->component_state_; }
|
||||
void Component::call() {
|
||||
uint8_t state = this->component_state_ & COMPONENT_STATE_MASK;
|
||||
switch (state) {
|
||||
@@ -339,9 +338,6 @@ void Component::reset_to_construction_state() {
|
||||
this->status_clear_error();
|
||||
}
|
||||
}
|
||||
bool Component::is_in_loop_state() const {
|
||||
return (this->component_state_ & COMPONENT_STATE_MASK) == COMPONENT_STATE_LOOP;
|
||||
}
|
||||
void Component::defer(std::function<void()> &&f) { // NOLINT
|
||||
App.scheduler.set_timeout(this, static_cast<const char *>(nullptr), 0, std::move(f));
|
||||
}
|
||||
@@ -380,16 +376,12 @@ void Component::set_retry(uint32_t initial_wait_time, uint8_t max_attempts, std:
|
||||
App.scheduler.set_retry(this, "", initial_wait_time, max_attempts, std::move(f), backoff_increase_factor);
|
||||
#pragma GCC diagnostic pop
|
||||
}
|
||||
bool Component::is_failed() const { return (this->component_state_ & COMPONENT_STATE_MASK) == COMPONENT_STATE_FAILED; }
|
||||
bool Component::is_ready() const {
|
||||
return (this->component_state_ & COMPONENT_STATE_MASK) == COMPONENT_STATE_LOOP ||
|
||||
(this->component_state_ & COMPONENT_STATE_MASK) == COMPONENT_STATE_LOOP_DONE ||
|
||||
(this->component_state_ & COMPONENT_STATE_MASK) == COMPONENT_STATE_SETUP;
|
||||
}
|
||||
bool Component::is_idle() const { return (this->component_state_ & COMPONENT_STATE_MASK) == 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; }
|
||||
bool Component::set_status_flag_(uint8_t flag) {
|
||||
if ((this->component_state_ & flag) != 0)
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user