diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2018-05-05 20:14:46 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2018-05-05 20:14:46 -0400 |
commit | 640ff1ad566361f5a57c4827aa0185be958933af (patch) | |
tree | 08fab67846abee49cf6add04b2ef6e3c1e0fb45f /klippy/clocksync.py | |
parent | cd9e21e3aab38fc767220be79e138beb05f5d473 (diff) | |
download | kutter-640ff1ad566361f5a57c4827aa0185be958933af.tar.gz kutter-640ff1ad566361f5a57c4827aa0185be958933af.tar.xz kutter-640ff1ad566361f5a57c4827aa0185be958933af.zip |
clocksync: Change timer frequency to avoid resonating with other timers
If the clock querying messages occur at a similar frequency to other
events on the micro-controller or host, then it's possible for the
load created by those other events to skew the clock synchronization.
In particular, the 500ms lcd screen update could resonate with the 1
second clock query. Use an unusual clock querying frequency to avoid
this issue.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/clocksync.py')
-rw-r--r-- | klippy/clocksync.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/klippy/clocksync.py b/klippy/clocksync.py index d572c386..caea39dc 100644 --- a/klippy/clocksync.py +++ b/klippy/clocksync.py @@ -54,10 +54,12 @@ class ClockSync: if pace: freq = self.mcu_freq serial.set_clock_est(freq, self.reactor.monotonic(), 0) - # MCU clock querying (status callback invoked from background thread) + # MCU clock querying (_handle_status is invoked from background thread) def _status_event(self, eventtime): self.status_cmd.send() - return eventtime + 1.0 + # Use an unusual time for the next event so status messages + # don't resonate with other periodic events. + return eventtime + .9839 def _handle_status(self, params): # Extend clock to 64bit last_clock = self.last_clock |