mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 14:37:29 -06:00
Move hardcoded firmware-file table to definitions
This commit is contained in:
parent
3ac5342dfc
commit
339987be9d
11 changed files with 30 additions and 44 deletions
|
@ -93,57 +93,31 @@ class USBPrinterOutputDeviceManager(QObject, OutputDevicePlugin):
|
|||
global_container_stack = self._application.getGlobalContainerStack()
|
||||
if not global_container_stack:
|
||||
Logger.log("e", "There is no global container stack. Can not update firmware.")
|
||||
self._firmware_view.close()
|
||||
return ""
|
||||
|
||||
# The bottom of the containerstack is the machine definition
|
||||
machine_id = global_container_stack.getBottom().id
|
||||
|
||||
machine_has_heated_bed = global_container_stack.getProperty("machine_heated_bed", "value")
|
||||
|
||||
baudrate = 250000
|
||||
if platform.system() == "Linux":
|
||||
# Linux prefers a baudrate of 115200 here because older versions of
|
||||
# pySerial did not support a baudrate of 250000
|
||||
baudrate = 115200
|
||||
else:
|
||||
baudrate = 250000
|
||||
|
||||
# NOTE: The keyword used here is the id of the machine. You can find the id of your machine in the *.json file, eg.
|
||||
# https://github.com/Ultimaker/Cura/blob/master/resources/machines/ultimaker_original.json#L2
|
||||
# The *.hex files are stored at a seperate repository:
|
||||
# https://github.com/Ultimaker/cura-binary-data/tree/master/cura/resources/firmware
|
||||
machine_without_extras = {"bq_witbox" : "MarlinWitbox.hex",
|
||||
"bq_hephestos_2" : "MarlinHephestos2.hex",
|
||||
"ultimaker_original" : "MarlinUltimaker-{baudrate}.hex",
|
||||
"ultimaker_original_plus" : "MarlinUltimaker-UMOP-{baudrate}.hex",
|
||||
"ultimaker_original_dual" : "MarlinUltimaker-{baudrate}-dual.hex",
|
||||
"ultimaker2" : "MarlinUltimaker2.hex",
|
||||
"ultimaker2_go" : "MarlinUltimaker2go.hex",
|
||||
"ultimaker2_plus" : "MarlinUltimaker2plus.hex",
|
||||
"ultimaker2_extended" : "MarlinUltimaker2extended.hex",
|
||||
"ultimaker2_extended_plus" : "MarlinUltimaker2extended-plus.hex",
|
||||
}
|
||||
machine_with_heated_bed = {"ultimaker_original" : "MarlinUltimaker-HBK-{baudrate}.hex",
|
||||
"ultimaker_original_dual" : "MarlinUltimaker-HBK-{baudrate}-dual.hex",
|
||||
}
|
||||
##TODO: Add check for multiple extruders
|
||||
hex_file = None
|
||||
if machine_id in machine_without_extras.keys(): # The machine needs to be defined here!
|
||||
if machine_id in machine_with_heated_bed.keys() and machine_has_heated_bed:
|
||||
Logger.log("d", "Choosing firmware with heated bed enabled for machine %s.", machine_id)
|
||||
hex_file = machine_with_heated_bed[machine_id] # Return firmware with heated bed enabled
|
||||
else:
|
||||
Logger.log("d", "Choosing basic firmware for machine %s.", machine_id)
|
||||
hex_file = machine_without_extras[machine_id] # Return "basic" firmware
|
||||
else:
|
||||
Logger.log("w", "There is no firmware for machine %s.", machine_id)
|
||||
# If a firmware file is available, it should be specified in the definition for the printer
|
||||
hex_file = global_container_stack.getMetaDataEntry("firmware_file", None)
|
||||
if machine_has_heated_bed:
|
||||
hex_file = global_container_stack.getMetaDataEntry("firmware_hbk_file", hex_file)
|
||||
|
||||
if hex_file:
|
||||
try:
|
||||
return Resources.getPath(CuraApplication.ResourceTypes.Firmware, hex_file.format(baudrate=baudrate))
|
||||
except FileNotFoundError:
|
||||
Logger.log("w", "Could not find any firmware for machine %s.", machine_id)
|
||||
Logger.log("w", "Firmware file %s not found.", hex_file)
|
||||
return ""
|
||||
else:
|
||||
Logger.log("w", "Could not find any firmware for machine %s.", machine_id)
|
||||
Logger.log("w", "There is no firmware for machine %s.", machine_id)
|
||||
return ""
|
||||
|
||||
## Helper to identify serial ports (and scan for them)
|
||||
|
|
|
@ -12,7 +12,8 @@
|
|||
"machine_extruder_trains":
|
||||
{
|
||||
"0": "bq_hephestos_extruder_0"
|
||||
}
|
||||
},
|
||||
"firmware_file": "MarlinHephestos2.hex"
|
||||
},
|
||||
|
||||
"overrides": {
|
||||
|
|
|
@ -12,7 +12,8 @@
|
|||
"machine_extruder_trains":
|
||||
{
|
||||
"0": "bq_witbox_extruder_0"
|
||||
}
|
||||
},
|
||||
"firmware_file": "MarlinWitbox.hex"
|
||||
},
|
||||
|
||||
"overrides": {
|
||||
|
|
|
@ -20,7 +20,8 @@
|
|||
"machine_extruder_trains":
|
||||
{
|
||||
"0": "ultimaker2_extruder_0"
|
||||
}
|
||||
},
|
||||
"firmware_file": "MarlinUltimaker2.hex"
|
||||
},
|
||||
"overrides": {
|
||||
"machine_name": { "default_value": "Ultimaker 2" },
|
||||
|
|
|
@ -14,7 +14,8 @@
|
|||
"machine_extruder_trains":
|
||||
{
|
||||
"0": "ultimaker2_extended_extruder_0"
|
||||
}
|
||||
},
|
||||
"firmware_file": "MarlinUltimaker2extended.hex"
|
||||
},
|
||||
|
||||
"overrides": {
|
||||
|
|
|
@ -14,7 +14,8 @@
|
|||
"machine_extruder_trains":
|
||||
{
|
||||
"0": "ultimaker2_extended_plus_extruder_0"
|
||||
}
|
||||
},
|
||||
"firmware_file": "MarlinUltimaker2extended-plus.hex"
|
||||
},
|
||||
|
||||
"overrides": {
|
||||
|
|
|
@ -17,7 +17,8 @@
|
|||
"machine_extruder_trains":
|
||||
{
|
||||
"0": "ultimaker2_go_extruder_0"
|
||||
}
|
||||
},
|
||||
"firmware_file": "MarlinUltimaker2go.hex"
|
||||
},
|
||||
|
||||
"overrides": {
|
||||
|
|
|
@ -19,7 +19,8 @@
|
|||
"machine_extruder_trains":
|
||||
{
|
||||
"0": "ultimaker2_plus_extruder_0"
|
||||
}
|
||||
},
|
||||
"firmware_file": "MarlinUltimaker2plus.hex"
|
||||
},
|
||||
|
||||
"overrides": {
|
||||
|
|
|
@ -18,7 +18,9 @@
|
|||
"machine_extruder_trains":
|
||||
{
|
||||
"0": "ultimaker_original_extruder_0"
|
||||
}
|
||||
},
|
||||
"firmware_file": "MarlinUltimaker-{baudrate}.hex",
|
||||
"firmware_hbk_file": "MarlinUltimaker-HKB-{baudrate}.hex"
|
||||
},
|
||||
|
||||
"overrides": {
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
"0": "ultimaker_original_dual_1st",
|
||||
"1": "ultimaker_original_dual_2nd"
|
||||
},
|
||||
"firmware_file": "MarlinUltimaker-{baudrate}-dual.hex",
|
||||
"firmware_hbk_file": "MarlinUltimaker-HKB-{baudrate}-dual.hex",
|
||||
"first_start_actions": ["UMOUpgradeSelection", "UMOCheckup", "BedLevel"],
|
||||
"supported_actions": ["UMOUpgradeSelection", "UMOCheckup", "BedLevel", "UpgradeFirmware"]
|
||||
},
|
||||
|
|
|
@ -16,7 +16,8 @@
|
|||
"machine_extruder_trains":
|
||||
{
|
||||
"0": "ultimaker_original_plus_extruder_0"
|
||||
}
|
||||
},
|
||||
"firmware_file": "MarlinUltimaker-UMOP-{baudrate}.hex"
|
||||
},
|
||||
|
||||
"overrides": {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue