mirror of
https://github.com/esphome/esphome.git
synced 2026-05-25 18:47:56 +08:00
[core] Remove dead get_loop_priority code (#15242)
This commit is contained in:
@@ -124,12 +124,6 @@ bool CH422GComponent::write_outputs_() {
|
||||
|
||||
float CH422GComponent::get_setup_priority() const { return setup_priority::IO; }
|
||||
|
||||
#ifdef USE_LOOP_PRIORITY
|
||||
// Run our loop() method very early in the loop, so that we cache read values
|
||||
// before other components call our digital_read() method.
|
||||
float CH422GComponent::get_loop_priority() const { return 9.0f; } // Just after WIFI
|
||||
#endif
|
||||
|
||||
void CH422GGPIOPin::pin_mode(gpio::Flags flags) { this->parent_->pin_mode(this->pin_, flags); }
|
||||
bool CH422GGPIOPin::digital_read() { return this->parent_->digital_read(this->pin_) ^ this->inverted_; }
|
||||
|
||||
|
||||
@@ -23,9 +23,6 @@ class CH422GComponent : public Component, public i2c::I2CDevice {
|
||||
void pin_mode(uint8_t pin, gpio::Flags flags);
|
||||
|
||||
float get_setup_priority() const override;
|
||||
#ifdef USE_LOOP_PRIORITY
|
||||
float get_loop_priority() const override;
|
||||
#endif
|
||||
void dump_config() override;
|
||||
|
||||
protected:
|
||||
|
||||
@@ -129,12 +129,6 @@ bool CH423Component::write_outputs_() {
|
||||
|
||||
float CH423Component::get_setup_priority() const { return setup_priority::IO; }
|
||||
|
||||
#ifdef USE_LOOP_PRIORITY
|
||||
// Run our loop() method very early in the loop, so that we cache read values
|
||||
// before other components call our digital_read() method.
|
||||
float CH423Component::get_loop_priority() const { return 9.0f; } // Just after WIFI
|
||||
#endif
|
||||
|
||||
void CH423GPIOPin::pin_mode(gpio::Flags flags) { this->parent_->pin_mode(this->pin_, flags); }
|
||||
bool CH423GPIOPin::digital_read() { return this->parent_->digital_read(this->pin_) ^ this->inverted_; }
|
||||
|
||||
|
||||
@@ -22,9 +22,6 @@ class CH423Component : public Component, public i2c::I2CDevice {
|
||||
void pin_mode(uint8_t pin, gpio::Flags flags);
|
||||
|
||||
float get_setup_priority() const override;
|
||||
#ifdef USE_LOOP_PRIORITY
|
||||
float get_loop_priority() const override;
|
||||
#endif
|
||||
void dump_config() override;
|
||||
|
||||
protected:
|
||||
|
||||
@@ -40,12 +40,6 @@ void DeepSleepComponent::loop() {
|
||||
this->begin_sleep();
|
||||
}
|
||||
|
||||
#ifdef USE_LOOP_PRIORITY
|
||||
float DeepSleepComponent::get_loop_priority() const {
|
||||
return -100.0f; // run after everything else is ready
|
||||
}
|
||||
#endif
|
||||
|
||||
void DeepSleepComponent::set_sleep_duration(uint32_t time_ms) { this->sleep_duration_ = uint64_t(time_ms) * 1000; }
|
||||
|
||||
void DeepSleepComponent::set_run_duration(uint32_t time_ms) { this->run_duration_ = time_ms; }
|
||||
|
||||
@@ -113,9 +113,6 @@ class DeepSleepComponent : public Component {
|
||||
void setup() override;
|
||||
void dump_config() override;
|
||||
void loop() override;
|
||||
#ifdef USE_LOOP_PRIORITY
|
||||
float get_loop_priority() const override;
|
||||
#endif
|
||||
float get_setup_priority() const override;
|
||||
|
||||
/// Helper to enter deep sleep mode
|
||||
|
||||
@@ -122,11 +122,6 @@ bool PCA9554Component::write_register_(uint8_t reg, uint16_t value) {
|
||||
|
||||
float PCA9554Component::get_setup_priority() const { return setup_priority::IO; }
|
||||
|
||||
#ifdef USE_LOOP_PRIORITY
|
||||
// Run our loop() method early to invalidate cache before any other components access the pins
|
||||
float PCA9554Component::get_loop_priority() const { return 9.0f; } // Just after WIFI
|
||||
#endif
|
||||
|
||||
void PCA9554GPIOPin::setup() { pin_mode(flags_); }
|
||||
void PCA9554GPIOPin::pin_mode(gpio::Flags flags) { this->parent_->pin_mode(this->pin_, flags); }
|
||||
bool PCA9554GPIOPin::digital_read() { return this->parent_->digital_read(this->pin_) != this->inverted_; }
|
||||
|
||||
@@ -23,10 +23,6 @@ class PCA9554Component : public Component,
|
||||
|
||||
float get_setup_priority() const override;
|
||||
|
||||
#ifdef USE_LOOP_PRIORITY
|
||||
float get_loop_priority() const override;
|
||||
#endif
|
||||
|
||||
void dump_config() override;
|
||||
|
||||
void set_pin_count(size_t pin_count) { this->pin_count_ = pin_count; }
|
||||
|
||||
@@ -99,11 +99,6 @@ bool PCF8574Component::write_gpio_() {
|
||||
}
|
||||
float PCF8574Component::get_setup_priority() const { return setup_priority::IO; }
|
||||
|
||||
#ifdef USE_LOOP_PRIORITY
|
||||
// Run our loop() method early to invalidate cache before any other components access the pins
|
||||
float PCF8574Component::get_loop_priority() const { return 9.0f; } // Just after WIFI
|
||||
#endif
|
||||
|
||||
void PCF8574GPIOPin::setup() { pin_mode(flags_); }
|
||||
void PCF8574GPIOPin::pin_mode(gpio::Flags flags) { this->parent_->pin_mode(this->pin_, flags); }
|
||||
bool PCF8574GPIOPin::digital_read() { return this->parent_->digital_read(this->pin_) != this->inverted_; }
|
||||
|
||||
@@ -26,9 +26,6 @@ class PCF8574Component : public Component,
|
||||
void pin_mode(uint8_t pin, gpio::Flags flags);
|
||||
|
||||
float get_setup_priority() const override;
|
||||
#ifdef USE_LOOP_PRIORITY
|
||||
float get_loop_priority() const override;
|
||||
#endif
|
||||
|
||||
void dump_config() override;
|
||||
|
||||
|
||||
@@ -30,9 +30,6 @@ class StatusLEDLightOutput : public light::LightOutput, public Component {
|
||||
void dump_config() override;
|
||||
|
||||
float get_setup_priority() const override { return setup_priority::HARDWARE; }
|
||||
#ifdef USE_LOOP_PRIORITY
|
||||
float get_loop_priority() const override { return 50.0f; }
|
||||
#endif
|
||||
|
||||
protected:
|
||||
GPIOPin *pin_{nullptr};
|
||||
|
||||
@@ -28,9 +28,6 @@ void StatusLED::loop() {
|
||||
}
|
||||
}
|
||||
float StatusLED::get_setup_priority() const { return setup_priority::HARDWARE; }
|
||||
#ifdef USE_LOOP_PRIORITY
|
||||
float StatusLED::get_loop_priority() const { return 50.0f; }
|
||||
#endif
|
||||
|
||||
} // namespace status_led
|
||||
} // namespace esphome
|
||||
|
||||
@@ -14,9 +14,6 @@ class StatusLED : public Component {
|
||||
void dump_config() override;
|
||||
void loop() override;
|
||||
float get_setup_priority() const override;
|
||||
#ifdef USE_LOOP_PRIORITY
|
||||
float get_loop_priority() const override;
|
||||
#endif
|
||||
|
||||
protected:
|
||||
GPIOPin *pin_;
|
||||
|
||||
@@ -970,12 +970,6 @@ void WiFiComponent::set_ap(const WiFiAP &ap) {
|
||||
}
|
||||
#endif // USE_WIFI_AP
|
||||
|
||||
#ifdef USE_LOOP_PRIORITY
|
||||
float WiFiComponent::get_loop_priority() const {
|
||||
return 10.0f; // before other loop components
|
||||
}
|
||||
#endif
|
||||
|
||||
void WiFiComponent::init_sta(size_t count) { this->sta_.init(count); }
|
||||
void WiFiComponent::add_sta(const WiFiAP &ap) { this->sta_.push_back(ap); }
|
||||
void WiFiComponent::clear_sta() {
|
||||
|
||||
@@ -463,10 +463,6 @@ class WiFiComponent final : public Component {
|
||||
void restart_adapter();
|
||||
/// WIFI setup_priority.
|
||||
float get_setup_priority() const override;
|
||||
#ifdef USE_LOOP_PRIORITY
|
||||
float get_loop_priority() const override;
|
||||
#endif
|
||||
|
||||
/// Reconnect WiFi if required.
|
||||
void loop() override;
|
||||
|
||||
|
||||
@@ -99,12 +99,6 @@ void Application::setup() {
|
||||
if (component->can_proceed())
|
||||
continue;
|
||||
|
||||
#ifdef USE_LOOP_PRIORITY
|
||||
// Sort components 0 through i by loop priority
|
||||
insertion_sort_by_priority<decltype(this->components_.begin()), &Component::get_loop_priority>(
|
||||
this->components_.begin(), this->components_.begin() + i + 1);
|
||||
#endif
|
||||
|
||||
do {
|
||||
uint8_t new_app_state = STATUS_LED_WARNING;
|
||||
uint32_t now = millis();
|
||||
|
||||
@@ -85,10 +85,6 @@ void store_component_error_message(const Component *component, const char *messa
|
||||
static constexpr uint16_t WARN_IF_BLOCKING_INCREMENT_MS =
|
||||
10U; ///< How long the blocking time must be larger to warn again
|
||||
|
||||
#ifdef USE_LOOP_PRIORITY
|
||||
float Component::get_loop_priority() const { return 0.0f; }
|
||||
#endif
|
||||
|
||||
float Component::get_setup_priority() const { return setup_priority::DATA; }
|
||||
|
||||
void Component::setup() {}
|
||||
|
||||
@@ -115,16 +115,6 @@ class Component {
|
||||
|
||||
void set_setup_priority(float priority);
|
||||
|
||||
/** priority of loop(). higher -> executed earlier
|
||||
*
|
||||
* Defaults to 0.
|
||||
*
|
||||
* @return The loop priority of this component
|
||||
*/
|
||||
#ifdef USE_LOOP_PRIORITY
|
||||
virtual float get_loop_priority() const;
|
||||
#endif
|
||||
|
||||
void call();
|
||||
|
||||
virtual void on_shutdown() {}
|
||||
|
||||
@@ -357,7 +357,6 @@
|
||||
|
||||
#ifdef USE_RP2040
|
||||
#define USE_ARDUINO_VERSION_CODE VERSION_CODE(3, 3, 0)
|
||||
#define USE_LOOP_PRIORITY
|
||||
#define USE_RP2040_CRASH_HANDLER
|
||||
#define USE_HTTP_REQUEST_RESPONSE
|
||||
#define USE_I2C
|
||||
|
||||
Reference in New Issue
Block a user