summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Shawcroft <scott@adafruit.com>2021-01-06 08:41:19 -0800
committerGitHub <noreply@github.com>2021-01-06 08:41:19 -0800
commita33359762d8c46d5aafe28dcbbe2e4b98019be92 (patch)
tree8714a05220c46172c8977613ff0224ee92e69bad
parent7e59ff379b3344b7567d64d520d4be374be4d685 (diff)
parent98c9492a8c5da5a40e92c60e0f891b6c3038355d (diff)
Merge pull request #3903 from anecdata/reasons
ESP32-S2: Log all Wi-Fi events & remove unneeded call
-rw-r--r--ports/esp32s2/common-hal/wifi/Radio.c2
-rw-r--r--ports/esp32s2/common-hal/wifi/__init__.c21
2 files changed, 12 insertions, 11 deletions
diff --git a/ports/esp32s2/common-hal/wifi/Radio.c b/ports/esp32s2/common-hal/wifi/Radio.c
index 3bc2258a4..e9f374a06 100644
--- a/ports/esp32s2/common-hal/wifi/Radio.c
+++ b/ports/esp32s2/common-hal/wifi/Radio.c
@@ -55,8 +55,6 @@ static void start_station(wifi_radio_obj_t *self) {
esp_wifi_set_mode(next_mode);
self->sta_mode = 1;
-
- esp_wifi_set_config(WIFI_MODE_STA, &self->sta_config);
}
bool common_hal_wifi_radio_get_enabled(wifi_radio_obj_t *self) {
diff --git a/ports/esp32s2/common-hal/wifi/__init__.c b/ports/esp32s2/common-hal/wifi/__init__.c
index 8de377537..08d7a164f 100644
--- a/ports/esp32s2/common-hal/wifi/__init__.c
+++ b/ports/esp32s2/common-hal/wifi/__init__.c
@@ -47,23 +47,23 @@ static void event_handler(void* arg, esp_event_base_t event_base,
if (event_base == WIFI_EVENT) {
switch (event_id) {
case WIFI_EVENT_SCAN_DONE:
- ESP_EARLY_LOGW(TAG, "scan");
+ ESP_LOGW(TAG, "scan");
xEventGroupSetBits(radio->event_group_handle, WIFI_SCAN_DONE_BIT);
break;
case WIFI_EVENT_STA_START:
- ESP_EARLY_LOGW(TAG, "start");
+ ESP_LOGW(TAG, "start");
break;
case WIFI_EVENT_STA_STOP:
- ESP_EARLY_LOGW(TAG, "stop");
+ ESP_LOGW(TAG, "stop");
break;
case WIFI_EVENT_STA_CONNECTED:
- ESP_EARLY_LOGW(TAG, "connected");
+ ESP_LOGW(TAG, "connected");
break;
case WIFI_EVENT_STA_DISCONNECTED: {
- ESP_EARLY_LOGW(TAG, "disconnected");
+ ESP_LOGW(TAG, "disconnected");
wifi_event_sta_disconnected_t* d = (wifi_event_sta_disconnected_t*) event_data;
uint8_t reason = d->reason;
- ESP_EARLY_LOGW(TAG, "reason %d 0x%02x", reason, reason);
+ ESP_LOGW(TAG, "reason %d 0x%02x", reason, reason);
if (radio->retries_left > 0 &&
(reason == WIFI_REASON_AUTH_EXPIRE ||
reason == WIFI_REASON_NOT_AUTHED ||
@@ -71,24 +71,27 @@ static void event_handler(void* arg, esp_event_base_t event_base,
reason == WIFI_REASON_CONNECTION_FAIL ||
reason == WIFI_REASON_4WAY_HANDSHAKE_TIMEOUT)) {
radio->retries_left--;
- ESP_EARLY_LOGI(TAG, "Retrying connect. %d retries remaining", radio->retries_left);
+ ESP_LOGI(TAG, "Retrying connect. %d retries remaining", radio->retries_left);
esp_wifi_connect();
return;
}
radio->last_disconnect_reason = reason;
xEventGroupSetBits(radio->event_group_handle, WIFI_DISCONNECTED_BIT);
+ break;
}
// Cases to handle later.
// case WIFI_EVENT_STA_AUTHMODE_CHANGE:
- default:
+ default: {
+ ESP_LOGW(TAG, "event %d 0x%02x", event_id, event_id);
break;
+ }
}
}
if (event_base == IP_EVENT && event_id == IP_EVENT_STA_GOT_IP) {
- ESP_EARLY_LOGW(TAG, "got ip");
+ ESP_LOGW(TAG, "got ip");
radio->retries_left = radio->starting_retries;
xEventGroupSetBits(radio->event_group_handle, WIFI_CONNECTED_BIT);
}