Fixes to MarlinSerialProtocol

master
Marcio Teixeira 7 years ago
parent fa9cf7f262
commit 8a5fe8b1a1

@ -87,7 +87,7 @@ class MarlinSerialProtocol:
self.marlinBufSize = 4 self.marlinBufSize = 4
self.marlinReserve = 1 self.marlinReserve = 1
self.history = GCodeHistory() self.history = GCodeHistory()
self.slow_commands = re.compile("M109|M190|G28|G29") self.slow_commands = re.compile(b"M109|M190|G28|G29")
self.restart() self.restart()
def _stripCommentsAndWhitespace(self, str): def _stripCommentsAndWhitespace(self, str):
@ -150,15 +150,15 @@ class MarlinSerialProtocol:
def _stallWatchdog(self, line): def _stallWatchdog(self, line):
"""Watches for a stall in the print. This can happen if a number of """Watches for a stall in the print. This can happen if a number of
okays are lost in transmission. To recover, we send Marlin a command okays are lost in transmission. To recover, we send Marlin an invalid
with an invalid checksum. One it requests a resend, we will back into command (no line number, with an asterisk). One it requests a resend,
a known good state.""" we will back into a known good state."""
if line == b"": if line == b"":
if self.stallCountdown > 0: if self.stallCountdown > 0:
self.stallCountdown -= 1 self.stallCountdown -= 1
else: else:
self.stallCountdown = 2 self.stallCountdown = 2
self._sendImmediate("\nN0M105*0\n") self._sendImmediate("\nM105*\n")
else: else:
estimated_duration = 15 if self.slow_commands.search(line) else 2 estimated_duration = 15 if self.slow_commands.search(line) else 2
self.stallCountdown = max(estimated_duration, self.stallCountdown-1) self.stallCountdown = max(estimated_duration, self.stallCountdown-1)

Loading…
Cancel
Save