mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-14 06:25:59 +08:00
Call moveHead and moveBed on the printer model
Instead of on the output device. This function was moved, which caused Cura to crash when the bed levelling procedure was called. Contributes to issue CURA-5061.
This commit is contained in:
parent
676f9b8474
commit
b4cf25cb7f
@ -32,14 +32,16 @@ class BedLevelMachineAction(MachineAction):
|
||||
@pyqtSlot()
|
||||
def startBedLeveling(self):
|
||||
self._bed_level_position = 0
|
||||
|
||||
printer_output_devices = self._getPrinterOutputDevices()
|
||||
if not printer_output_devices:
|
||||
Logger.log("e", "Can't start bed levelling. The printer connection seems to have been lost.")
|
||||
return
|
||||
printer = printer_output_devices[0].activePrinter
|
||||
|
||||
printer_output_devices[0].homeBed()
|
||||
printer_output_devices[0].moveHead(0, 0, 3)
|
||||
printer_output_devices[0].homeHead()
|
||||
printer.homeBed()
|
||||
printer.moveHead(0, 0, 3)
|
||||
printer.homeHead()
|
||||
|
||||
def _getPrinterOutputDevices(self) -> List[PrinterOutputDevice]:
|
||||
return [printer_output_device for printer_output_device in Application.getInstance().getOutputDeviceManager().getOutputDevices() if isinstance(printer_output_device, PrinterOutputDevice)]
|
||||
@ -50,26 +52,25 @@ class BedLevelMachineAction(MachineAction):
|
||||
if not output_devices: #No output devices. Can't move.
|
||||
Logger.log("e", "Can't move to the next position. The printer connection seems to have been lost.")
|
||||
return
|
||||
|
||||
output_device = output_devices[0]
|
||||
printer = output_devices[0].activePrinter
|
||||
|
||||
if self._bed_level_position == 0:
|
||||
output_device.moveHead(0, 0, 3)
|
||||
output_device.homeHead()
|
||||
output_device.moveHead(0, 0, 3)
|
||||
output_device.moveHead(Application.getInstance().getGlobalContainerStack().getProperty("machine_width", "value") - 10, 0, 0)
|
||||
output_device.moveHead(0, 0, -3)
|
||||
printer.moveHead(0, 0, 3)
|
||||
printer.homeHead()
|
||||
printer.moveHead(0, 0, 3)
|
||||
printer.moveHead(Application.getInstance().getGlobalContainerStack().getProperty("machine_width", "value") - 10, 0, 0)
|
||||
printer.moveHead(0, 0, -3)
|
||||
self._bed_level_position += 1
|
||||
elif self._bed_level_position == 1:
|
||||
output_device.moveHead(0, 0, 3)
|
||||
output_device.moveHead(-Application.getInstance().getGlobalContainerStack().getProperty("machine_width", "value" ) / 2, Application.getInstance().getGlobalContainerStack().getProperty("machine_depth", "value") - 10, 0)
|
||||
output_device.moveHead(0, 0, -3)
|
||||
printer.moveHead(0, 0, 3)
|
||||
printer.moveHead(-Application.getInstance().getGlobalContainerStack().getProperty("machine_width", "value" ) / 2, Application.getInstance().getGlobalContainerStack().getProperty("machine_depth", "value") - 10, 0)
|
||||
printer.moveHead(0, 0, -3)
|
||||
self._bed_level_position += 1
|
||||
elif self._bed_level_position == 2:
|
||||
output_device.moveHead(0, 0, 3)
|
||||
output_device.moveHead(-Application.getInstance().getGlobalContainerStack().getProperty("machine_width", "value") / 2 + 10, -(Application.getInstance().getGlobalContainerStack().getProperty("machine_depth", "value") + 10), 0)
|
||||
output_device.moveHead(0, 0, -3)
|
||||
printer.moveHead(0, 0, 3)
|
||||
printer.moveHead(-Application.getInstance().getGlobalContainerStack().getProperty("machine_width", "value") / 2 + 10, -(Application.getInstance().getGlobalContainerStack().getProperty("machine_depth", "value") + 10), 0)
|
||||
printer.moveHead(0, 0, -3)
|
||||
self._bed_level_position += 1
|
||||
elif self._bed_level_position >= 3:
|
||||
output_device.sendCommand("M18") # Turn off all motors so the user can move the axes
|
||||
output_devices[0].sendCommand("M18") # Turn off all motors so the user can move the axes
|
||||
self.setFinished()
|
Loading…
x
Reference in New Issue
Block a user