[improv_serial] Add missing USE_IMPROV_SERIAL define to fix WiFi scan filtering (#14359)

This commit is contained in:
J. Nick Koston
2026-03-01 10:23:10 -10:00
committed by Jesse Hills
parent c9c99a22e0
commit 0ac61cbb9b
8 changed files with 15 additions and 8 deletions

View File

@@ -43,3 +43,4 @@ async def to_code(config):
var = cg.new_Pvariable(config[CONF_ID])
await cg.register_component(var, config)
await improv_base.setup_improv_core(var, config, "improv_serial")
cg.add_define("USE_IMPROV_SERIAL")

View File

@@ -2048,7 +2048,7 @@ bool WiFiComponent::can_proceed() {
#endif
void WiFiComponent::set_reboot_timeout(uint32_t reboot_timeout) { this->reboot_timeout_ = reboot_timeout; }
bool WiFiComponent::is_connected() {
bool WiFiComponent::is_connected() const {
return this->state_ == WIFI_COMPONENT_STATE_STA_CONNECTED &&
this->wifi_sta_connect_status_() == WiFiSTAConnectStatus::CONNECTED && !this->error_from_callback_;
}

View File

@@ -430,7 +430,7 @@ class WiFiComponent : public Component {
void set_reboot_timeout(uint32_t reboot_timeout);
bool is_connected();
bool is_connected() const;
void set_power_save_mode(WiFiPowerSaveMode power_save);
void set_min_auth_mode(WifiMinAuthMode min_auth_mode) { min_auth_mode_ = min_auth_mode; }
@@ -665,7 +665,7 @@ class WiFiComponent : public Component {
bool wifi_apply_hostname_();
bool wifi_sta_connect_(const WiFiAP &ap);
void wifi_pre_setup_();
WiFiSTAConnectStatus wifi_sta_connect_status_();
WiFiSTAConnectStatus wifi_sta_connect_status_() const;
bool wifi_scan_start_(bool passive);
#ifdef USE_WIFI_AP

View File

@@ -626,7 +626,7 @@ void WiFiComponent::wifi_pre_setup_() {
this->wifi_mode_(false, false);
}
WiFiSTAConnectStatus WiFiComponent::wifi_sta_connect_status_() {
WiFiSTAConnectStatus WiFiComponent::wifi_sta_connect_status_() const {
station_status_t status = wifi_station_get_connect_status();
if (status == STATION_GOT_IP)
return WiFiSTAConnectStatus::CONNECTED;

View File

@@ -914,7 +914,7 @@ void WiFiComponent::wifi_process_event_(IDFWiFiEvent *data) {
}
}
WiFiSTAConnectStatus WiFiComponent::wifi_sta_connect_status_() {
WiFiSTAConnectStatus WiFiComponent::wifi_sta_connect_status_() const {
if (s_sta_connected && this->got_ipv4_address_) {
#if USE_NETWORK_IPV6 && (USE_NETWORK_MIN_IPV6_ADDR_COUNT > 0)
if (this->num_ipv6_addresses_ >= USE_NETWORK_MIN_IPV6_ADDR_COUNT) {

View File

@@ -621,7 +621,7 @@ void WiFiComponent::wifi_pre_setup_() {
// Make sure WiFi is in clean state before anything starts
this->wifi_mode_(false, false);
}
WiFiSTAConnectStatus WiFiComponent::wifi_sta_connect_status_() {
WiFiSTAConnectStatus WiFiComponent::wifi_sta_connect_status_() const {
// Use state machine instead of querying WiFi.status() directly
// State is updated in main loop from queued events, ensuring thread safety
switch (s_sta_state) {

View File

@@ -115,8 +115,13 @@ const char *get_disconnect_reason_str(uint8_t reason) {
return "UNKNOWN";
}
WiFiSTAConnectStatus WiFiComponent::wifi_sta_connect_status_() {
int status = cyw43_tcpip_link_status(&cyw43_state, CYW43_ITF_STA);
WiFiSTAConnectStatus WiFiComponent::wifi_sta_connect_status_() const {
// Use cyw43_wifi_link_status instead of cyw43_tcpip_link_status because the Arduino
// framework's __wrap_cyw43_cb_tcpip_init is a no-op — the SDK's internal netif
// (cyw43_state.netif[]) is never initialized. cyw43_tcpip_link_status checks that netif's
// flags and would only fall through to cyw43_wifi_link_status when the flags aren't set.
// Using cyw43_wifi_link_status directly gives us the actual WiFi radio join state.
int status = cyw43_wifi_link_status(&cyw43_state, CYW43_ITF_STA);
switch (status) {
case CYW43_LINK_JOIN:
case CYW43_LINK_NOIP:

View File

@@ -52,6 +52,7 @@
#define USE_HOMEASSISTANT_TIME
#define USE_HTTP_REQUEST_OTA_WATCHDOG_TIMEOUT 8000 // NOLINT
#define USE_IMAGE
#define USE_IMPROV_SERIAL
#define USE_IMPROV_SERIAL_NEXT_URL
#define USE_INFRARED
#define USE_IR_RF