Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Ultimaker/Cura.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArjen Hiemstra <ahiemstra@heimr.nl>2015-10-30 15:45:19 +0300
committerArjen Hiemstra <ahiemstra@heimr.nl>2015-10-30 15:46:58 +0300
commit37c977cea6ca904345eb20827d8be2f7ed0a76f6 (patch)
treea2ec6786a5bb99626f9456c61d839b586d4309e8 /plugins/USBPrinting/PrinterConnection.py
parent9626a604c26e1d1461e49ac58d98eeaa5d631c23 (diff)
Properly end firmware update procedure and catch errors during firmware update
Contributes to CURA-274
Diffstat (limited to 'plugins/USBPrinting/PrinterConnection.py')
-rw-r--r--plugins/USBPrinting/PrinterConnection.py17
1 files changed, 12 insertions, 5 deletions
diff --git a/plugins/USBPrinting/PrinterConnection.py b/plugins/USBPrinting/PrinterConnection.py
index c78dcf1697..341fe425b1 100644
--- a/plugins/USBPrinting/PrinterConnection.py
+++ b/plugins/USBPrinting/PrinterConnection.py
@@ -45,7 +45,7 @@ class PrinterConnection(OutputDevice, QObject, SignalEmitter):
self._connect_thread.daemon = True
self._end_stop_thread = threading.Thread(target = self._pollEndStop)
- self._end_stop_thread.deamon = True
+ self._end_stop_thread.daemon = True
self._poll_endstop = -1
# Printer is connected
@@ -64,7 +64,8 @@ class PrinterConnection(OutputDevice, QObject, SignalEmitter):
self._listen_thread.daemon = True
self._update_firmware_thread = threading.Thread(target= self._updateFirmware)
- self._update_firmware_thread.deamon = True
+ self._update_firmware_thread.daemon = True
+ self.firmwareUpdateComplete.connect(self._onFirmwareUpdateComplete)
self._heatup_wait_start_time = time.time()
@@ -197,6 +198,8 @@ class PrinterConnection(OutputDevice, QObject, SignalEmitter):
## Private fuction (threaded) that actually uploads the firmware.
def _updateFirmware(self):
+ self.setProgress(0, 100)
+
if self._is_connecting or self._is_connected:
self.close()
hex_file = intelHex.readHex(self._firmware_file_name)
@@ -207,7 +210,11 @@ class PrinterConnection(OutputDevice, QObject, SignalEmitter):
programmer = stk500v2.Stk500v2()
programmer.progressCallback = self.setProgress
- programmer.connect(self._serial_port)
+
+ try:
+ programmer.connect(self._serial_port)
+ except Exception:
+ pass
time.sleep(1) # Give programmer some time to connect. Might need more in some cases, but this worked in all tested cases.
@@ -336,8 +343,8 @@ class PrinterConnection(OutputDevice, QObject, SignalEmitter):
self._connect_thread = threading.Thread(target=self._connect)
self._connect_thread.daemon = True
+ self.setIsConnected(False)
if self._serial is not None:
- self.setIsConnected(False)
try:
self._listen_thread.join()
except:
@@ -622,6 +629,6 @@ class PrinterConnection(OutputDevice, QObject, SignalEmitter):
def _onFirmwareUpdateComplete(self):
self._update_firmware_thread.join()
self._update_firmware_thread = threading.Thread(target= self._updateFirmware)
- self._update_firmware_thread.deamon = True
+ self._update_firmware_thread.daemon = True
self.connect()