File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
ports/esp32s2/common-hal/wifi Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -160,9 +160,15 @@ mp_obj_t common_hal_wifi_radio_get_ap_rssi(wifi_radio_obj_t *self) {
160
160
}
161
161
162
162
wifi_ap_record_t ap_info ;
163
- esp_wifi_sta_get_ap_info (& ap_info );
164
-
165
- return MP_OBJ_NEW_SMALL_INT (ap_info .rssi );
163
+ // From esp_wifi.h, the possible return values (typos theirs):
164
+ // ESP_OK: succeed
165
+ // ESP_ERR_WIFI_CONN: The station interface don't initialized
166
+ // ESP_ERR_WIFI_NOT_CONNECT: The station is in disconnect status
167
+ if (esp_wifi_sta_get_ap_info (& ap_info ) != ESP_OK ){
168
+ return mp_const_none ;
169
+ } else {
170
+ return mp_obj_new_int (ap_info .rssi );
171
+ }
166
172
}
167
173
168
174
mp_obj_t common_hal_wifi_radio_get_ipv4_gateway (wifi_radio_obj_t * self ) {
You can’t perform that action at this time.
0 commit comments