Rename to match WIFI_REASON. Also return specific reason code.

This commit is contained in:
anecdata 2021-01-13 23:46:35 -06:00
parent e519dd3c52
commit f75bb5c50f
1 changed files with 2 additions and 2 deletions

View File

@ -168,11 +168,11 @@ wifi_radio_error_t common_hal_wifi_radio_connect(wifi_radio_obj_t *self, uint8_t
} while ((bits & (WIFI_CONNECTED_BIT | WIFI_DISCONNECTED_BIT)) == 0 && !mp_hal_is_interrupted()); } while ((bits & (WIFI_CONNECTED_BIT | WIFI_DISCONNECTED_BIT)) == 0 && !mp_hal_is_interrupted());
if ((bits & WIFI_DISCONNECTED_BIT) != 0) { if ((bits & WIFI_DISCONNECTED_BIT) != 0) {
if (self->last_disconnect_reason == WIFI_REASON_AUTH_FAIL) { if (self->last_disconnect_reason == WIFI_REASON_AUTH_FAIL) {
return WIFI_RADIO_ERROR_AUTH; return WIFI_RADIO_ERROR_AUTH_FAIL;
} else if (self->last_disconnect_reason == WIFI_REASON_NO_AP_FOUND) { } else if (self->last_disconnect_reason == WIFI_REASON_NO_AP_FOUND) {
return WIFI_RADIO_ERROR_NO_AP_FOUND; return WIFI_RADIO_ERROR_NO_AP_FOUND;
} }
return WIFI_RADIO_ERROR_UNKNOWN; return self->last_disconnect_reason;
} }
return WIFI_RADIO_ERROR_NONE; return WIFI_RADIO_ERROR_NONE;
} }