TSCH: reduce keep-alive traffic as we get more accurate drift estimates

This commit is contained in:
Simon Duquennoy 2016-06-23 18:43:12 +02:00 committed by Simon Duquennoy
parent ab706a6f33
commit 15dc86aeb1
3 changed files with 31 additions and 7 deletions

View file

@ -38,8 +38,10 @@
*
*/
#include "tsch-adaptive-timesync.h"
#include "tsch-log.h"
#include "net/mac/tsch/tsch.h"
#include "net/mac/tsch/tsch-conf.h"
#include "net/mac/tsch/tsch-adaptive-timesync.h"
#include "net/mac/tsch/tsch-log.h"
#include <stdio.h>
#if TSCH_ADAPTIVE_TIMESYNC
@ -72,6 +74,10 @@ timesync_entry_add(int32_t val, uint32_t time_delta)
buffer[pos] = val;
if(timesync_entry_count < NUM_TIMESYNC_ENTRIES) {
timesync_entry_count++;
} else {
/* We now have accurate drift compensation.
* Increase keep-alive timeout. */
tsch_set_ka_timeout(TSCH_MAX_KEEPALIVE_TIMEOUT);
}
pos = (pos + 1) % NUM_TIMESYNC_ENTRIES;