mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 23:17:32 -06:00
Added heater check
This commit is contained in:
parent
d683a6b77b
commit
f0a358d175
2 changed files with 56 additions and 9 deletions
|
@ -341,6 +341,14 @@ class PrinterConnection(OutputDevice, QObject, SignalEmitter):
|
|||
def isConnected(self):
|
||||
return self._is_connected
|
||||
|
||||
@pyqtSlot(int)
|
||||
def heatupNozzle(self, temperature):
|
||||
self._sendCommand("M104 S%s" % temperature)
|
||||
|
||||
@pyqtSlot(int)
|
||||
def heatupBed(self, temperature):
|
||||
self._sendCommand("M109 S%s" % temperature)
|
||||
|
||||
## Directly send the command, withouth checking connection state (eg; printing).
|
||||
# \param cmd string with g-code
|
||||
def _sendCommand(self, cmd):
|
||||
|
@ -458,6 +466,14 @@ class PrinterConnection(OutputDevice, QObject, SignalEmitter):
|
|||
if line is None:
|
||||
break # None is only returned when something went wrong. Stop listening
|
||||
|
||||
if time.time() > temperature_request_timeout:
|
||||
if self._extruder_count > 0:
|
||||
self._temperature_requested_extruder_index = (self._temperature_requested_extruder_index + 1) % self._extruder_count
|
||||
self.sendCommand("M105 T%d" % (self._temperature_requested_extruder_index))
|
||||
else:
|
||||
self.sendCommand("M105")
|
||||
temperature_request_timeout = time.time() + 5
|
||||
|
||||
if line.startswith(b"Error:"):
|
||||
# Oh YEAH, consistency.
|
||||
# Marlin reports an MIN/MAX temp error as "Error:x\n: Extruder switched off. MAXTEMP triggered !\n"
|
||||
|
@ -487,14 +503,6 @@ class PrinterConnection(OutputDevice, QObject, SignalEmitter):
|
|||
self._setEndstopState(tag,(b'H' in value or b'TRIGGERED' in value))
|
||||
|
||||
if self._is_printing:
|
||||
if time.time() > temperature_request_timeout: # When printing, request temperature every 5 seconds.
|
||||
if self._extruder_count > 0:
|
||||
self._temperature_requested_extruder_index = (self._temperature_requested_extruder_index + 1) % self._extruder_count
|
||||
self.sendCommand("M105 T%d" % (self._temperature_requested_extruder_index))
|
||||
else:
|
||||
self.sendCommand("M105")
|
||||
temperature_request_timeout = time.time() + 5
|
||||
|
||||
if line == b"" and time.time() > ok_timeout:
|
||||
line = b"ok" # Force a timeout (basicly, send next command)
|
||||
|
||||
|
|
|
@ -16,6 +16,8 @@ Column
|
|||
property bool x_min_pressed: false
|
||||
property bool y_min_pressed: false
|
||||
property bool z_min_pressed: false
|
||||
property bool heater_works: false
|
||||
property int extruder_target_temp: 0
|
||||
|
||||
Component.onCompleted: UM.USBPrinterManager.connectedPrinterList.getItem(0).printer.startPollEndstop()
|
||||
|
||||
|
@ -64,6 +66,7 @@ Column
|
|||
text: y_min_pressed ? qsTr("Works") : qsTr("Not checked")
|
||||
}
|
||||
}
|
||||
|
||||
Row
|
||||
{
|
||||
Label
|
||||
|
@ -76,6 +79,34 @@ Column
|
|||
}
|
||||
}
|
||||
|
||||
Row
|
||||
{
|
||||
Label
|
||||
{
|
||||
text: qsTr("Nozzle temperature check: ")
|
||||
}
|
||||
Label
|
||||
{
|
||||
text: UM.USBPrinterManager.connectedPrinterList.getItem(0).printer.extruderTemperature
|
||||
}
|
||||
Button
|
||||
{
|
||||
text: "Start heating"
|
||||
onClicked:
|
||||
{
|
||||
heater_status_label.text = qsTr("Checking")
|
||||
UM.USBPrinterManager.connectedPrinterList.getItem(0).printer.heatupNozzle(190)
|
||||
wizardPage.extruder_target_temp = 190
|
||||
console.log((UM.USBPrinterManager.connectedPrinterList.getItem(0).printer.extruderTemperature < wizardPage.extruder_target_temp + 10))
|
||||
}
|
||||
}
|
||||
Label
|
||||
{
|
||||
id: heater_status_label
|
||||
text: qsTr("Not checked")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Connections
|
||||
{
|
||||
|
@ -95,6 +126,14 @@ Column
|
|||
z_min_pressed = true
|
||||
}
|
||||
}
|
||||
onExtruderTemperatureChanged:
|
||||
{
|
||||
if(UM.USBPrinterManager.connectedPrinterList.getItem(0).printer.extruderTemperature > wizardPage.extruder_target_temp - 10 && UM.USBPrinterManager.connectedPrinterList.getItem(0).printer.extruderTemperature < wizardPage.extruder_target_temp + 10)
|
||||
{
|
||||
heater_status_label.text = qsTr("Works")
|
||||
UM.USBPrinterManager.connectedPrinterList.getItem(0).printer.heatupNozzle(0)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ExclusiveGroup
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue