diff --git a/plugins/USBPrinting/FirmwareUpdateWindow.qml b/plugins/USBPrinting/FirmwareUpdateWindow.qml index 7e84737928..afa6dd439c 100644 --- a/plugins/USBPrinting/FirmwareUpdateWindow.qml +++ b/plugins/USBPrinting/FirmwareUpdateWindow.qml @@ -32,7 +32,7 @@ UM.Dialog } text: { - if (manager.firmwareUpdateCompleteStatus) + if (manager.firmwareUpdateCompleteStatus && !manager.progress > 0) { //: Firmware update status label return catalog.i18nc("@label","Firmware update completed.") diff --git a/plugins/USBPrinting/USBPrinterOutputDevice.py b/plugins/USBPrinting/USBPrinterOutputDevice.py index c7d8d6d219..07aea477be 100644 --- a/plugins/USBPrinting/USBPrinterOutputDevice.py +++ b/plugins/USBPrinting/USBPrinterOutputDevice.py @@ -198,7 +198,7 @@ class USBPrinterOutputDevice(PrinterOutputDevice): if not programmer.isConnected(): Logger.log("e", "Unable to connect with serial. Could not update firmware") - self._updateFirmware_completed() + self._updateFirmware_completed_communication_error() return self._updating_firmware = True @@ -206,34 +206,38 @@ class USBPrinterOutputDevice(PrinterOutputDevice): try: programmer.programChip(hex_file) self._updating_firmware = False + except serial.SerialException as e: + Logger.log("e", "SerialException while trying to update firmware: <%s>" %(repr(e))) + self._updateFirmware_completed_io_error() + return except Exception as e: - Logger.log("e", "Exception while trying to update firmware %s" %e) + Logger.log("e", "Exception while trying to update firmware: <%s>" %(repr(e))) self._updateFirmware_completed_unknown() return programmer.close() - self._updateFirmware_completed() + self._updateFirmware_completed_sucessfully() return ## Private function which makes sure that firmware update process has failed by missing firmware def _updateFirmware_completed_missing_firmware(self): - return self._updateFirmware_common(progress = -4) + return self._updateFirmware_completed_common(progress = -4) ## Private function which makes sure that firmware update process has failed by an IO error def _updateFirmware_completed_io_error(self): - return self._updateFirmware_common(progress = -3) + return self._updateFirmware_completed_common(progress = -3) ## Private function which makes sure that firmware update process has failed by a communication problem def _updateFirmware_completed_communication_error(self): - return self._updateFirmware_common(progress = -2) + return self._updateFirmware_completed_common(progress = -2) ## Private function which makes sure that firmware update process has failed by an unknown error def _updateFirmware_completed_unknown(self): - return self._updateFirmware_common(progress = -1) + return self._updateFirmware_completed_common(progress = -1) ## Private function which makes sure that firmware update process has sucessfully completed/ended def _updateFirmware_completed_sucessfully(self): - return self._updateFirmware_common(progress = 100) + return self._updateFirmware_completed_common(progress = 100) ## Private common function which makes sure that firmware update process has completed/ended with a set progress state def _updateFirmware_completed_common(self, progress, max_progress = 100):