Merge pull request #545 from simonduq/contrib/tsch-minor
TSCH: keep track of min/max drift seen
This commit is contained in:
commit
6917f02ad9
@ -109,7 +109,9 @@ timesync_learn_drift_ticks(uint32_t time_delta_asn, int32_t drift_ticks)
|
||||
|
||||
TSCH_LOG_ADD(tsch_log_message,
|
||||
snprintf(log->message, sizeof(log->message),
|
||||
"drift %ld", tsch_adaptive_timesync_get_drift_ppm()));
|
||||
"drift %ld ppm (min/max delta seen: %"PRId32"/%"PRId32")",
|
||||
tsch_adaptive_timesync_get_drift_ppm(),
|
||||
min_drift_seen, max_drift_seen));
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Either reset or update the neighbor's drift */
|
||||
@ -136,6 +138,8 @@ tsch_timesync_update(struct tsch_neighbor *n, uint16_t time_delta_asn, int32_t d
|
||||
compensated_ticks += drift_correction;
|
||||
}
|
||||
}
|
||||
min_drift_seen = MIN(drift_correction, min_drift_seen);
|
||||
max_drift_seen = MAX(drift_correction, max_drift_seen);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Error-accumulation free compensation algorithm */
|
||||
|
@ -160,6 +160,8 @@ static struct ctimer keepalive_timer;
|
||||
unsigned long tx_count;
|
||||
unsigned long rx_count;
|
||||
unsigned long sync_count;
|
||||
int32_t min_drift_seen;
|
||||
int32_t max_drift_seen;
|
||||
|
||||
/* TSCH processes and protothreads */
|
||||
PT_THREAD(tsch_scan(struct pt *pt));
|
||||
@ -648,6 +650,8 @@ tsch_associate(const struct input_packet *input_eb, rtimer_clock_t timestamp)
|
||||
tx_count = 0;
|
||||
rx_count = 0;
|
||||
sync_count = 0;
|
||||
min_drift_seen = 0;
|
||||
max_drift_seen = 0;
|
||||
|
||||
/* Start sending keep-alives now that tsch_is_associated is set */
|
||||
tsch_schedule_keepalive();
|
||||
|
@ -175,6 +175,8 @@ extern rtimer_clock_t tsch_timing[tsch_ts_elements_count];
|
||||
extern unsigned long tx_count;
|
||||
extern unsigned long rx_count;
|
||||
extern unsigned long sync_count;
|
||||
extern int32_t min_drift_seen;
|
||||
extern int32_t max_drift_seen;
|
||||
|
||||
/* TSCH processes */
|
||||
PROCESS_NAME(tsch_process);
|
||||
|
Loading…
Reference in New Issue
Block a user