mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 22:47:29 -06:00
Fix: bed leveling for UM+
CURA-4844
This commit is contained in:
parent
70f867c4f1
commit
290adbd906
5 changed files with 57 additions and 2 deletions
|
@ -58,8 +58,14 @@ class GenericOutputController(PrinterOutputController):
|
||||||
self._output_device.sendCommand("G90")
|
self._output_device.sendCommand("G90")
|
||||||
|
|
||||||
def homeHead(self, printer):
|
def homeHead(self, printer):
|
||||||
self._output_device.sendCommand("G28 X")
|
# Ultimaker+ frimware is 'Marlin V1' and UM2 is "Marlin Ultimaker2"
|
||||||
self._output_device.sendCommand("G28 Y")
|
# For this reason UM2 should move only X, Y and not Z, otherwise it might brake the build plate
|
||||||
|
name = self._output_device.getFirmwareName()
|
||||||
|
if name and name.find("Ultimaker2") != -1:
|
||||||
|
self._output_device.sendCommand("G28 X")
|
||||||
|
self._output_device.sendCommand("G28 Y")
|
||||||
|
else:
|
||||||
|
self._output_device.sendCommand("G28") # Move X-, Y- and Z-coordinate
|
||||||
|
|
||||||
def homeBed(self, printer):
|
def homeBed(self, printer):
|
||||||
self._output_device.sendCommand("G28 Z")
|
self._output_device.sendCommand("G28 Z")
|
||||||
|
|
|
@ -71,6 +71,7 @@ class PrinterOutputDevice(QObject, OutputDevice):
|
||||||
|
|
||||||
self._connection_state = ConnectionState.closed
|
self._connection_state = ConnectionState.closed
|
||||||
|
|
||||||
|
self._firmware_name = None
|
||||||
self._address = ""
|
self._address = ""
|
||||||
self._connection_text = ""
|
self._connection_text = ""
|
||||||
self.printersChanged.connect(self._onPrintersChanged)
|
self.printersChanged.connect(self._onPrintersChanged)
|
||||||
|
@ -198,6 +199,18 @@ class PrinterOutputDevice(QObject, OutputDevice):
|
||||||
# At this point there may be non-updated configurations
|
# At this point there may be non-updated configurations
|
||||||
self._updateUniqueConfigurations()
|
self._updateUniqueConfigurations()
|
||||||
|
|
||||||
|
## Set the device firmware name
|
||||||
|
#
|
||||||
|
# \param name \type{str} The name of the firmware.
|
||||||
|
def _setFirmwareName(self, name):
|
||||||
|
self._firmware_name = name
|
||||||
|
|
||||||
|
## Get the name of device firmware
|
||||||
|
#
|
||||||
|
# This name can be used to define device type
|
||||||
|
def getFirmwareName(self):
|
||||||
|
return self._firmware_name
|
||||||
|
|
||||||
|
|
||||||
## The current processing state of the backend.
|
## The current processing state of the backend.
|
||||||
class ConnectionState(IntEnum):
|
class ConnectionState(IntEnum):
|
||||||
|
|
|
@ -335,6 +335,9 @@ class MachineManager(QObject):
|
||||||
self._initMachineState(containers[0])
|
self._initMachineState(containers[0])
|
||||||
self._onGlobalContainerChanged()
|
self._onGlobalContainerChanged()
|
||||||
|
|
||||||
|
#The signal should update/reset settings of all connected USB devices
|
||||||
|
#self.usbOutputDeviceChanged.emit()
|
||||||
|
|
||||||
self.__emitChangedSignals()
|
self.__emitChangedSignals()
|
||||||
|
|
||||||
## Given a definition id, return the machine with this id.
|
## Given a definition id, return the machine with this id.
|
||||||
|
|
|
@ -85,6 +85,11 @@ class USBPrinterOutputDevice(PrinterOutputDevice):
|
||||||
# Queue for commands that need to be send. Used when command is sent when a print is active.
|
# Queue for commands that need to be send. Used when command is sent when a print is active.
|
||||||
self._command_queue = Queue()
|
self._command_queue = Queue()
|
||||||
|
|
||||||
|
## Reset USB device settings
|
||||||
|
#
|
||||||
|
def resetDeviceSettings(self):
|
||||||
|
self._firmware_name = None
|
||||||
|
|
||||||
## Request the current scene to be sent to a USB-connected printer.
|
## Request the current scene to be sent to a USB-connected printer.
|
||||||
#
|
#
|
||||||
# \param nodes A collection of scene nodes to send. This is ignored.
|
# \param nodes A collection of scene nodes to send. This is ignored.
|
||||||
|
@ -225,6 +230,8 @@ class USBPrinterOutputDevice(PrinterOutputDevice):
|
||||||
self._baud_rate = baud_rate
|
self._baud_rate = baud_rate
|
||||||
|
|
||||||
def connect(self):
|
def connect(self):
|
||||||
|
self._firmware_name = None # after each connection ensure that the frimware name is removed
|
||||||
|
|
||||||
if self._baud_rate is None:
|
if self._baud_rate is None:
|
||||||
if self._use_auto_detect:
|
if self._use_auto_detect:
|
||||||
auto_detect_job = AutoDetectBaudJob(self._serial_port)
|
auto_detect_job = AutoDetectBaudJob(self._serial_port)
|
||||||
|
@ -286,6 +293,9 @@ class USBPrinterOutputDevice(PrinterOutputDevice):
|
||||||
self.sendCommand("M105")
|
self.sendCommand("M105")
|
||||||
self._last_temperature_request = time()
|
self._last_temperature_request = time()
|
||||||
|
|
||||||
|
if self._firmware_name is None:
|
||||||
|
self.sendCommand("M115")
|
||||||
|
|
||||||
if b"ok T:" in line or line.startswith(b"T:") or b"ok B:" in line or line.startswith(b"B:"): # Temperature message. 'T:' for extruder and 'B:' for bed
|
if b"ok T:" in line or line.startswith(b"T:") or b"ok B:" in line or line.startswith(b"B:"): # Temperature message. 'T:' for extruder and 'B:' for bed
|
||||||
extruder_temperature_matches = re.findall(b"T(\d*): ?([\d\.]+) ?\/?([\d\.]+)?", line)
|
extruder_temperature_matches = re.findall(b"T(\d*): ?([\d\.]+) ?\/?([\d\.]+)?", line)
|
||||||
# Update all temperature values
|
# Update all temperature values
|
||||||
|
@ -303,6 +313,9 @@ class USBPrinterOutputDevice(PrinterOutputDevice):
|
||||||
if match[1]:
|
if match[1]:
|
||||||
self._printers[0].updateTargetBedTemperature(float(match[1]))
|
self._printers[0].updateTargetBedTemperature(float(match[1]))
|
||||||
|
|
||||||
|
if b"FIRMWARE_NAME:" in line:
|
||||||
|
self._setFirmwareName(line)
|
||||||
|
|
||||||
if self._is_printing:
|
if self._is_printing:
|
||||||
if line.startswith(b'!!'):
|
if line.startswith(b'!!'):
|
||||||
Logger.log('e', "Printer signals fatal error. Cancelling print. {}".format(line))
|
Logger.log('e', "Printer signals fatal error. Cancelling print. {}".format(line))
|
||||||
|
@ -323,6 +336,18 @@ class USBPrinterOutputDevice(PrinterOutputDevice):
|
||||||
# In some cases of the RS command it needs to be handled differently.
|
# In some cases of the RS command it needs to be handled differently.
|
||||||
self._gcode_position = int(line.split()[1])
|
self._gcode_position = int(line.split()[1])
|
||||||
|
|
||||||
|
def _setFirmwareName(self, name):
|
||||||
|
new_name = re.findall(r"FIRMWARE_NAME:(.*);", str(name))
|
||||||
|
if new_name:
|
||||||
|
self._firmware_name = new_name[0]
|
||||||
|
Logger.log("i", "USB output device Firmware name: %s", self._firmware_name)
|
||||||
|
else:
|
||||||
|
self._firmware_name = "Unknown"
|
||||||
|
Logger.log("i", "Unknown USB output device Firmware name: %s", str(name))
|
||||||
|
|
||||||
|
def getFirmwareName(self):
|
||||||
|
return self._firmware_name
|
||||||
|
|
||||||
def pausePrint(self):
|
def pausePrint(self):
|
||||||
self._paused = True
|
self._paused = True
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,14 @@ class USBPrinterOutputDeviceManager(QObject, OutputDevicePlugin):
|
||||||
# Because the model needs to be created in the same thread as the QMLEngine, we use a signal.
|
# Because the model needs to be created in the same thread as the QMLEngine, we use a signal.
|
||||||
self.addUSBOutputDeviceSignal.connect(self.addOutputDevice)
|
self.addUSBOutputDeviceSignal.connect(self.addOutputDevice)
|
||||||
|
|
||||||
|
Application.getInstance().globalContainerStackChanged.connect(self.updateUSBPrinterOutputDevices)
|
||||||
|
|
||||||
|
# The method updates/reset the USB settings for all connected USB devices
|
||||||
|
def updateUSBPrinterOutputDevices(self):
|
||||||
|
for key, device in self._usb_output_devices.items():
|
||||||
|
if isinstance(device, USBPrinterOutputDevice.USBPrinterOutputDevice):
|
||||||
|
device.resetDeviceSettings()
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
self._check_updates = True
|
self._check_updates = True
|
||||||
self._update_thread.start()
|
self._update_thread.start()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue