mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 22:47:29 -06:00
CURA-2079: Adding error messages to the firmware update dialog
Adds messages for IO errors, communication errors, missing firmware and a general message for unknown problems.
This commit is contained in:
parent
9a34f6b067
commit
0435706736
2 changed files with 13 additions and 9 deletions
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue