✨ Support for heated chamber fw capabilities
Chamber temperatures reported via M105 will only be parsed if the fw reports chamber capabilities (through Cap:CHAMBER_TEMPERATURE:1) or the currently selected printer profile has a heated chamber configured. This is to avoid incompatibility issues with firmware variants that might already use the C parameter for something else (which might be the case since we don't have a reliable well defined standard that people need to adhere to...) Chamber temperature commands M141 and M191 will only be allowed to be sent if the selected printer profile has a heated chamber configured. This mirrors the behaviour for the bed temperature commands M140 and M190 and heated bed configuration. Display of chamber data in the graph will only happen if the printer profile has a heated chamber configured. Implements one workflow behind #321
This commit is contained in:
1 parent
b2637eb06a
commit
8d3befb01f
17 files changed
+580
-32
No files matched your search
+156
-3
@@ -22,6 +22,11 @@ Bed
|
||||
corresponding resource returns temperature information including an optional history. Note that Bed commands
|
||||
are only available if the currently selected printer profile has a heated bed.
|
||||
See :ref:`sec-api-printer-bedcommand`.
|
||||
Chamber
|
||||
Chamber commands allow setting the temperature and temperature offset for the printer's heated chamber. Querying
|
||||
the corresponding resource returns temperature information including an option history. Note that Chamber commands
|
||||
are only available if the currently selected printer profile has a heated chamber.
|
||||
See :ref:`sec-api-printer-chambercommand`.
|
||||
SD card
|
||||
SD commands allow initialization, refresh and release of the printer's SD card (if available). Querying the
|
||||
corresponding resource returns the current SD card state.
|
||||
@@ -623,12 +628,12 @@ Issue a bed command
|
||||
are:
|
||||
|
||||
target
|
||||
Sets the given target temperature on the printer's tools. Additional parameters:
|
||||
Sets the given target temperature on the printer's bed. Additional parameters:
|
||||
|
||||
* ``target``: Target temperature to set.
|
||||
|
||||
offset
|
||||
Sets the given temperature offset on the printer's tools. Additional parameters:
|
||||
Sets the given temperature offset on the printer's bed. Additional parameters:
|
||||
|
||||
* ``offset``: Offset to set.
|
||||
|
||||
@@ -710,7 +715,7 @@ Retrieve the current bed state
|
||||
an :http:statuscode:`409`.
|
||||
|
||||
.. note::
|
||||
If you want both tool and bed temperature information at the same time, take a look at
|
||||
If you want tool, bed and chamber temperature information at the same time, take a look at
|
||||
:ref:`Retrieve the current printer state <sec-api-printer-state>`.
|
||||
|
||||
**Example**
|
||||
@@ -760,6 +765,154 @@ Retrieve the current bed state
|
||||
:statuscode 409: If the printer is not operational or the selected printer profile
|
||||
does not have a heated bed.
|
||||
|
||||
.. _sec-api-printer-chambercommand:
|
||||
|
||||
Issue a chamber command
|
||||
=======================
|
||||
|
||||
.. http:post:: /api/printer/bed
|
||||
|
||||
Chamber commands allow setting the temperature and temperature offsets for the printer's heated chamber. Available commands
|
||||
are:
|
||||
|
||||
target
|
||||
Sets the given target temperature on the printer's chamber. Additional parameters:
|
||||
|
||||
* ``target``: Target temperature to set.
|
||||
|
||||
offset
|
||||
Sets the given temperature offset on the printer's chamber. Additional parameters:
|
||||
|
||||
* ``offset``: Offset to set.
|
||||
|
||||
All of these commands may only be sent if the printer is currently operational. Otherwise a :http:statuscode:`409`
|
||||
is returned.
|
||||
|
||||
Upon success, a status code of :http:statuscode:`204` and an empty body is returned.
|
||||
|
||||
If no heated chambed is configured for the currently selected printer profile, the resource will return
|
||||
an :http:statuscode:`409`.
|
||||
|
||||
Requires user rights.
|
||||
|
||||
**Example Target Temperature Request**
|
||||
|
||||
Set the target temperature for the printer's heated chamber to 50°C.
|
||||
|
||||
.. sourcecode:: http
|
||||
|
||||
POST /api/printer/chamber HTTP/1.1
|
||||
Host: example.com
|
||||
Content-Type: application/json
|
||||
X-Api-Key: abcdef...
|
||||
|
||||
{
|
||||
"command": "target",
|
||||
"target": 50
|
||||
}
|
||||
|
||||
.. sourcecode:: http
|
||||
|
||||
HTTP/1.1 204 No Content
|
||||
|
||||
**Example Offset Temperature Request**
|
||||
|
||||
Set the temperature offset for the heated chamber to -5°C.
|
||||
|
||||
.. sourcecode:: http
|
||||
|
||||
POST /api/printer/chamber HTTP/1.1
|
||||
Host: example.com
|
||||
Content-Type: application/json
|
||||
X-Api-Key: abcdef...
|
||||
|
||||
{
|
||||
"command": "offset",
|
||||
"offset": -5
|
||||
}
|
||||
|
||||
.. sourcecode:: http
|
||||
|
||||
HTTP/1.1 204 No Content
|
||||
|
||||
:json string command: The command to issue, either ``target`` or ``offset``.
|
||||
:json object target: ``target`` command: The target temperature to set.
|
||||
:json object offset: ``offset`` command: The offset temperature to set.
|
||||
:statuscode 204: No error
|
||||
:statuscode 400: If ``target`` or ``offset`` is not a valid number or outside of the supported range, or if the
|
||||
request is otherwise invalid.
|
||||
:statuscode 409: If the printer is not operational or the selected printer profile
|
||||
does not have a heated chamber.
|
||||
|
||||
.. _sec-api-printer-chamberstate:
|
||||
|
||||
Retrieve the current chamber state
|
||||
==================================
|
||||
|
||||
.. http:get:: /api/printer/chamber
|
||||
|
||||
Retrieves the current temperature data (actual, target and offset) plus optionally a (limited) history (actual, target,
|
||||
timestamp) for the printer's heated chamber.
|
||||
|
||||
It's also possible to retrieve the temperature history by supplying the ``history`` query parameter set to ``true``. The
|
||||
amount of returned history data points can be limited using the ``limit`` query parameter.
|
||||
|
||||
Returns a :http:statuscode:`200` with a Temperature Response in the body upon success.
|
||||
|
||||
If no heated chamber is configured for the currently selected printer profile, the resource will return
|
||||
an :http:statuscode:`409`.
|
||||
|
||||
.. note::
|
||||
If you want tool, bed and chamber temperature information at the same time, take a look at
|
||||
:ref:`Retrieve the current printer state <sec-api-printer-state>`.
|
||||
|
||||
**Example**
|
||||
|
||||
Query the chamber temperature data and also include the temperature history but limit it to two entries.
|
||||
|
||||
.. sourcecode:: http
|
||||
|
||||
GET /api/printer/chamber?history=true&limit=2 HTTP/1.1
|
||||
Host: example.com
|
||||
X-Api-Key: abcdef...
|
||||
|
||||
.. sourcecode:: http
|
||||
|
||||
HTTP/1.1 200 OK
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"chamber": {
|
||||
"actual": 50.221,
|
||||
"target": 70.0,
|
||||
"offset": 5
|
||||
},
|
||||
"history": [
|
||||
{
|
||||
"time": 1395651928,
|
||||
"chamber": {
|
||||
"actual": 50.221,
|
||||
"target": 70.0
|
||||
}
|
||||
},
|
||||
{
|
||||
"time": 1395651926,
|
||||
"chamber": {
|
||||
"actual": 49.1123,
|
||||
"target": 70.0
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
:query history: If set to ``true`` (or: ``yes``, ``y``, ``1``), history information will be included in the response
|
||||
too. If no ``limit`` parameter is given, all available temperature history data will be returned.
|
||||
:query limit: If set to an integer (``n``), only the last ``n`` data points from the printer's temperature history
|
||||
will be returned. Will be ignored if ``history`` is not enabled.
|
||||
:statuscode 200: No error
|
||||
:statuscode 409: If the printer is not operational or the selected printer profile
|
||||
does not have a heated chamber.
|
||||
|
||||
.. _sec-api-printer-sdcommand:
|
||||
|
||||
Issue an SD command
|
||||
|
||||
@@ -52,6 +52,7 @@ Retrieve all printer profiles
|
||||
"height": 200
|
||||
},
|
||||
"heatedBed": true,
|
||||
"heatedChamber": false,
|
||||
"axes": {
|
||||
"x": {
|
||||
"speed": 6000,
|
||||
@@ -93,6 +94,7 @@ Retrieve all printer profiles
|
||||
"height": 200
|
||||
},
|
||||
"heatedBed": true,
|
||||
"heatedChamber": true,
|
||||
"axes": {
|
||||
"x": {
|
||||
"speed": 6000,
|
||||
@@ -184,6 +186,7 @@ Add a new printer profile
|
||||
"height": 200
|
||||
},
|
||||
"heatedBed": true,
|
||||
"heatedChamber": false,
|
||||
"axes": {
|
||||
"x": {
|
||||
"speed": 6000,
|
||||
@@ -267,6 +270,7 @@ Add a new printer profile
|
||||
"height": 300
|
||||
},
|
||||
"heatedBed": false,
|
||||
"heatedChamber": false,
|
||||
"axes": {
|
||||
"x": {
|
||||
"speed": 6000,
|
||||
@@ -352,6 +356,7 @@ Update an existing printer profile
|
||||
"height": 200
|
||||
},
|
||||
"heatedBed": true,
|
||||
"heatedChamber": false,
|
||||
"axes": {
|
||||
"x": {
|
||||
"speed": 6000,
|
||||
@@ -578,6 +583,10 @@ Profile
|
||||
- 0..1
|
||||
- ``boolean``
|
||||
- Whether the printer has a heated bed (``true``) or not (``false``)
|
||||
* - ``heatedChamber``
|
||||
- 0..1
|
||||
- ``boolean``
|
||||
- Whether the printer has a heated chamber (``true``) or not (``false``)
|
||||
* - ``axes``
|
||||
- 0..1
|
||||
- Object
|
||||
|
||||
@@ -323,6 +323,9 @@ The following settings are only relevant to you if you want to do OctoPrint deve
|
||||
# Whether the simulated printer should also simulate a heated bed or not
|
||||
hasBed: true
|
||||
|
||||
# Whether the simulated printer should also simulate a heated chamber or not
|
||||
hasChamber: false
|
||||
|
||||
# If enabled, reports the set target temperatures as separate messages from the firmware
|
||||
#
|
||||
# True: > M109 S220.0
|
||||
|
||||
@@ -210,6 +210,64 @@
|
||||
:param object opts: Additional options for the request
|
||||
:returns Promise: A `jQuery Promise <http://api.jquery.com/Types/#Promise>`_ for the request's response
|
||||
|
||||
.. js:function:: OctoPrintClient.printer.getChamberState(data, opts)
|
||||
|
||||
Retrieves the current printer chamber state/temperature information, and optionally also the temperature
|
||||
history.
|
||||
|
||||
The ``flags`` object can be used to specify the data to retrieve further via the following
|
||||
properties:
|
||||
|
||||
* ``history``: a boolean value to specify whether the temperature history should be included (``true``)
|
||||
or not (``false``), defaults to it not being included
|
||||
* ``limit``: an integer value to specify how many history entries to include
|
||||
|
||||
See :ref:`Retrieve the current bed state <sec-api-printer-chamberstate>` for more details.
|
||||
|
||||
:param object flags: Flags that further specify which data to retrieve, see above for details
|
||||
:param object opts: Additional options for the request
|
||||
:returns Promise: A `jQuery Promise <http://api.jquery.com/Types/#Promise>`_ for the request's response
|
||||
|
||||
.. js:function:: OctoPrintClient.printer.setChamberTargetTemperature(target, opts)
|
||||
|
||||
Sets the given temperature on the printer's heated chamber (if available).
|
||||
|
||||
``target`` is expected to be the target temperature as a float value.
|
||||
|
||||
**Example:**
|
||||
|
||||
Set the chamber to 50°C.
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
OctoPrint.printer.setChamberTargetTemperature(50.0);
|
||||
|
||||
See the ``target`` command in :ref:`Issue a chamber command <sec-api-printer-chambercommand>` for more details.
|
||||
|
||||
:param float target: The target to set
|
||||
:param object opts: Additional options for the request
|
||||
:returns Promise: A `jQuery Promise <http://api.jquery.com/Types/#Promise>`_ for the request's response
|
||||
|
||||
.. js:function:: OctoPrintClient.printer.setChamberTemperatureOffset(offset, opts)
|
||||
|
||||
Sets the given temperature offset for the printer's heated chamber (if available).
|
||||
|
||||
``offset`` is expected to be the temperature offset to set.
|
||||
|
||||
**Example:**
|
||||
|
||||
Set the offset for the chamber to -5°C.
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
OctoPrint.printer.setChamberTemperatureOffset(-5);
|
||||
|
||||
See the ``offset`` command in :ref:`Issue a chamber command <sec-api-printer-chambercommand>` for more details.
|
||||
|
||||
:param object offsets: The offsets to set
|
||||
:param object opts: Additional options for the request
|
||||
:returns Promise: A `jQuery Promise <http://api.jquery.com/Types/#Promise>`_ for the request's response
|
||||
|
||||
.. js:function:: OctoPrintClient.printer.jog(amounts, opts)
|
||||
|
||||
Jogs the specified axes by the specified ``amounts``.
|
||||
|
||||
@@ -84,6 +84,8 @@ class VirtualPrinter(object):
|
||||
self.targetTemp = [0.0] * self.temperatureCount
|
||||
self.bedTemp = self._ambient_temperature
|
||||
self.bedTargetTemp = 0.0
|
||||
self.chamberTemp = self._ambient_temperature
|
||||
self.chamberTargetTemp = 0.0
|
||||
self.lastTempAt = monotonic_time()
|
||||
|
||||
self._relative = True
|
||||
@@ -459,6 +461,12 @@ class VirtualPrinter(object):
|
||||
def _gcode_M190(self, data):
|
||||
self._parseBedCommand(data, wait=True, support_r=True)
|
||||
|
||||
def _gcode_M141(self, data):
|
||||
self._parseChamberCommand(data)
|
||||
|
||||
def _gcode_M191(self, data):
|
||||
self._parseChamberCommand(data, wait=True, support_r=True)
|
||||
|
||||
def _gcode_M105(self, data):
|
||||
self._processTemperatureQuery()
|
||||
return True
|
||||
@@ -930,6 +938,12 @@ class VirtualPrinter(object):
|
||||
else:
|
||||
allTempsString = "B:%.2f %s" % (self.bedTemp, allTempsString)
|
||||
|
||||
if settings().getBoolean(["devel", "virtualPrinter", "hasChamber"]):
|
||||
if includeTarget:
|
||||
allTempsString = "C:%.2f /%.2f %s" % (self.chamberTemp, self.chamberTargetTemp, allTempsString)
|
||||
else:
|
||||
allTempsString = "C:%.2f %s" % (self.chamberTemp, allTempsString)
|
||||
|
||||
if settings().getBoolean(["devel", "virtualPrinter", "includeCurrentToolInTemps"]):
|
||||
if includeTarget:
|
||||
output = "T:%.2f /%.2f %s" % (self.temp[self.currentExtruder], self.targetTemp[self.currentExtruder], allTempsString)
|
||||
@@ -939,9 +953,28 @@ class VirtualPrinter(object):
|
||||
output = allTempsString
|
||||
else:
|
||||
if includeTarget:
|
||||
output = "T:%.2f /%.2f B:%.2f /%.2f" % (self.temp[0], self.targetTemp[0], self.bedTemp, self.bedTargetTemp)
|
||||
t = "T:%.2f /%.2f" % (self.temp[0], self.targetTemp[0])
|
||||
else:
|
||||
output = "T:%.2f B:%.2f" % (self.temp[0], self.bedTemp)
|
||||
t = "T:%.2f" % self.temp[0]
|
||||
|
||||
if settings().getBoolean(["devel", "virtualPrinter", "hasBed"]):
|
||||
if includeTarget:
|
||||
b = "B:%.2f /%.2f" % (self.bedTemp, self.bedTargetTemp)
|
||||
else:
|
||||
b = "B:%.2f" % self.bedTemp
|
||||
else:
|
||||
b = ""
|
||||
|
||||
if settings().getBoolean(["devel", "virtualPrinter", "hasChamber"]):
|
||||
if includeTarget:
|
||||
c = "C:%.2f /%.2f" % (self.chamberTemp, self.chamberTargetTemp)
|
||||
else:
|
||||
c = "C:%.2f" % self.chamberTemp
|
||||
else:
|
||||
c = ""
|
||||
|
||||
output = t + " " + b + " " + c
|
||||
output = output.strip()
|
||||
|
||||
output += " @:64\n"
|
||||
return output
|
||||
@@ -985,6 +1018,9 @@ class VirtualPrinter(object):
|
||||
self._send("TargetExtr%d:%d" % (tool, self.targetTemp[tool]))
|
||||
|
||||
def _parseBedCommand(self, line, wait=False, support_r=False):
|
||||
if not settings().getBoolean(["devel", "virtualPrinter", "hasBed"]):
|
||||
return
|
||||
|
||||
only_wait_if_higher = True
|
||||
try:
|
||||
self.bedTargetTemp = float(re.search('S([0-9]+)', line).group(1))
|
||||
@@ -1001,6 +1037,24 @@ class VirtualPrinter(object):
|
||||
if settings().getBoolean(["devel", "virtualPrinter", "repetierStyleTargetTemperature"]):
|
||||
self._send("TargetBed:%d" % self.bedTargetTemp)
|
||||
|
||||
def _parseChamberCommand(self, line, wait=False, support_r=False):
|
||||
if not settings().getBoolean(["devel", "virtualPrinter", "hasChamber"]):
|
||||
return
|
||||
|
||||
only_wait_if_higher = True
|
||||
try:
|
||||
self.chamberTargetTemp = float(re.search('S([0-9]+)', line).group(1))
|
||||
except:
|
||||
if support_r:
|
||||
try:
|
||||
self.chamberTargetTemp = float(re.search('R([0-9]+)', line).group(1))
|
||||
only_wait_if_higher = False
|
||||
except:
|
||||
pass
|
||||
|
||||
if wait:
|
||||
self._waitForHeatup("chamber", only_wait_if_higher)
|
||||
|
||||
def _performMove(self, line):
|
||||
matchX = re.search("X([0-9.]+)", line)
|
||||
matchY = re.search("Y([0-9.]+)", line)
|
||||
@@ -1210,6 +1264,9 @@ class VirtualPrinter(object):
|
||||
elif heater == "bed":
|
||||
test = lambda: self.bedTemp < self.bedTargetTemp - delta or (not only_wait_if_higher and self.bedTemp > self.bedTargetTemp + delta)
|
||||
output = lambda: "B:%0.2f" % self.bedTemp
|
||||
elif heater == "chamber":
|
||||
test = lambda: self.chamberTemp < self.chamberTargetTemp - delta or (not only_wait_if_higher and self.chamberTemp > self.chamberTargetTemp + delta)
|
||||
output = lambda: "C:%0.2f" % self.chamberTemp
|
||||
else:
|
||||
return
|
||||
|
||||
@@ -1261,6 +1318,7 @@ class VirtualPrinter(object):
|
||||
continue
|
||||
self.temp[i] = simulate(self.temp[i], self.targetTemp[i], self._ambient_temperature)
|
||||
self.bedTemp = simulate(self.bedTemp, self.bedTargetTemp, self._ambient_temperature)
|
||||
self.chamberTemp = simulate(self.chamberTemp, self.chamberTargetTemp, self._ambient_temperature)
|
||||
|
||||
def _processBuffer(self):
|
||||
while self.buffered is not None:
|
||||
|
||||
@@ -47,7 +47,7 @@ class PrinterInterface(object):
|
||||
valid_tool_regex = re.compile("^(tool\d+)$")
|
||||
"""Regex for valid tool identifiers."""
|
||||
|
||||
valid_heater_regex = re.compile("^(tool\d+|bed)$")
|
||||
valid_heater_regex = re.compile("^(tool\d+|bed|chamber)$")
|
||||
"""Regex for valid heater identifiers."""
|
||||
|
||||
@classmethod
|
||||
|
||||
@@ -66,6 +66,9 @@ A printer profile is a ``dict`` of the following structure:
|
||||
* - ``heatedBed``
|
||||
- ``bool``
|
||||
- Whether the printer has a heated bed (``True``) or not (``False``)
|
||||
* - ``heatedChamber``
|
||||
- ``bool``
|
||||
- Whether the printer has a heated chamber (``True``) or not (``False``)
|
||||
* - ``extruder``
|
||||
- ``dict``
|
||||
- Information about the printer's extruders
|
||||
@@ -218,6 +221,7 @@ class PrinterProfileManager(object):
|
||||
custom_box = False
|
||||
),
|
||||
heatedBed = True,
|
||||
heatedChamber = False,
|
||||
extruder=dict(
|
||||
count = 1,
|
||||
offsets = [
|
||||
@@ -509,6 +513,10 @@ class PrinterProfileManager(object):
|
||||
profile["extruder"]["offsets"] = [(0.0, 0.0)]
|
||||
modified = True
|
||||
|
||||
if not "heatedChamber" in profile:
|
||||
profile["heatedChamber"] = False
|
||||
modified = True
|
||||
|
||||
return modified
|
||||
|
||||
def _ensure_valid_profile(self, profile):
|
||||
|
||||
@@ -394,11 +394,13 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
|
||||
|
||||
def set_temperature(self, heater, value, *args, **kwargs):
|
||||
if not PrinterInterface.valid_heater_regex.match(heater):
|
||||
raise ValueError("heater must match \"tool[0-9]+\" or \"bed\": {heater}".format(heater=heater))
|
||||
raise ValueError("heater must match \"tool[0-9]+\", \"bed\" or \"chamber\": {heater}".format(heater=heater))
|
||||
|
||||
if not isinstance(value, (int, long, float)) or value < 0:
|
||||
raise ValueError("value must be a valid number >= 0: {value}".format(value=value))
|
||||
|
||||
tags = kwargs.get("tags", set()) | {"trigger:printer.set_temperature"}
|
||||
|
||||
if heater.startswith("tool"):
|
||||
printer_profile = self._printerProfileManager.get_current_or_default()
|
||||
extruder_count = printer_profile["extruder"]["count"]
|
||||
@@ -406,14 +408,18 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
|
||||
if extruder_count > 1 and not shared_nozzle:
|
||||
toolNum = int(heater[len("tool"):])
|
||||
self.commands("M104 T{} S{}".format(toolNum, value),
|
||||
tags=kwargs.get("tags", set()) | {"trigger:printer.set_temperature"})
|
||||
tags=tags)
|
||||
else:
|
||||
self.commands("M104 S{}".format(value),
|
||||
tags=kwargs.get("tags", set()) | {"trigger:printer.set_temperature"})
|
||||
tags=tags)
|
||||
|
||||
elif heater == "bed":
|
||||
self.commands("M140 S{}".format(value),
|
||||
tags=kwargs.get("tags", set()) | {"trigger:printer.set_temperature"})
|
||||
tags=tags)
|
||||
|
||||
elif heater == "chamber":
|
||||
self.commands("M141 S{}".format(value),
|
||||
tags=tags)
|
||||
|
||||
def set_temperature_offset(self, offsets=None, *args, **kwargs):
|
||||
if offsets is None:
|
||||
@@ -614,6 +620,12 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
|
||||
"target": self._bedTemp[1],
|
||||
"offset": offsets["bed"] if "bed" in offsets and offsets["bed"] is not None else 0
|
||||
}
|
||||
if self._chamberTemp is not None:
|
||||
result["chamber"] = {
|
||||
"actual": self._chamberTemp[0],
|
||||
"target": self._chamberTemp[1],
|
||||
"offset": offsets["chamber"] if "chamber" in offsets and offsets["chamber"] is not None else 0
|
||||
}
|
||||
|
||||
return result
|
||||
|
||||
@@ -853,7 +865,7 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
|
||||
printTimeLeft=int(printTimeLeft) if printTimeLeft is not None else None,
|
||||
printTimeLeftOrigin=printTimeLeftOrigin)
|
||||
|
||||
def _addTemperatureData(self, tools=None, bed=None):
|
||||
def _addTemperatureData(self, tools=None, bed=None, chamber=None):
|
||||
if tools is None:
|
||||
tools = dict()
|
||||
|
||||
@@ -862,11 +874,14 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
|
||||
data["tool%d" % tool] = self._dict(actual=tools[tool][0], target=tools[tool][1])
|
||||
if bed is not None and isinstance(bed, tuple):
|
||||
data["bed"] = self._dict(actual=bed[0], target=bed[1])
|
||||
if chamber is not None and isinstance(chamber, tuple):
|
||||
data["chamber"] = self._dict(actual=chamber[0], target=chamber[1])
|
||||
|
||||
self._temps.append(data)
|
||||
|
||||
self._temp = tools
|
||||
self._bedTemp = bed
|
||||
self._chamberTemp = chamber
|
||||
|
||||
self._stateMonitor.add_temperature(self._dict(**data))
|
||||
|
||||
@@ -1015,8 +1030,8 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
|
||||
"""
|
||||
self._addLog(to_unicode(message, "utf-8", errors="replace"))
|
||||
|
||||
def on_comm_temperature_update(self, temp, bedTemp):
|
||||
self._addTemperatureData(tools=copy.deepcopy(temp), bed=copy.deepcopy(bedTemp))
|
||||
def on_comm_temperature_update(self, temp, bedTemp, chamberTemp):
|
||||
self._addTemperatureData(tools=copy.deepcopy(temp), bed=copy.deepcopy(bedTemp), chamber=copy.deepcopy(chamberTemp))
|
||||
|
||||
def on_comm_position_update(self, position, reason=None):
|
||||
payload = dict(reason=reason)
|
||||
|
||||
@@ -211,7 +211,71 @@ def printerBedState():
|
||||
if not printerProfileManager.get_current_or_default()["heatedBed"]:
|
||||
return make_response("Printer does not have a heated bed", 409)
|
||||
|
||||
data = _get_temperature_data(_delete_tools)
|
||||
data = _get_temperature_data(_keep_bed)
|
||||
if isinstance(data, Response):
|
||||
return data
|
||||
else:
|
||||
return jsonify(data)
|
||||
|
||||
|
||||
##~~ Heated chamber
|
||||
|
||||
|
||||
@api.route("/printer/chamber", methods=["POST"])
|
||||
@restricted_access
|
||||
def printerChamberCommand():
|
||||
if not printer.is_operational():
|
||||
return make_response("Printer is not operational", 409)
|
||||
|
||||
if not printerProfileManager.get_current_or_default()["heatedChamber"]:
|
||||
return make_response("Printer does not have a heated chamber", 409)
|
||||
|
||||
valid_commands = {
|
||||
"target": ["target"],
|
||||
"offset": ["offset"]
|
||||
}
|
||||
command, data, response = get_json_command_from_request(request, valid_commands)
|
||||
if response is not None:
|
||||
return response
|
||||
|
||||
tags = {"source:api", "api:printer.chamber"}
|
||||
|
||||
##~~ temperature
|
||||
if command == "target":
|
||||
target = data["target"]
|
||||
|
||||
# make sure the target is a number
|
||||
if not isinstance(target, (int, long, float)):
|
||||
return make_response("Not a number: %r" % target, 400)
|
||||
|
||||
# perform the actual temperature command
|
||||
printer.set_temperature("chamber", target, tags=tags)
|
||||
|
||||
##~~ temperature offset
|
||||
elif command == "offset":
|
||||
offset = data["offset"]
|
||||
|
||||
# make sure the offset is valid
|
||||
if not isinstance(offset, (int, long, float)):
|
||||
return make_response("Not a number: %r" % offset, 400)
|
||||
if not -50 <= offset <= 50:
|
||||
return make_response("Offset not in range [-50, 50]: %f" % offset, 400)
|
||||
|
||||
# set the offsets
|
||||
printer.set_temperature_offset({"chamber": offset})
|
||||
|
||||
return NO_CONTENT
|
||||
|
||||
|
||||
@api.route("/printer/chamber", methods=["GET"])
|
||||
def printerChamberState():
|
||||
if not printer.is_operational():
|
||||
return make_response("Printer is not operational", 409)
|
||||
|
||||
if not printerProfileManager.get_current_or_default()["heatedChamber"]:
|
||||
return make_response("Printer does not have a heated chamber", 409)
|
||||
|
||||
data = _get_temperature_data(_keep_chamber)
|
||||
if isinstance(data, Response):
|
||||
return data
|
||||
else:
|
||||
@@ -412,12 +476,16 @@ def _get_temperature_data(preprocessor):
|
||||
return preprocessor(tempData)
|
||||
|
||||
|
||||
def _delete_tools(x):
|
||||
return _delete_from_data(x, lambda k: k.startswith("tool"))
|
||||
def _keep_tools(x):
|
||||
return _delete_from_data(x, lambda k: not k.startswith("tool"))
|
||||
|
||||
|
||||
def _delete_bed(x):
|
||||
return _delete_from_data(x, lambda k: k == "bed")
|
||||
def _keep_bed(x):
|
||||
return _delete_from_data(x, lambda k: k != "bed")
|
||||
|
||||
|
||||
def _keep_chamber(x):
|
||||
return _delete_from_data(x, lambda k: k != "chamber")
|
||||
|
||||
|
||||
def _delete_from_data(x, key_matcher):
|
||||
|
||||
@@ -397,6 +397,7 @@ default_settings = {
|
||||
"includeCurrentToolInTemps": True,
|
||||
"includeFilenameInOpened": True,
|
||||
"hasBed": True,
|
||||
"hasChamber": False,
|
||||
"repetierStyleTargetTemperature": False,
|
||||
"okBeforeCommandOutput": False,
|
||||
"smoothieTemperatureReporting": False,
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
var printheadUrl = url + "/printhead";
|
||||
var toolUrl = url + "/tool";
|
||||
var bedUrl = url + "/bed";
|
||||
var chamberUrl = url + "/chamber";
|
||||
var sdUrl = url + "/sd";
|
||||
|
||||
var OctoPrintPrinterClient = function(base) {
|
||||
@@ -27,6 +28,10 @@
|
||||
return this.base.issueCommand(bedUrl, command, payload, opts);
|
||||
};
|
||||
|
||||
OctoPrintPrinterClient.prototype.issueChamberCommand = function (command, payload, opts) {
|
||||
return this.base.issueCommand(chamberUrl, command, payload, opts);
|
||||
};
|
||||
|
||||
OctoPrintPrinterClient.prototype.issueSdCommand = function (command, payload, opts) {
|
||||
return this.base.issueCommand(sdUrl, command, payload, opts);
|
||||
};
|
||||
@@ -90,6 +95,23 @@
|
||||
return this.base.get(getUrl, opts);
|
||||
};
|
||||
|
||||
OctoPrintPrinterClient.prototype.getChamberState = function (flags, opts) {
|
||||
flags = flags || {};
|
||||
|
||||
var history = flags.history || undefined;
|
||||
var limit = flags.limit || undefined;
|
||||
|
||||
var getUrl = chamberUrl;
|
||||
if (history) {
|
||||
getUrl += "?history=true";
|
||||
if (limit) {
|
||||
getUrl += "&limit=" + limit;
|
||||
}
|
||||
}
|
||||
|
||||
return this.base.get(getUrl, opts);
|
||||
};
|
||||
|
||||
OctoPrintPrinterClient.prototype.getSdState = function (opts) {
|
||||
return this.base.get(sdUrl, opts);
|
||||
};
|
||||
@@ -198,6 +220,26 @@
|
||||
return this.issueBedCommand("offset", payload, opts);
|
||||
};
|
||||
|
||||
OctoPrintPrinterClient.prototype.setChamberTargetTemperature = function (target, opts) {
|
||||
target = target || 0;
|
||||
|
||||
var payload = {
|
||||
target: target
|
||||
};
|
||||
|
||||
return this.issueChamberCommand("target", payload, opts);
|
||||
};
|
||||
|
||||
OctoPrintPrinterClient.prototype.setChamberTemperatureOffset = function (offset, opts) {
|
||||
offset = offset || 0;
|
||||
|
||||
var payload = {
|
||||
offset: offset
|
||||
};
|
||||
|
||||
return this.issueChamberCommand("offset", payload, opts);
|
||||
};
|
||||
|
||||
OctoPrintPrinterClient.prototype.initSd = function (opts) {
|
||||
return this.issueSdCommand("init", {}, opts);
|
||||
};
|
||||
|
||||
@@ -14,6 +14,7 @@ $(function() {
|
||||
custom_box: false
|
||||
},
|
||||
heatedBed: true,
|
||||
heatedChamber: false,
|
||||
axes: {
|
||||
x: {speed: 6000, inverted: false},
|
||||
y: {speed: 6000, inverted: false},
|
||||
@@ -60,6 +61,7 @@ $(function() {
|
||||
});
|
||||
|
||||
self.heatedBed = ko.observable();
|
||||
self.heatedChamber = ko.observable();
|
||||
|
||||
self.nozzleDiameter = ko.observable();
|
||||
self.extruders = ko.observable();
|
||||
@@ -209,6 +211,7 @@ $(function() {
|
||||
}
|
||||
|
||||
self.heatedBed(data.heatedBed);
|
||||
self.heatedChamber(data.heatedChamber);
|
||||
|
||||
self.nozzleDiameter(data.extruder.nozzleDiameter);
|
||||
self.sharedNozzle(data.extruder.sharedNozzle);
|
||||
@@ -269,6 +272,7 @@ $(function() {
|
||||
origin: self.volumeOrigin()
|
||||
},
|
||||
heatedBed: self.heatedBed(),
|
||||
heatedChamber: self.heatedChamber(),
|
||||
extruder: {
|
||||
count: parseInt(self.extruders()),
|
||||
offsets: [
|
||||
|
||||
@@ -297,7 +297,7 @@ $(function() {
|
||||
});
|
||||
|
||||
self.addTemperatureProfile = function() {
|
||||
self.temperature_profiles.push({name: "New", extruder:0, bed:0});
|
||||
self.temperature_profiles.push({name: "New", extruder:0, bed:0, chamber:0});
|
||||
};
|
||||
|
||||
self.removeTemperatureProfile = function(profile) {
|
||||
@@ -818,7 +818,8 @@ $(function() {
|
||||
result.push({
|
||||
name: profile.name,
|
||||
extruder: Math.floor(_.isNumber(profile.extruder) ? profile.extruder : parseInt(profile.extruder)),
|
||||
bed: Math.floor(_.isNumber(profile.bed) ? profile.bed : parseInt(profile.bed))
|
||||
bed: Math.floor(_.isNumber(profile.bed) ? profile.bed : parseInt(profile.bed)),
|
||||
chamber: Math.floor(_.isNumber(profile.chamber) ? profile.chamber : (_.isNumber(parseInt(profile.chamber)) ? parseInt(profile.chamber) : 0))
|
||||
});
|
||||
} catch (ex) {
|
||||
// ignore
|
||||
|
||||
@@ -70,11 +70,16 @@ $(function() {
|
||||
self.tools = ko.observableArray([]);
|
||||
|
||||
self.hasBed = ko.observable(true);
|
||||
self.hasChamber = ko.observable(false);
|
||||
|
||||
self.bedTemp = self._createToolEntry();
|
||||
self.bedTemp["name"](gettext("Bed"));
|
||||
self.bedTemp["key"]("bed");
|
||||
|
||||
self.chamberTemp = self._createToolEntry();
|
||||
self.chamberTemp["name"](gettext("Chamber"));
|
||||
self.chamberTemp["key"]("chamber");
|
||||
|
||||
self.isErrorOrClosed = ko.observable(undefined);
|
||||
self.isOperational = ko.observable(undefined);
|
||||
self.isPrinting = ko.observable(undefined);
|
||||
@@ -135,6 +140,14 @@ $(function() {
|
||||
self.hasBed(false);
|
||||
}
|
||||
|
||||
// heated chamber
|
||||
if (currentProfileData && currentProfileData.heatedChamber()) {
|
||||
self.hasChamber(true);
|
||||
heaterOptions["chamber"] = {name: gettext("Chamber"), color: "black"};
|
||||
} else {
|
||||
self.hasChamber(false);
|
||||
}
|
||||
|
||||
// write back
|
||||
self.heaterOptions(heaterOptions);
|
||||
self.tools(tools);
|
||||
@@ -149,6 +162,7 @@ $(function() {
|
||||
self.settingsViewModel.printerProfiles.currentProfileData().extruder.count.subscribe(self._printerProfileUpdated);
|
||||
self.settingsViewModel.printerProfiles.currentProfileData().extruder.sharedNozzle.subscribe(self._printerProfileUpdated);
|
||||
self.settingsViewModel.printerProfiles.currentProfileData().heatedBed.subscribe(self._printerProfileUpdated);
|
||||
self.settingsViewModel.printerProfiles.currentProfileData().heatedChamber.subscribe(self._printerProfileUpdated);
|
||||
});
|
||||
|
||||
self.temperatures = [];
|
||||
@@ -224,6 +238,14 @@ $(function() {
|
||||
self.bedTemp["target"](0);
|
||||
}
|
||||
|
||||
if (lastData.hasOwnProperty("chamber")) {
|
||||
self.chamberTemp["actual"](lastData.chamber.actual);
|
||||
self.chamberTemp["target"](lastData.chamber.target);
|
||||
} else {
|
||||
self.chamberTemp["actual"](0);
|
||||
self.chamberTemp["target"](0);
|
||||
}
|
||||
|
||||
if (!CONFIG_TEMPERATURE_GRAPH) return;
|
||||
|
||||
self.temperatures = self._processTemperatureData(serverTime, data, self.temperatures);
|
||||
@@ -250,6 +272,12 @@ $(function() {
|
||||
} else {
|
||||
self.bedTemp["offset"](0);
|
||||
}
|
||||
|
||||
if (data.hasOwnProperty("chamber")) {
|
||||
self.chamberTemp["offset"](data["chamber"]);
|
||||
} else {
|
||||
self.chamberTemp["offset"](0);
|
||||
}
|
||||
};
|
||||
|
||||
self._processTemperatureData = function(serverTime, data, result) {
|
||||
@@ -295,6 +323,27 @@ $(function() {
|
||||
return result;
|
||||
};
|
||||
|
||||
self.profileText = function(heater, profile) {
|
||||
var text = gettext("Set %(name)s (%(value)s)");
|
||||
|
||||
var value;
|
||||
if (heater.key() === "bed") {
|
||||
value = profile.bed;
|
||||
} else if (heater.key() === "chamber") {
|
||||
value = profile.chamber;
|
||||
} else {
|
||||
value = profile.extruder;
|
||||
}
|
||||
|
||||
if (value === 0 || value === undefined) {
|
||||
value = gettext("Off");
|
||||
} else {
|
||||
value = "" + value + "°C";
|
||||
}
|
||||
|
||||
return _.sprintf(text, {name: profile.name, value: value});
|
||||
};
|
||||
|
||||
self.updatePlot = function() {
|
||||
var graph = $("#temperature-graph");
|
||||
if (!graph.length) return; // no graph
|
||||
@@ -560,7 +609,18 @@ $(function() {
|
||||
if (!profile) return OctoPrintClient.createRejectedDeferred();
|
||||
|
||||
self.clearAutosendTarget(item);
|
||||
return self.setTargetToValue(item, (item.key() === "bed" ? profile.bed : profile.extruder));
|
||||
|
||||
var target;
|
||||
if (item.key() === "bed") {
|
||||
target = profile.bed;
|
||||
} else if (item.key() === "chamber") {
|
||||
target = profile.chamber;
|
||||
} else {
|
||||
target = profile.extruder;
|
||||
}
|
||||
|
||||
if (target === undefined) target = 0;
|
||||
return self.setTargetToValue(item, target);
|
||||
};
|
||||
|
||||
self.setTargetToZero = function(item) {
|
||||
@@ -587,6 +647,9 @@ $(function() {
|
||||
if (item.key() === "bed") {
|
||||
return self._setBedTemperature(value)
|
||||
.done(onSuccess);
|
||||
} else if (item.key() === "chamber") {
|
||||
return self._setChamberTemperature(value)
|
||||
.done(onSuccess);
|
||||
} else {
|
||||
return self._setToolTemperature(item.key(), value)
|
||||
.done(onSuccess);
|
||||
@@ -674,6 +737,9 @@ $(function() {
|
||||
if (item.key() === "bed") {
|
||||
return self._setBedOffset(value)
|
||||
.done(onSuccess);
|
||||
} else if (item.key() === "chamber") {
|
||||
return self._setChamberOffset(value)
|
||||
.done(onSuccess);
|
||||
} else {
|
||||
return self._setToolOffset(item.key(), value)
|
||||
.done(onSuccess);
|
||||
@@ -700,6 +766,14 @@ $(function() {
|
||||
return OctoPrint.printer.setBedTemperatureOffset(parseInt(offset));
|
||||
};
|
||||
|
||||
self._setChamberTemperature = function(temperature) {
|
||||
return OctoPrint.printer.setChamberTargetTemperature(parseInt(temperature));
|
||||
};
|
||||
|
||||
self._setChamberOffset = function(offset) {
|
||||
return OctoPrint.printer.setChamberTemperatureOffset(parseInt(offset));
|
||||
};
|
||||
|
||||
self._replaceLegendLabel = function(index, series, value, emph) {
|
||||
var showFahrenheit = self._shallShowFahrenheit();
|
||||
|
||||
|
||||
+6
@@ -23,6 +23,12 @@
|
||||
<input type="checkbox" data-bind="checked: heatedBed">
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label">{{ _('Heated Chamber') }}</label>
|
||||
<div class="controls">
|
||||
<input type="checkbox" data-bind="checked: heatedChamber">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
<tr data-bind="template: { name: 'temprow-template' }"></tr>
|
||||
<!-- /ko -->
|
||||
<tr data-bind="template: { name: 'temprow-template', data: bedTemp }, visible: hasBed"></tr>
|
||||
<tr data-bind="template: { name: 'temprow-template', data: chamberTemp }, visible: hasChamber"></tr>
|
||||
</table>
|
||||
|
||||
<script type="text/html" id="temprow-template">
|
||||
@@ -41,7 +42,7 @@
|
||||
<li class="divider"></li>
|
||||
<!-- ko foreach: $root.temperature_profiles -->
|
||||
<li>
|
||||
<a href="javascript:void(0)" data-bind="click: function() {$root.setTargetFromProfile($parent, $data);}, text: 'Set ' + name + ' (' + ($parent.key() == 'bed' ? bed : extruder) + '°C)'"></a>
|
||||
<a href="javascript:void(0)" data-bind="click: function() { $root.setTargetFromProfile($parent, $data);}, text: $root.profileText($parent, $data)"></a>
|
||||
</li>
|
||||
<!-- /ko -->
|
||||
</ul>
|
||||
|
||||
+57
-10
@@ -98,7 +98,7 @@ Groups will be as follows:
|
||||
* ``size``: size of the file in bytes (int)
|
||||
"""
|
||||
|
||||
regex_temp = re.compile("(?P<tool>B|T(?P<toolnum>\d*)):\s*(?P<actual>%s)(\s*\/?\s*(?P<target>%s))?" % (regex_float_pattern, regex_float_pattern))
|
||||
regex_temp = re.compile("(?P<tool>B|C|T(?P<toolnum>\d*)):\s*(?P<actual>%s)(\s*\/?\s*(?P<target>%s))?" % (regex_float_pattern, regex_float_pattern))
|
||||
"""Regex matching temperature entries in line.
|
||||
|
||||
Groups will be as follows:
|
||||
@@ -275,6 +275,7 @@ class TemperatureRecord(object):
|
||||
def __init__(self):
|
||||
self._tools = dict()
|
||||
self._bed = (None, None)
|
||||
self._chamber = (None, None)
|
||||
|
||||
def copy_from(self, other):
|
||||
self._tools = other.tools
|
||||
@@ -288,6 +289,10 @@ class TemperatureRecord(object):
|
||||
current = self._bed
|
||||
self._bed = self._to_new_tuple(current, actual, target)
|
||||
|
||||
def set_chamber(self, actual=None, target=None):
|
||||
current = self._chamber
|
||||
self._chamber = self._to_new_tuple(current, actual, target)
|
||||
|
||||
@property
|
||||
def tools(self):
|
||||
return dict(self._tools)
|
||||
@@ -296,6 +301,10 @@ class TemperatureRecord(object):
|
||||
def bed(self):
|
||||
return self._bed
|
||||
|
||||
@property
|
||||
def chamber(self):
|
||||
return self._chamber
|
||||
|
||||
def as_script_dict(self):
|
||||
result = dict()
|
||||
|
||||
@@ -308,6 +317,10 @@ class TemperatureRecord(object):
|
||||
result["b"] = dict(actual=bed[0],
|
||||
target=bed[1])
|
||||
|
||||
chamber = self.chamber
|
||||
result["c"] = dict(actual=chamber[0],
|
||||
target=chamber[1])
|
||||
|
||||
return result
|
||||
|
||||
@classmethod
|
||||
@@ -357,6 +370,7 @@ class MachineCom(object):
|
||||
CAPABILITY_AUTOREPORT_SD_STATUS = "AUTOREPORT_SD_STATUS"
|
||||
CAPABILITY_BUSY_PROTOCOL = "BUSY_PROTOCOL"
|
||||
CAPABILITY_EMERGENCY_PARSER = "EMERGENCY_PARSER"
|
||||
CAPABILITY_CHAMBER_TEMP = "CHAMBER_TEMPERATURE"
|
||||
|
||||
CAPABILITY_SUPPORT_ENABLED = "enabled"
|
||||
CAPABILITY_SUPPORT_DETECTED = "detected"
|
||||
@@ -444,7 +458,8 @@ class MachineCom(object):
|
||||
self.CAPABILITY_AUTOREPORT_TEMP: settings().getBoolean(["serial", "capabilities", "autoreport_temp"]),
|
||||
self.CAPABILITY_AUTOREPORT_SD_STATUS: settings().getBoolean(["serial", "capabilities", "autoreport_sdstatus"]),
|
||||
self.CAPABILITY_BUSY_PROTOCOL: settings().getBoolean(["serial", "capabilities", "busy_protocol"]),
|
||||
self.CAPABILITY_EMERGENCY_PARSER: settings().getBoolean(["serial", "capabilities", "emergency_parser"])
|
||||
self.CAPABILITY_EMERGENCY_PARSER: settings().getBoolean(["serial", "capabilities", "emergency_parser"]),
|
||||
self.CAPABILITY_CHAMBER_TEMP: settings().getBoolean(["serial", "capabilities", "chamber_temp"])
|
||||
}
|
||||
|
||||
self._lastLines = deque([], 50)
|
||||
@@ -585,6 +600,9 @@ class MachineCom(object):
|
||||
def _active(self):
|
||||
return self._monitoring_active and self._send_queue_active
|
||||
|
||||
def _capability_supported(self, cap):
|
||||
return self._capability_support.get(cap, False) and self._firmware_capabilities.get(cap, False)
|
||||
|
||||
##~~ internal state management
|
||||
|
||||
def _changeState(self, newState):
|
||||
@@ -1508,6 +1526,11 @@ class MachineCom(object):
|
||||
actual, target = parsedTemps["B"]
|
||||
self.last_temperature.set_bed(actual=actual, target=target)
|
||||
|
||||
# chamber temperature
|
||||
if "C" in parsedTemps and (self._capability_supported(self.CAPABILITY_CHAMBER_TEMP) or self._printerProfileManager.get_current_or_default()["heatedChamber"]):
|
||||
actual, target = parsedTemps["C"]
|
||||
self.last_temperature.set_chamber(actual=actual, target=target)
|
||||
|
||||
##~~ Serial monitor processing received messages
|
||||
|
||||
def _monitor(self):
|
||||
@@ -1772,7 +1795,7 @@ class MachineCom(object):
|
||||
self._heatupWaitStartTime = monotonic_time()
|
||||
|
||||
self._processTemperatures(line)
|
||||
self._callback.on_comm_temperature_update(self.last_temperature.tools, self.last_temperature.bed)
|
||||
self._callback.on_comm_temperature_update(self.last_temperature.tools, self.last_temperature.bed, self.last_temperature.chamber)
|
||||
|
||||
elif supportRepetierTargetTemp and ('TargetExtr' in line or 'TargetBed' in line):
|
||||
matchExtr = regex_repetierTempExtr.match(line)
|
||||
@@ -1783,14 +1806,14 @@ class MachineCom(object):
|
||||
try:
|
||||
target = float(matchExtr.group(2))
|
||||
self.last_temperature.set_tool(toolNum, target=target)
|
||||
self._callback.on_comm_temperature_update(self.last_temperature.tools, self.last_temperature.bed)
|
||||
self._callback.on_comm_temperature_update(self.last_temperature.tools, self.last_temperature.bed, self.last_temperature.chamber)
|
||||
except ValueError:
|
||||
pass
|
||||
elif matchBed is not None:
|
||||
try:
|
||||
target = float(matchBed.group(1))
|
||||
self.last_temperature.set_bed(target=target)
|
||||
self._callback.on_comm_temperature_update(self.last_temperature.tools, self.last_temperature.bed)
|
||||
self._callback.on_comm_temperature_update(self.last_temperature.tools, self.last_temperature.bed, self.last_temperature.chamber)
|
||||
except ValueError:
|
||||
pass
|
||||
|
||||
@@ -3450,6 +3473,12 @@ class MachineCom(object):
|
||||
return None, # Don't send bed commands if we don't have a heated bed
|
||||
_gcode_M190_queuing = _gcode_M140_queuing
|
||||
|
||||
def _gcode_M141_queuing(self, cmd, cmd_type=None, gcode=None, subcode=None, *args, **kwargs):
|
||||
if not self._printerProfileManager.get_current_or_default()["heatedChamber"]:
|
||||
self._log("Warn: Not sending \"{}\", printer profile has no heated chamber".format(cmd))
|
||||
return None, # Don't send chamber commands if we don't have a heated chamber
|
||||
_gcode_M191_queuing = _gcode_M141_queuing
|
||||
|
||||
def _gcode_M104_sent(self, cmd, cmd_type=None, gcode=None, subcode=None, wait=False, support_r=False, *args, **kwargs):
|
||||
toolNum = self._currentTool
|
||||
toolMatch = regexes_parameters["intT"].search(cmd)
|
||||
@@ -3469,7 +3498,7 @@ class MachineCom(object):
|
||||
try:
|
||||
target = float(match.group("value"))
|
||||
self.last_temperature.set_tool(toolNum, target=target)
|
||||
self._callback.on_comm_temperature_update(self.last_temperature.tools, self.last_temperature.bed)
|
||||
self._callback.on_comm_temperature_update(self.last_temperature.tools, self.last_temperature.bed, self.last_temperature.chamber)
|
||||
except ValueError:
|
||||
pass
|
||||
|
||||
@@ -3482,7 +3511,20 @@ class MachineCom(object):
|
||||
try:
|
||||
target = float(match.group("value"))
|
||||
self.last_temperature.set_bed(target=target)
|
||||
self._callback.on_comm_temperature_update(self.last_temperature.tools, self.last_temperature.bed)
|
||||
self._callback.on_comm_temperature_update(self.last_temperature.tools, self.last_temperature.bed, self.last_temperature.chamber)
|
||||
except ValueError:
|
||||
pass
|
||||
|
||||
def _gcode_M141_sent(self, cmd, cmd_type=None, gcode=None, subcode=None, wait=False, support_r=False, *args, **kwargs):
|
||||
match = regexes_parameters["floatS"].search(cmd)
|
||||
if not match and support_r:
|
||||
match = regexes_parameters["floatR"].search(cmd)
|
||||
|
||||
if match:
|
||||
try:
|
||||
target = float(match.group("value"))
|
||||
self.last_temperature.set_chamber(target=target)
|
||||
self._callback.on_comm_temperature_update(self.last_temperature.tools, self.last_temperature.bed, self.last_temperature.chamber)
|
||||
except ValueError:
|
||||
pass
|
||||
|
||||
@@ -3498,6 +3540,12 @@ class MachineCom(object):
|
||||
self._heating = True
|
||||
self._gcode_M140_sent(cmd, cmd_type, wait=True, support_r=True)
|
||||
|
||||
def _gcode_M191_sent(self, cmd, cmd_type=None, gcode=None, subcode=None, *args, **kwargs):
|
||||
self._heatupWaitStartTime = monotonic_time()
|
||||
self._log_running_command = True
|
||||
self._heating = True
|
||||
self._gcode_M141_sent(cmd, cmd_type, wait=True, support_r=True)
|
||||
|
||||
def _gcode_M116_sent(self, cmd, cmd_type=None, gcode=None, subcode=None, *args, **kwargs):
|
||||
self._heatupWaitStartTime = monotonic_time()
|
||||
self._long_running_command = True
|
||||
@@ -3602,8 +3650,7 @@ class MachineCom(object):
|
||||
|
||||
def _emergency_force_send(self, cmd, message, gcode=None, *args, **kwargs):
|
||||
# only jump the queue with our command if the EMERGENCY_PARSER capability is available
|
||||
if not self._capability_support.get(self.CAPABILITY_EMERGENCY_PARSER, False) \
|
||||
or not self._firmware_capabilities.get(self.CAPABILITY_EMERGENCY_PARSER, False):
|
||||
if not self._capability_supported(self.CAPABILITY_EMERGENCY_PARSER):
|
||||
return
|
||||
|
||||
self._logger.info(message)
|
||||
@@ -3667,7 +3714,7 @@ class MachineComPrintCallback(object):
|
||||
def on_comm_log(self, message):
|
||||
pass
|
||||
|
||||
def on_comm_temperature_update(self, temp, bedTemp):
|
||||
def on_comm_temperature_update(self, temp, bedTemp, chamberTemp):
|
||||
pass
|
||||
|
||||
def on_comm_position_update(self, position, reason=None):
|
||||
|
||||
Reference in new issue
Block a user