mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 23:17:32 -06:00
Add a retry when probing for printers on discovered ports. This is to accomodate for printers that needs a few seconds to initialize before they open the port.
This commit is contained in:
parent
b3f0292ce6
commit
5214ef3bde
1 changed files with 32 additions and 29 deletions
|
@ -22,6 +22,7 @@ class AutoDetectBaudJob(Job):
|
||||||
def run(self):
|
def run(self):
|
||||||
Logger.log("d", "Auto detect baud rate started.")
|
Logger.log("d", "Auto detect baud rate started.")
|
||||||
timeout = 3
|
timeout = 3
|
||||||
|
tries = 2
|
||||||
|
|
||||||
programmer = Stk500v2()
|
programmer = Stk500v2()
|
||||||
serial = None
|
serial = None
|
||||||
|
@ -31,6 +32,7 @@ class AutoDetectBaudJob(Job):
|
||||||
except:
|
except:
|
||||||
programmer.close()
|
programmer.close()
|
||||||
|
|
||||||
|
for retry in range(tries):
|
||||||
for baud_rate in self._all_baud_rates:
|
for baud_rate in self._all_baud_rates:
|
||||||
Logger.log("d", "Checking {serial} if baud rate {baud_rate} works".format(serial= self._serial_port, baud_rate = baud_rate))
|
Logger.log("d", "Checking {serial} if baud rate {baud_rate} works".format(serial= self._serial_port, baud_rate = baud_rate))
|
||||||
|
|
||||||
|
@ -63,4 +65,5 @@ class AutoDetectBaudJob(Job):
|
||||||
return
|
return
|
||||||
|
|
||||||
serial.write(b"M105\n")
|
serial.write(b"M105\n")
|
||||||
|
sleep(15) # Give the printer some time to init and try again.
|
||||||
self.setResult(None) # Unable to detect the correct baudrate.
|
self.setResult(None) # Unable to detect the correct baudrate.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue