klipper-dgus/klippy
Kevin O'Connor c7d0358c41 serialhdl: Rework mcu clock synchronization
The existing clock synchronization code has two flaws: intermittent
transmission latency during get_status requests can cause the
estimated clock to be too low, and the estimated clock calculation did
not take into account possible clock drift between samples.  The
former could potentially lead to "Timer too close" errors and the
latter could potentially lead to "Move queue empty" errors.

Rework the code to avoid the above problems.  It's not necessary to
estimate the micro-controller clock as an excellent estimate is
reported by the micro-controller (via the CLOCK_FREQ constant).
Account for a small drift from the reported value, and check on each
sample if the drift exceeds the expected limits.  With a good starting
estimated clock, only the offset needs to be calculated.  Use previous
offsets (and the estimated clock) in calculation of new offsets to
avoid intermittent latency from badly skewing the results.  Finally,
add an additional time offset of one millisecond to account for any
minor inaccuracies.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-06-30 20:15:36 -04:00
..
cartesian.py klippy: Support minimum/maximum value checks on configuration variables 2017-04-11 11:42:55 -04:00
chelper.py hub-ctrl: Add support for micro-controller reset via RPi usb power toggling 2017-04-13 13:20:13 -04:00
console.py build: Request python2 for all directly executed python binaries 2017-06-27 20:26:02 -04:00
corexy.py klippy: Support minimum/maximum value checks on configuration variables 2017-04-11 11:42:55 -04:00
delta.py delta: Fix support for different endstop_position settings on each stepper 2017-06-11 12:48:51 -04:00
extruder.py gcode: Support running arbitrary gcode on extruder change 2017-06-09 18:55:33 -04:00
fan.py klippy: Allow each module to define their config sections 2017-06-09 18:54:34 -04:00
gcode.py gcode: Fix regression causing lost asynchronous commands 2017-06-11 12:42:11 -04:00
heater.py heater: Fix auto-tune code 2017-06-22 12:09:55 -04:00
homing.py klippy: Use newer "except XYZError as e" python syntax 2017-06-10 00:08:06 -04:00
klippy.py build: Request python2 for all directly executed python binaries 2017-06-27 20:26:02 -04:00
list.h Initial commit of source code. 2016-05-25 11:37:40 -04:00
mcu.py klippy: Use newer "except XYZError as e" python syntax 2017-06-10 00:08:06 -04:00
msgproto.py klippy: Remove some obscure python2 dependencies 2017-06-10 00:12:14 -04:00
parsedump.py build: Request python2 for all directly executed python binaries 2017-06-27 20:26:02 -04:00
pins.py pins: Fix typo in at90usb1286 support so PF0-7 pins are defined 2017-06-09 18:46:07 -04:00
pyhelper.c pyhelper: Fix GETHEX() macro used in dump_string() debugging 2017-05-17 09:57:09 -04:00
pyhelper.h stepcompress: Modify check_expand() into check_push() 2017-04-07 19:05:04 -04:00
queuelogger.py queuelogger: Add critical information to each logfile on rollover 2017-05-01 14:48:44 -04:00
reactor.py reactor: Fix bug causing end() to not always work 2017-04-13 13:20:13 -04:00
serialhdl.py serialhdl: Rework mcu clock synchronization 2017-06-30 20:15:36 -04:00
serialqueue.c serialqueue: Clarify code that associates sent messages to received messages 2017-06-30 20:15:36 -04:00
serialqueue.h serialqueue: Remove serialqueue_flush_ready() 2016-12-30 20:15:05 -05:00
stepcompress.c stepcompress: Simplify delta Z only move calculations 2017-04-20 00:56:18 -04:00
stepper.py klippy: Remove some obscure python2 dependencies 2017-06-10 00:12:14 -04:00
toolhead.py extruder: Add initial support for multi-extruders 2017-06-09 18:54:38 -04:00
util.py klippy: Log the type of cpu the host is running on 2017-02-12 19:14:26 -05:00