diff --git a/cura/PrinterOutput/FirmwareUpdater.py b/cura/PrinterOutput/FirmwareUpdater.py index 3f20e0f3c4..d33015920a 100644 --- a/cura/PrinterOutput/FirmwareUpdater.py +++ b/cura/PrinterOutput/FirmwareUpdater.py @@ -75,4 +75,4 @@ class FirmwareUpdateState(IntEnum): communication_error = 4 io_error = 5 firmware_not_found_error = 6 - + invalid_firmware_error = 7 diff --git a/plugins/FirmwareUpdater/FirmwareUpdaterMachineAction.qml b/plugins/FirmwareUpdater/FirmwareUpdaterMachineAction.qml index b5b6c15f50..90a27c24e1 100644 --- a/plugins/FirmwareUpdater/FirmwareUpdaterMachineAction.qml +++ b/plugins/FirmwareUpdater/FirmwareUpdaterMachineAction.qml @@ -151,6 +151,8 @@ Cura.MachineAction return catalog.i18nc("@label","Firmware update failed due to an input/output error."); case 6: return catalog.i18nc("@label","Firmware update failed due to missing firmware."); + case 7: + return catalog.i18nc("@label","Firmware update failed due to invalid firmware file."); } } diff --git a/plugins/UM3NetworkPrinting/src/Network/LocalClusterOutputDeviceManager.py b/plugins/UM3NetworkPrinting/src/Network/LocalClusterOutputDeviceManager.py index e55eb12fed..89fd71d03c 100644 --- a/plugins/UM3NetworkPrinting/src/Network/LocalClusterOutputDeviceManager.py +++ b/plugins/UM3NetworkPrinting/src/Network/LocalClusterOutputDeviceManager.py @@ -135,10 +135,13 @@ class LocalClusterOutputDeviceManager: ultimaker_machines = container_registry.findContainersMetadata(type="machine", manufacturer="Ultimaker B.V.") found_machine_type_identifiers = {} # type: Dict[str, str] for machine in ultimaker_machines: - machine_bom_number = machine.get("firmware_update_info", {}).get("id", None) machine_type = machine.get("id", None) - if machine_bom_number and machine_type: - found_machine_type_identifiers[str(machine_bom_number)] = machine_type + machine_bom_numbers = machine.get("bom_numbers", []) + if machine_type and machine_bom_numbers: + for bom_number in machine_bom_numbers: + # This produces a n:1 mapping of bom numbers to machine types + # allowing the S5R1 and S5R2 hardware to use a single S5 definition. + found_machine_type_identifiers[str(bom_number)] = machine_type return found_machine_type_identifiers ## Add a new device. diff --git a/plugins/USBPrinting/AvrFirmwareUpdater.py b/plugins/USBPrinting/AvrFirmwareUpdater.py index 0f7146560d..ded2036efe 100644 --- a/plugins/USBPrinting/AvrFirmwareUpdater.py +++ b/plugins/USBPrinting/AvrFirmwareUpdater.py @@ -27,6 +27,9 @@ class AvrFirmwareUpdater(FirmwareUpdater): except (FileNotFoundError, AssertionError): Logger.log("e", "Unable to read provided hex file. Could not update firmware.") self._setFirmwareUpdateState(FirmwareUpdateState.firmware_not_found_error) + except Exception: + Logger.logException("e", "Failed to read hex file '%s'", self._firmware_file) + self._setFirmwareUpdateState(FirmwareUpdateState.invalid_firmware_error) return programmer = stk500v2.Stk500v2() diff --git a/plugins/USBPrinting/avr_isp/intelHex.py b/plugins/USBPrinting/avr_isp/intelHex.py index 671f1788f7..3c5c66d805 100644 --- a/plugins/USBPrinting/avr_isp/intelHex.py +++ b/plugins/USBPrinting/avr_isp/intelHex.py @@ -5,13 +5,16 @@ See: http://en.wikipedia.org/wiki/Intel_HEX This is a python 3 conversion of the code created by David Braam for the Cura project. """ import io +from typing import List + from UM.Logger import Logger -def readHex(filename): + +def readHex(filename: str) -> List[int]: """ Read an verify an intel hex file. Return the data as an list of bytes. """ - data = [] + data = [] # type: List[int] extra_addr = 0 f = io.open(filename, "r", encoding = "utf-8") for line in f: diff --git a/resources/definitions/ultimaker3.def.json b/resources/definitions/ultimaker3.def.json index bd7e96448a..b34ff3bdba 100644 --- a/resources/definitions/ultimaker3.def.json +++ b/resources/definitions/ultimaker3.def.json @@ -33,7 +33,10 @@ "https://software.ultimaker.com/releases/firmware/9066/stable/um-update.swu.version" ], "update_url": "https://ultimaker.com/firmware" - } + }, + "bom_numbers": [ + 9066 + ] }, diff --git a/resources/definitions/ultimaker3_extended.def.json b/resources/definitions/ultimaker3_extended.def.json index c0d099366d..ba9824896f 100644 --- a/resources/definitions/ultimaker3_extended.def.json +++ b/resources/definitions/ultimaker3_extended.def.json @@ -30,7 +30,10 @@ "https://software.ultimaker.com/releases/firmware/9066/stable/um-update.swu.version" ], "update_url": "https://ultimaker.com/firmware" - } + }, + "bom_numbers": [ + 9511 + ] }, "overrides": { diff --git a/resources/definitions/ultimaker_s3.def.json b/resources/definitions/ultimaker_s3.def.json index 0fbf4acd77..f7f3a038fe 100644 --- a/resources/definitions/ultimaker_s3.def.json +++ b/resources/definitions/ultimaker_s3.def.json @@ -34,7 +34,10 @@ "id": 213482, "check_urls": ["https://software.ultimaker.com/releases/firmware/213482/stable/um-update.swu.version"], "update_url": "https://ultimaker.com/firmware" - } + }, + "bom_numbers": [ + 213482 + ] }, "overrides": { diff --git a/resources/definitions/ultimaker_s5.def.json b/resources/definitions/ultimaker_s5.def.json index 81b3a704ff..fef8c87c27 100644 --- a/resources/definitions/ultimaker_s5.def.json +++ b/resources/definitions/ultimaker_s5.def.json @@ -35,7 +35,10 @@ "id": 9051, "check_urls": ["https://software.ultimaker.com/releases/firmware/9051/stable/um-update.swu.version"], "update_url": "https://ultimaker.com/firmware" - } + }, + "bom_numbers": [ + 9051, 214475 + ] }, "overrides": {