heaters: add last pwm value to heater.get_status (#3621)

Signed-off-by: Stefan Dej <meteyou@gmail.com>
This commit is contained in:
Stefan Dej 2020-12-14 02:08:16 +01:00 committed by GitHub
parent 43a6d18f13
commit 77add95675
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View File

@ -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".

View File

@ -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.)