mirror of
https://github.com/esphome/esphome.git
synced 2026-09-15 17:18:40 +00:00
Inline is_connected_ and update_connected_state_ into header
Move these small methods to the header so the compiler can inline them into loop(), eliminating two function call/return pairs from every loop iteration on all platforms.
This commit is contained in:
@@ -2130,11 +2130,6 @@ void WiFiComponent::retry_connect() {
|
||||
}
|
||||
|
||||
void WiFiComponent::set_reboot_timeout(uint32_t reboot_timeout) { this->reboot_timeout_ = reboot_timeout; }
|
||||
bool WiFiComponent::is_connected_() const {
|
||||
return this->state_ == WIFI_COMPONENT_STATE_STA_CONNECTED &&
|
||||
this->wifi_sta_connect_status_() == WiFiSTAConnectStatus::CONNECTED && !this->error_from_callback_;
|
||||
}
|
||||
void WiFiComponent::update_connected_state_() { this->connected_ = this->is_connected_(); }
|
||||
void WiFiComponent::set_power_save_mode(WiFiPowerSaveMode power_save) {
|
||||
this->power_save_ = power_save;
|
||||
#if defined(USE_ESP32) && defined(USE_WIFI_RUNTIME_POWER_SAVE)
|
||||
|
||||
@@ -681,8 +681,11 @@ class WiFiComponent final : public Component {
|
||||
bool wifi_sta_connect_(const WiFiAP &ap);
|
||||
void wifi_pre_setup_();
|
||||
WiFiSTAConnectStatus wifi_sta_connect_status_() const;
|
||||
bool is_connected_() const;
|
||||
void update_connected_state_();
|
||||
bool is_connected_() const {
|
||||
return this->state_ == WIFI_COMPONENT_STATE_STA_CONNECTED &&
|
||||
this->wifi_sta_connect_status_() == WiFiSTAConnectStatus::CONNECTED && !this->error_from_callback_;
|
||||
}
|
||||
void update_connected_state_() { this->connected_ = this->is_connected_(); }
|
||||
bool wifi_scan_start_(bool passive);
|
||||
|
||||
#ifdef USE_WIFI_AP
|
||||
|
||||
Reference in New Issue
Block a user