TSCH: when scanning, set channel periodically regardless of previous channel

This commit is contained in:
Simon Duquennoy 2018-10-03 13:16:19 +02:00
parent ace15d6499
commit 17c2158229
1 changed files with 5 additions and 5 deletions

View File

@ -730,11 +730,11 @@ PT_THREAD(tsch_scan(struct pt *pt))
/* Pick a channel at random in TSCH_JOIN_HOPPING_SEQUENCE */
uint8_t scan_channel = TSCH_JOIN_HOPPING_SEQUENCE[
random_rand() % sizeof(TSCH_JOIN_HOPPING_SEQUENCE)];
if(current_channel != scan_channel) {
NETSTACK_RADIO.set_value(RADIO_PARAM_CHANNEL, scan_channel);
current_channel = scan_channel;
LOG_INFO("scanning on channel %u\n", scan_channel);
}
NETSTACK_RADIO.set_value(RADIO_PARAM_CHANNEL, scan_channel);
current_channel = scan_channel;
LOG_INFO("scanning on channel %u\n", scan_channel);
current_channel_since = now_time;
}