cpu/esp: esp_now timer restart for peer-scan moved

Timer restart was moved from esp_now_scan_peers_done to esp_now_scan_peers_start to avoid that the scan for peers isn't triggered anymore if the esp_now_scan_peers_done callback isn't called because of errors.
This commit is contained in:
Gunar Schorcht 2019-01-07 18:36:35 +01:00
parent 26cec66be5
commit 3bb28c989b

View File

@ -160,9 +160,6 @@ static void IRAM_ATTR esp_now_scan_peers_done(void)
_esp_now_scan_peers_done = true; _esp_now_scan_peers_done = true;
/* set the time for next scan */
xtimer_set(&_esp_now_scan_peers_timer, esp_now_params.scan_period);
mutex_unlock(&_esp_now_dev.dev_lock); mutex_unlock(&_esp_now_dev.dev_lock);
} }
@ -170,7 +167,10 @@ static void esp_now_scan_peers_start(void)
{ {
DEBUG("%s\n", __func__); DEBUG("%s\n", __func__);
/* start the scan */
esp_wifi_scan_start(&scan_cfg, false); esp_wifi_scan_start(&scan_cfg, false);
/* set the time for next scan */
xtimer_set(&_esp_now_scan_peers_timer, esp_now_params.scan_period);
} }
static void IRAM_ATTR esp_now_scan_peers_timer_cb(void* arg) static void IRAM_ATTR esp_now_scan_peers_timer_cb(void* arg)