mirror of
https://github.com/esphome/esphome.git
synced 2025-09-17 02:32:20 +01:00
more
This commit is contained in:
@@ -280,26 +280,24 @@ bool Component::can_proceed() { return true; }
|
|||||||
bool Component::status_has_warning() const { return this->component_state_ & STATUS_LED_WARNING; }
|
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::status_has_error() const { return this->component_state_ & STATUS_LED_ERROR; }
|
||||||
|
|
||||||
void Component::status_set_warning_flag_() {
|
void Component::status_set_warning(const char *message) {
|
||||||
// Don't spam the log. This risks missing different warning messages though.
|
// Don't spam the log. This risks missing different warning messages though.
|
||||||
if ((this->component_state_ & STATUS_LED_WARNING) != 0)
|
if ((this->component_state_ & STATUS_LED_WARNING) != 0)
|
||||||
return;
|
return;
|
||||||
this->component_state_ |= STATUS_LED_WARNING;
|
this->component_state_ |= STATUS_LED_WARNING;
|
||||||
App.app_state_ |= STATUS_LED_WARNING;
|
App.app_state_ |= STATUS_LED_WARNING;
|
||||||
}
|
ESP_LOGW(TAG, "%s set Warning flag: %s", this->get_component_source(),
|
||||||
|
message ? message : LOG_STR_LITERAL("unspecified"));
|
||||||
void Component::status_set_warning(const char *message) {
|
|
||||||
this->status_set_warning_flag_();
|
|
||||||
if ((this->component_state_ & STATUS_LED_WARNING) != 0)
|
|
||||||
ESP_LOGW(TAG, "%s set Warning flag: %s", this->get_component_source(),
|
|
||||||
message ? message : LOG_STR_LITERAL("unspecified"));
|
|
||||||
}
|
}
|
||||||
#ifdef USE_STORE_LOG_STR_IN_FLASH
|
#ifdef USE_STORE_LOG_STR_IN_FLASH
|
||||||
void Component::status_set_warning(const LogString *message) {
|
void Component::status_set_warning(const LogString *message) {
|
||||||
this->status_set_warning_flag_();
|
// Don't spam the log. This risks missing different warning messages though.
|
||||||
if ((this->component_state_ & STATUS_LED_WARNING) != 0)
|
if ((this->component_state_ & STATUS_LED_WARNING) != 0)
|
||||||
ESP_LOGW(TAG, "%s set Warning flag: %s", this->get_component_source(),
|
return;
|
||||||
message ? LOG_STR_ARG(message) : LOG_STR_LITERAL("unspecified"));
|
this->component_state_ |= STATUS_LED_WARNING;
|
||||||
|
App.app_state_ |= STATUS_LED_WARNING;
|
||||||
|
ESP_LOGW(TAG, "%s set Warning flag: %s", this->get_component_source(),
|
||||||
|
message ? LOG_STR_ARG(message) : LOG_STR_LITERAL("unspecified"));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
void Component::status_set_error(const char *message) {
|
void Component::status_set_error(const char *message) {
|
||||||
|
@@ -245,9 +245,6 @@ class Component {
|
|||||||
/// Helper to set component state (clears state bits and sets new state)
|
/// Helper to set component state (clears state bits and sets new state)
|
||||||
void set_component_state_(uint8_t state);
|
void set_component_state_(uint8_t state);
|
||||||
|
|
||||||
/// Helper to set warning flag without duplicating logic
|
|
||||||
void status_set_warning_flag_();
|
|
||||||
|
|
||||||
/** Set an interval function with a unique name. Empty name means no cancelling possible.
|
/** Set an interval function with a unique name. Empty name means no cancelling possible.
|
||||||
*
|
*
|
||||||
* This will call f every interval ms. Can be cancelled via CancelInterval().
|
* This will call f every interval ms. Can be cancelled via CancelInterval().
|
||||||
|
Reference in New Issue
Block a user