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: `. - `printer..target`: The current target temperature (in Celsius as a float) for the given heater. +- `printer..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.)