Revert "Improved connecting phase"
Improved connecting for some printers, destroyed it
completely for others, so this needs some more work/
thought before it's ready for prime time.
This reverts commit c82ec3d3af.
This commit is contained in:
parent
c82ec3d3af
commit
35e20162ec
1 changed files with 5 additions and 22 deletions
|
|
@ -887,25 +887,10 @@ class MachineCom(object):
|
|||
connection_timeout = settings().getFloat(["serial", "timeout", "connection"])
|
||||
detection_timeout = settings().getFloat(["serial", "timeout", "detection"])
|
||||
|
||||
# M110 polling during connection phase
|
||||
# enqueue an M105 first thing
|
||||
if try_hello:
|
||||
# we do this repeatedly since depending on firmware/bootloader/cable it might happen
|
||||
# that stuff gets lost during connection initialization, and if that stuff happens
|
||||
# to be an "ok", we'll get stuck
|
||||
#
|
||||
# so let's make things a bit more robust here and just have it send an M110 every second
|
||||
# while in "connecting" state so that we can retrigger an M110 processing if the "ok"
|
||||
# for the first one gets lost
|
||||
|
||||
def poll_connection():
|
||||
self._logger.debug("Performing M110 poll")
|
||||
self._sendCommand("M110")
|
||||
self._clear_to_send.set()
|
||||
connection_poller = RepeatedTimer(1, poll_connection,
|
||||
run_first=True,
|
||||
condition=lambda: self._state == self.STATE_CONNECTING,
|
||||
on_finish=lambda: self._logger.debug("Stopping M110 poll, no longer connecting"))
|
||||
connection_poller.start()
|
||||
self._sendCommand("M110")
|
||||
self._clear_to_send.set()
|
||||
|
||||
while self._monitoring_active:
|
||||
try:
|
||||
|
|
@ -1131,10 +1116,6 @@ class MachineCom(object):
|
|||
|
||||
### Baudrate detection
|
||||
if self._state == self.STATE_DETECT_BAUDRATE:
|
||||
# TODO this needs to be rewritten to make use of a repeated timer and to move it outside of the monitor thread
|
||||
# makes way more sense to have it as a separate function that is part of the connection attempt, not of
|
||||
# the protocol implementation
|
||||
# that whole _monitor loop is soooo ugly...
|
||||
if line == '' or time.time() > self._timeout:
|
||||
if self._baudrateDetectRetry > 0:
|
||||
self._serial.timeout = detection_timeout
|
||||
|
|
@ -1170,6 +1151,8 @@ class MachineCom(object):
|
|||
elif self._state == self.STATE_CONNECTING:
|
||||
if "start" in line and not startSeen:
|
||||
startSeen = True
|
||||
self._sendCommand("M110")
|
||||
self._clear_to_send.set()
|
||||
elif line.startswith("ok"):
|
||||
self._onConnected()
|
||||
elif time.time() > self._timeout:
|
||||
|
|
|
|||
Loading…
Reference in a new issue