Improve WiFi disconnect messages (#857)

* Improve WiFi disconnect messages

* Fix

* Update wifi_component_esp32.cpp
This commit is contained in:
Otto Winter 2019-11-17 23:25:04 +01:00
parent c5c42c4338
commit e41a9875e3
No known key found for this signature in database
GPG key ID: DB66C0BE6013F97E
2 changed files with 12 additions and 4 deletions

View file

@ -329,8 +329,12 @@ void WiFiComponent::wifi_event_callback_(system_event_id_t event, system_event_i
char buf[33]; char buf[33];
memcpy(buf, it.ssid, it.ssid_len); memcpy(buf, it.ssid, it.ssid_len);
buf[it.ssid_len] = '\0'; buf[it.ssid_len] = '\0';
ESP_LOGW(TAG, "Event: Disconnected ssid='%s' bssid=" LOG_SECRET("%s") " reason=%s", buf, if (it.reason == WIFI_REASON_NO_AP_FOUND) {
ESP_LOGW(TAG, "Event: Disconnected ssid='%s' reason='Probe Request Unsuccessful'", buf);
} else {
ESP_LOGW(TAG, "Event: Disconnected ssid='%s' bssid=" LOG_SECRET("%s") " reason='%s'", buf,
format_mac_addr(it.bssid).c_str(), get_disconnect_reason_str(it.reason)); format_mac_addr(it.bssid).c_str(), get_disconnect_reason_str(it.reason));
}
break; break;
} }
case SYSTEM_EVENT_STA_AUTHMODE_CHANGE: { case SYSTEM_EVENT_STA_AUTHMODE_CHANGE: {

View file

@ -330,8 +330,12 @@ void WiFiComponent::wifi_event_callback(System_Event_t *event) {
char buf[33]; char buf[33];
memcpy(buf, it.ssid, it.ssid_len); memcpy(buf, it.ssid, it.ssid_len);
buf[it.ssid_len] = '\0'; buf[it.ssid_len] = '\0';
ESP_LOGW(TAG, "Event: Disconnected ssid='%s' bssid=%s reason='%s'", buf, format_mac_addr(it.bssid).c_str(), if (it.reason == REASON_NO_AP_FOUND) {
get_disconnect_reason_str(it.reason)); ESP_LOGW(TAG, "Event: Disconnected ssid='%s' reason='Probe Request Unsuccessful'", buf);
} else {
ESP_LOGW(TAG, "Event: Disconnected ssid='%s' bssid=" LOG_SECRET("%s") " reason='%s'", buf,
format_mac_addr(it.bssid).c_str(), get_disconnect_reason_str(it.reason));
}
break; break;
} }
case EVENT_STAMODE_AUTHMODE_CHANGE: { case EVENT_STAMODE_AUTHMODE_CHANGE: {