clocksync: Simplify is_active() check

In some rare circumstances it was possible for the host software to
become so busy that it does not transmit a get_clock request for
several seconds.  (In particular, this could occur with some complex
calls to coordinate_descent.)  If that happened, it was possible for
the code to incorrectly report a "Timeout with MCU" error.  Rework the
is_active() check to prevent that.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2018-05-31 18:18:23 -04:00
parent 1b1d2adb31
commit ff9543eee2
2 changed files with 9 additions and 9 deletions

View file

@ -690,7 +690,7 @@ class MCU:
serialhdl.arduino_reset(self._serialport, self._reactor)
def _restart_via_command(self):
if ((self._reset_cmd is None and self._config_reset_cmd is None)
or not self._clocksync.is_active(self._reactor.monotonic())):
or not self._clocksync.is_active()):
logging.info("Unable to issue reset command on MCU '%s'", self._name)
return
if self._reset_cmd is None:
@ -739,7 +739,7 @@ class MCU:
return
offset, freq = self._clocksync.calibrate_clock(print_time, eventtime)
self._ffi_lib.steppersync_set_time(self._steppersync, offset, freq)
if (self._clocksync.is_active(eventtime) or self.is_fileoutput()
if (self._clocksync.is_active() or self.is_fileoutput()
or self._is_timeout):
return
self._is_timeout = True