mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 06:57:28 -06:00
Catch timeout exceptions when printing via USB
If the firmware froze or something...
This commit is contained in:
parent
ecfb62b69e
commit
507de9c22c
1 changed files with 7 additions and 4 deletions
|
@ -1,4 +1,4 @@
|
|||
# Copyright (c) 2016 Ultimaker B.V.
|
||||
# Copyright (c) 2018 Ultimaker B.V.
|
||||
# Cura is released under the terms of the LGPLv3 or higher.
|
||||
|
||||
from UM.Logger import Logger
|
||||
|
@ -17,7 +17,7 @@ from .avr_isp import stk500v2, intelHex
|
|||
|
||||
from PyQt5.QtCore import pyqtSlot, pyqtSignal, pyqtProperty
|
||||
|
||||
from serial import Serial, SerialException
|
||||
from serial import Serial, SerialException, SerialTimeoutException
|
||||
from threading import Thread
|
||||
from time import time, sleep
|
||||
from queue import Queue
|
||||
|
@ -266,8 +266,11 @@ class USBPrinterOutputDevice(PrinterOutputDevice):
|
|||
command = (command + "\n").encode()
|
||||
if not command.endswith(b"\n"):
|
||||
command += b"\n"
|
||||
self._serial.write(b"\n")
|
||||
self._serial.write(command)
|
||||
try:
|
||||
self._serial.write(b"\n")
|
||||
self._serial.write(command)
|
||||
except SerialTimeoutException:
|
||||
Logger.log("w", "Timeout when sending command to printer via USB.")
|
||||
|
||||
def _update(self):
|
||||
while self._connection_state == ConnectionState.connected and self._serial is not None:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue