Skip to content

Commit

Permalink
mcu: Increase trsync_state reporting during multi-mcu homing
Browse files Browse the repository at this point in the history
The current code has the mcu report a trsync_state message every 10ms
and expects a time extension within 25ms.  However, this means that if
a single mcu->host report is lost then 20ms would elapse until the
next report, which would allow for only a 5ms round-trip time before a
timeout error is reported.

Increase the trsync_state timing so that a message is sent every
7.5ms.  This increases the total number of messages per second sent
from mcu to host to 133 (from 100).  With this change, a single lost
message would still allow for up to a 10ms round-trip time.

Signed-off-by: Kevin O'Connor <[email protected]>
  • Loading branch information
KevinOConnor committed Jan 16, 2024
1 parent dab39c0 commit 1ea9f3a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions klippy/mcu.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,9 @@ def start(self, print_time, report_offset,
clock = self._mcu.print_time_to_clock(print_time)
expire_ticks = self._mcu.seconds_to_clock(expire_timeout)
expire_clock = clock + expire_ticks
report_ticks = self._mcu.seconds_to_clock(expire_timeout * .4)
report_ticks = self._mcu.seconds_to_clock(expire_timeout * .3)
report_clock = clock + int(report_ticks * report_offset + .5)
min_extend_ticks = self._mcu.seconds_to_clock(expire_timeout * .4 * .8)
min_extend_ticks = int(report_ticks * .8 + .5)
ffi_main, ffi_lib = chelper.get_ffi()
ffi_lib.trdispatch_mcu_setup(self._trdispatch_mcu, clock, expire_clock,
expire_ticks, min_extend_ticks)
Expand Down

0 comments on commit 1ea9f3a

Please sign in to comment.