diff options
author | Stefan Dej <meteyou@gmail.com> | 2020-12-14 02:08:16 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-13 20:08:16 -0500 |
commit | 77add9567555f395eac7b12df96fb830fe08d46c (patch) | |
tree | ebc758341b5a06bdfae678370cdc735dfebd928d | |
parent | 43a6d18f13995a2c8990bec5fc8ff05f6b280b2c (diff) | |
download | kutter-77add9567555f395eac7b12df96fb830fe08d46c.tar.gz kutter-77add9567555f395eac7b12df96fb830fe08d46c.tar.xz kutter-77add9567555f395eac7b12df96fb830fe08d46c.zip |
heaters: add last pwm value to heater.get_status (#3621)
Signed-off-by: Stefan Dej <meteyou@gmail.com>
-rw-r--r-- | docs/Command_Templates.md | 2 | ||||
-rw-r--r-- | klippy/extras/heaters.py | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/docs/Command_Templates.md b/docs/Command_Templates.md index 979c4b85..64fdacc9 100644 --- a/docs/Command_Templates.md +++ b/docs/Command_Templates.md @@ -166,6 +166,8 @@ The following are common printer attributes: <config_name>`. - `printer.<heater>.target`: The current target temperature (in Celsius as a float) for the given heater. +- `printer.<heater>.power`: The last setting of the PWM pin (a value + between 0.0 and 1.0) associated with the heater. - `printer.idle_timeout.state`: The current state of the printer as tracked by the idle_timeout module. It is one of the following strings: "Idle", "Printing", "Ready". diff --git a/klippy/extras/heaters.py b/klippy/extras/heaters.py index 7dca5fd4..cd426f30 100644 --- a/klippy/extras/heaters.py +++ b/klippy/extras/heaters.py @@ -135,7 +135,9 @@ class Heater: with self.lock: target_temp = self.target_temp smoothed_temp = self.smoothed_temp - return {'temperature': smoothed_temp, 'target': target_temp} + last_pwm_value = self.last_pwm_value + return {'temperature': smoothed_temp, 'target': target_temp, + 'power': last_pwm_value} cmd_SET_HEATER_TEMPERATURE_help = "Sets a heater temperature" def cmd_SET_HEATER_TEMPERATURE(self, gcmd): temp = gcmd.get_float('TARGET', 0.) |