1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-02 19:32:19 +01:00

esp32_improv add timeout (#5556)

This commit is contained in:
Jesse Hills
2023-10-19 11:42:52 +13:00
committed by GitHub
parent 10c89771e3
commit a8667b680e
3 changed files with 17 additions and 7 deletions

View File

@@ -8,16 +8,16 @@
#include <user_interface.h>
#endif
#include <utility>
#include <algorithm>
#include "lwip/err.h"
#include <utility>
#include "lwip/dns.h"
#include "lwip/err.h"
#include "esphome/core/application.h"
#include "esphome/core/hal.h"
#include "esphome/core/helpers.h"
#include "esphome/core/log.h"
#include "esphome/core/hal.h"
#include "esphome/core/util.h"
#include "esphome/core/application.h"
#ifdef USE_CAPTIVE_PORTAL
#include "esphome/components/captive_portal/captive_portal.h"
@@ -96,7 +96,7 @@ void WiFiComponent::start() {
#endif
}
#ifdef USE_IMPROV
if (esp32_improv::global_improv_component != nullptr) {
if (!this->has_sta() && esp32_improv::global_improv_component != nullptr) {
if (this->wifi_mode_(true, {}))
esp32_improv::global_improv_component->start();
}
@@ -163,8 +163,8 @@ void WiFiComponent::loop() {
}
#ifdef USE_IMPROV
if (esp32_improv::global_improv_component != nullptr) {
if (!this->is_connected()) {
if (esp32_improv::global_improv_component != nullptr && !esp32_improv::global_improv_component->is_active()) {
if (now - this->last_connected_ > esp32_improv::global_improv_component->get_wifi_timeout()) {
if (this->wifi_mode_(true, {}))
esp32_improv::global_improv_component->start();
}