Fix wifi status not updating after disconnected (#321)

This commit is contained in:
Erik Olof Gunnar Andersson 2024-09-28 05:49:59 +02:00 committed by GitHub
parent 04e8a518ea
commit 549e8272e7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 1 deletions

View File

@ -75,6 +75,7 @@ static void event_handler(void * arg, esp_event_base_t event_base, int32_t event
ESP_LOGI(TAG, "Bitaxe ip:" IPSTR, IP2STR(&event->ip_info.ip));
s_retry_num = 0;
xEventGroupSetBits(s_wifi_event_group, WIFI_CONNECTED_BIT);
MINER_set_wifi_status(WIFI_CONNECTED, 0);
}
}

View File

@ -217,7 +217,11 @@ void app_main(void)
void MINER_set_wifi_status(wifi_status_t status, uint16_t retry_count)
{
if (status == WIFI_RETRYING) {
if (status == WIFI_CONNECTED) {
snprintf(GLOBAL_STATE.SYSTEM_MODULE.wifi_status, 20, "Connected!");
return;
}
else if (status == WIFI_RETRYING) {
snprintf(GLOBAL_STATE.SYSTEM_MODULE.wifi_status, 20, "Retrying: %d", retry_count);
return;
} else if (status == WIFI_CONNECT_FAILED) {