mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-08-09 14:55:03 -06:00
Implement preheating hotends for USB printing
This commit is contained in:
parent
70cd6aad53
commit
bc5b5ac283
6 changed files with 89 additions and 17 deletions
|
@ -17,14 +17,23 @@ class ExtruderOutputModel(QObject):
|
|||
targetHotendTemperatureChanged = pyqtSignal()
|
||||
hotendTemperatureChanged = pyqtSignal()
|
||||
activeMaterialChanged = pyqtSignal()
|
||||
isPreheatingChanged = pyqtSignal()
|
||||
|
||||
def __init__(self, printer: "PrinterOutputModel", parent=None):
|
||||
def __init__(self, printer: "PrinterOutputModel", position: int, parent=None):
|
||||
super().__init__(parent)
|
||||
self._printer = printer
|
||||
self._position = position
|
||||
self._target_hotend_temperature = 0
|
||||
self._hotend_temperature = 0
|
||||
self._hotend_id = ""
|
||||
self._active_material = None # type: Optional[MaterialOutputModel]
|
||||
self._is_preheating = False
|
||||
|
||||
def getPrinter(self):
|
||||
return self._printer
|
||||
|
||||
def getPosition(self):
|
||||
return self._position
|
||||
|
||||
@pyqtProperty(QObject, notify = activeMaterialChanged)
|
||||
def activeMaterial(self) -> "MaterialOutputModel":
|
||||
|
@ -68,3 +77,25 @@ class ExtruderOutputModel(QObject):
|
|||
if self._hotend_id != id:
|
||||
self._hotend_id = id
|
||||
self.hotendIDChanged.emit()
|
||||
|
||||
def updateIsPreheating(self, pre_heating):
|
||||
if self._is_preheating != pre_heating:
|
||||
self._is_preheating = pre_heating
|
||||
self.isPreheatingChanged.emit()
|
||||
|
||||
@pyqtProperty(bool, notify=isPreheatingChanged)
|
||||
def isPreheating(self):
|
||||
return self._is_preheating
|
||||
|
||||
## Pre-heats the extruder before printer.
|
||||
#
|
||||
# \param temperature The temperature to heat the extruder to, in degrees
|
||||
# Celsius.
|
||||
# \param duration How long the bed should stay warm, in seconds.
|
||||
@pyqtSlot(float, float)
|
||||
def preheatHotend(self, temperature, duration):
|
||||
self._printer._controller.preheatHotend(self, temperature, duration)
|
||||
|
||||
@pyqtSlot()
|
||||
def cancelPreheatHotend(self):
|
||||
self._printer._controller.cancelPreheatHotend(self)
|
|
@ -15,7 +15,7 @@ class PrinterOutputController:
|
|||
self.can_pause = True
|
||||
self.can_abort = True
|
||||
self.can_pre_heat_bed = True
|
||||
self.can_pre_heat_extruders = True
|
||||
self.can_pre_heat_hotends = True
|
||||
self.can_control_manually = True
|
||||
self._output_device = output_device
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ class PrinterOutputModel(QObject):
|
|||
self._name = ""
|
||||
self._key = "" # Unique identifier
|
||||
self._controller = output_controller
|
||||
self._extruders = [ExtruderOutputModel(printer=self) for i in range(number_of_extruders)]
|
||||
self._extruders = [ExtruderOutputModel(printer=self, position=i) for i in range(number_of_extruders)]
|
||||
self._head_position = Vector(0, 0, 0)
|
||||
self._active_print_job = None # type: Optional[PrintJobOutputModel]
|
||||
self._firmware_version = firmware_version
|
||||
|
@ -220,9 +220,9 @@ class PrinterOutputModel(QObject):
|
|||
|
||||
# Does the printer support pre-heating the bed at all
|
||||
@pyqtProperty(bool, constant=True)
|
||||
def canPreHeatExtruders(self):
|
||||
def canPreHeatHotends(self):
|
||||
if self._controller:
|
||||
return self._controller.can_pre_heat_extruders
|
||||
return self._controller.can_pre_heat_hotends
|
||||
return False
|
||||
|
||||
# Does the printer support pause at all
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue