TSCH: bugfix in tsch-adaptive-sync
This commit is contained in:
parent
0fd22a425a
commit
a11c2f4a1f
@ -68,7 +68,7 @@ tsch_adaptive_timesync_get_drift_ppm(void)
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Add a value to a moving average estimator */
|
||||
static int32_t
|
||||
timesync_entry_add(int32_t val, uint32_t time_delta)
|
||||
timesync_entry_add(int32_t val)
|
||||
{
|
||||
#define NUM_TIMESYNC_ENTRIES 8
|
||||
static int32_t buffer[NUM_TIMESYNC_ENTRIES];
|
||||
@ -101,9 +101,9 @@ timesync_learn_drift_ticks(uint32_t time_delta_asn, int32_t drift_ticks)
|
||||
/* should fit in a 32-bit integer */
|
||||
int32_t time_delta_ticks = time_delta_asn * tsch_timing[tsch_ts_timeslot_length];
|
||||
int32_t real_drift_ticks = drift_ticks + compensated_ticks;
|
||||
int32_t last_drift_ppm = (int32_t)((int64_t)real_drift_ticks * TSCH_DRIFT_UNIT / time_delta_ticks);
|
||||
int32_t last_drift_ppm = (int32_t)(((int64_t)real_drift_ticks * TSCH_DRIFT_UNIT) / time_delta_ticks);
|
||||
|
||||
drift_ppm = timesync_entry_add(last_drift_ppm, time_delta_ticks);
|
||||
drift_ppm = timesync_entry_add(last_drift_ppm);
|
||||
|
||||
TSCH_LOG_ADD(tsch_log_message,
|
||||
snprintf(log->message, sizeof(log->message),
|
||||
|
Loading…
Reference in New Issue
Block a user