mirror of
https://github.com/esphome/esphome.git
synced 2026-09-18 18:48:39 +00:00
[wifi] Restore original CYW43 STA mode setup in wifi_mode_
Restore the cyw43_wifi_set_up() call for STA mode that was incorrectly removed. Without this, cyw43_wifi_scan() fails on initial boot because the radio isn't initialized - scanning must work before the first beginNoBlock() call.
This commit is contained in:
@@ -24,10 +24,10 @@ static bool s_sta_had_ip = false; // NOLINT(cppcoreguidelines-avoid-non-
|
||||
static size_t s_scan_result_count = 0; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
|
||||
|
||||
bool WiFiComponent::wifi_mode_(optional<bool> sta, optional<bool> ap) {
|
||||
if (sta.has_value() && sta.value()) {
|
||||
// Enable STA mode so scanning works before the first beginNoBlock() call.
|
||||
// Without this, cyw43_wifi_scan() fails because the radio isn't initialized.
|
||||
cyw43_arch_enable_sta_mode();
|
||||
if (sta.has_value()) {
|
||||
if (sta.value()) {
|
||||
cyw43_wifi_set_up(&cyw43_state, CYW43_ITF_STA, true, CYW43_COUNTRY_WORLDWIDE);
|
||||
}
|
||||
}
|
||||
|
||||
bool ap_state = false;
|
||||
|
||||
Reference in New Issue
Block a user