mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-25 15:44:04 -06:00
Merge pull request #803 from thopiekar/master-CURA-1615
[CURA-1615] Updating firmware manager for API 3
This commit is contained in:
commit
3d53bc38b7
2 changed files with 21 additions and 12 deletions
|
@ -128,8 +128,18 @@ class USBPrinterOutputDeviceManager(QObject, SignalEmitter, OutputDevicePlugin,
|
||||||
return USBPrinterOutputDeviceManager._instance
|
return USBPrinterOutputDeviceManager._instance
|
||||||
|
|
||||||
def _getDefaultFirmwareName(self):
|
def _getDefaultFirmwareName(self):
|
||||||
machine_instance = Application.getInstance().getMachineManager().getActiveMachineInstance()
|
# Check if there is a valid global container stack
|
||||||
machine_type = machine_instance.getMachineDefinition().getId()
|
global_container_stack = Application.getInstance().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")
|
||||||
|
|
||||||
if platform.system() == "Linux":
|
if platform.system() == "Linux":
|
||||||
baudrate = 115200
|
baudrate = 115200
|
||||||
else:
|
else:
|
||||||
|
@ -151,23 +161,22 @@ class USBPrinterOutputDeviceManager(QObject, SignalEmitter, OutputDevicePlugin,
|
||||||
}
|
}
|
||||||
machine_with_heated_bed = {"ultimaker_original" : "MarlinUltimaker-HBK-{baudrate}.hex",
|
machine_with_heated_bed = {"ultimaker_original" : "MarlinUltimaker-HBK-{baudrate}.hex",
|
||||||
}
|
}
|
||||||
|
|
||||||
##TODO: Add check for multiple extruders
|
##TODO: Add check for multiple extruders
|
||||||
hex_file = None
|
hex_file = None
|
||||||
if machine_type in machine_without_extras.keys(): # The machine needs to be defined here!
|
if machine_id in machine_without_extras.keys(): # The machine needs to be defined here!
|
||||||
if machine_type in machine_with_heated_bed.keys() and machine_instance.getMachineSettingValue("machine_heated_bed"):
|
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_type)
|
Logger.log("d", "Choosing firmware with heated bed enabled for machine %s.", machine_id)
|
||||||
hex_file = machine_with_heated_bed[machine_type] # Return firmware with heated bed enabled
|
hex_file = machine_with_heated_bed[machine_id] # Return firmware with heated bed enabled
|
||||||
else:
|
else:
|
||||||
Logger.log("d", "Choosing basic firmware for machine %s.", machine_type)
|
Logger.log("d", "Choosing basic firmware for machine %s.", machine_id)
|
||||||
hex_file = machine_without_extras[machine_type] # Return "basic" firmware
|
hex_file = machine_without_extras[machine_id] # Return "basic" firmware
|
||||||
else:
|
else:
|
||||||
Logger.log("e", "There is no firmware for machine %s.", machine_type)
|
Logger.log("e", "There is no firmware for machine %s.", machine_id)
|
||||||
|
|
||||||
if hex_file:
|
if hex_file:
|
||||||
return hex_file.format(baudrate=baudrate)
|
return hex_file.format(baudrate=baudrate)
|
||||||
else:
|
else:
|
||||||
Logger.log("e", "Could not find any firmware for machine %s.", machine_type)
|
Logger.log("e", "Could not find any firmware for machine %s.", machine_id)
|
||||||
raise FileNotFoundError()
|
raise FileNotFoundError()
|
||||||
|
|
||||||
## Helper to identify serial ports (and scan for them)
|
## Helper to identify serial ports (and scan for them)
|
||||||
|
|
|
@ -13,7 +13,7 @@ def getMetaData():
|
||||||
"name": i18n_catalog.i18nc("@label", "USB printing"),
|
"name": i18n_catalog.i18nc("@label", "USB printing"),
|
||||||
"author": "Ultimaker",
|
"author": "Ultimaker",
|
||||||
"version": "1.0",
|
"version": "1.0",
|
||||||
"api": 2,
|
"api": 3,
|
||||||
"description": i18n_catalog.i18nc("@info:whatsthis","Accepts G-Code and sends them to a printer. Plugin can also update firmware.")
|
"description": i18n_catalog.i18nc("@info:whatsthis","Accepts G-Code and sends them to a printer. Plugin can also update firmware.")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue