[wifi] Restore blocking setup until connected for RP2040 (#12142)
This commit is contained in:
@@ -1612,6 +1612,20 @@ void WiFiComponent::retry_connect() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef USE_RP2040
|
||||||
|
// RP2040's mDNS library (LEAmDNS) relies on LwipIntf::stateUpCB() to restart
|
||||||
|
// mDNS when the network interface reconnects. However, this callback is disabled
|
||||||
|
// in the arduino-pico framework. As a workaround, we block component setup until
|
||||||
|
// WiFi is connected, ensuring mDNS.begin() is called with an active connection.
|
||||||
|
|
||||||
|
bool WiFiComponent::can_proceed() {
|
||||||
|
if (!this->has_sta() || this->state_ == WIFI_COMPONENT_STATE_DISABLED || this->ap_setup_) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return this->is_connected();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void WiFiComponent::set_reboot_timeout(uint32_t reboot_timeout) { this->reboot_timeout_ = reboot_timeout; }
|
void WiFiComponent::set_reboot_timeout(uint32_t reboot_timeout) { this->reboot_timeout_ = reboot_timeout; }
|
||||||
bool WiFiComponent::is_connected() {
|
bool WiFiComponent::is_connected() {
|
||||||
return this->state_ == WIFI_COMPONENT_STATE_STA_CONNECTED &&
|
return this->state_ == WIFI_COMPONENT_STATE_STA_CONNECTED &&
|
||||||
|
|||||||
@@ -284,6 +284,10 @@ class WiFiComponent : public Component {
|
|||||||
|
|
||||||
void retry_connect();
|
void retry_connect();
|
||||||
|
|
||||||
|
#ifdef USE_RP2040
|
||||||
|
bool can_proceed() override;
|
||||||
|
#endif
|
||||||
|
|
||||||
void set_reboot_timeout(uint32_t reboot_timeout);
|
void set_reboot_timeout(uint32_t reboot_timeout);
|
||||||
|
|
||||||
bool is_connected();
|
bool is_connected();
|
||||||
|
|||||||
Reference in New Issue
Block a user