@@ -350,7 +350,7 @@ void mgos_wifi_sta_scan_cb(int num_res, struct mgos_wifi_scan_result *res,
350
350
mgos_wifi_sta_build_queue (num_res , res , true /* check_history */ , & seen_cfg );
351
351
if (SLIST_EMPTY (& s_ap_queue )) {
352
352
// No good quality APs left to try, keep trying bad ones.
353
- LOG (LL_INFO , ("Second pass" ));
353
+ LOG (LL_DEBUG , ("Second pass" ));
354
354
mgos_wifi_sta_build_queue (num_res , res , false /* check_history */ ,
355
355
& seen_cfg );
356
356
}
@@ -461,7 +461,6 @@ static void mgos_wifi_sta_run(int wifi_ev, void *ev_data, bool timeout) {
461
461
/* If we are roaming and have no good candidate, go back. */
462
462
int cur_rssi = mgos_wifi_sta_get_rssi ();
463
463
bool ok = false;
464
- s_rssi_info .val <<= 8 ;
465
464
if (ape == NULL || ape -> rssi == 0 ) {
466
465
LOG (LL_INFO , ("No candidate APs" ));
467
466
} else if (s_cur_entry != NULL && memcmp (s_cur_entry -> bssid , ape -> bssid ,
@@ -590,15 +589,13 @@ static void mgos_wifi_sta_run(int wifi_ev, void *ev_data, bool timeout) {
590
589
sum += s_rssi_info .samples [i ];
591
590
}
592
591
int avg_rssi = sum / (int ) ARRAY_SIZE (s_rssi_info .samples );
593
- int64_t now = mgos_uptime_micros ();
594
592
if (avg_rssi < roam_rssi_thr &&
595
- (now - s_last_roam_attempt > roam_intvl * 1000000 )) {
596
- LOG (LL_INFO ,
597
- ("Current RSSI %d, will scan for a better AP" , cur_rssi ));
593
+ mgos_uptime_micros () - s_last_roam_attempt > roam_intvl * 1000000 ) {
594
+ LOG (LL_INFO , ("Avg RSSI %d, will scan for a better AP" , avg_rssi ));
598
595
s_roaming = true;
599
596
s_state = WIFI_STA_SCAN ;
600
- mgos_wifi_sta_set_timeout (true /* run_now */ );
601
597
s_last_roam_attempt = mgos_uptime_micros ();
598
+ mgos_wifi_sta_set_timeout (true /* run_now */ );
602
599
}
603
600
}
604
601
}
0 commit comments