make TSCH joining attempts to print fewer errors; increase the time discrepancy allowance for the joining timestamp
@@ -550,7 +550,7 @@ tsch_associate(const struct input_packet *input_eb, rtimer_clock_t timestamp)
if(input_eb == NULL || tsch_packet_parse_eb(input_eb->payload, input_eb->len,
&frame, &ies, &hdrlen, 0) == 0) {
- LOG_ERR("! failed to parse EB (len %u)\n", input_eb->len);
+ LOG_DBG("! failed to parse EB (len %u)\n", input_eb->len);
return 0;
}
@@ -769,6 +769,7 @@ PT_THREAD(tsch_scan(struct pt *pt))
/* Read packet */
input_eb.len = NETSTACK_RADIO.read(input_eb.payload, TSCH_PACKET_MAX_LEN);
+ if(input_eb.len > 0) {
/* Save packet timestamp */
NETSTACK_RADIO.get_object(RADIO_PARAM_LAST_PACKET_TIMESTAMP, &t0, sizeof(rtimer_clock_t));
t1 = RTIMER_NOW();
@@ -777,7 +778,7 @@ PT_THREAD(tsch_scan(struct pt *pt))
LOG_INFO("scan: received packet (%u bytes) on channel %u\n", input_eb.len, current_channel);
/* Sanity-check the timestamp */
- if(ABS(RTIMER_CLOCK_DIFF(t0, t1)) < tsch_timing[tsch_ts_timeslot_length]) {
+ if(ABS(RTIMER_CLOCK_DIFF(t0, t1)) < 2ul * RTIMER_SECOND) {
tsch_associate(&input_eb, t0);
} else {
LOG_WARN("scan: dropping packet, timestamp too far from current time %u %u\n",
@@ -786,6 +787,7 @@ PT_THREAD(tsch_scan(struct pt *pt))
);
}
}
+ }
if(tsch_is_associated) {
/* End of association, turn the radio off */
