heaters: Add MAXIMUM option to TEMPERATURE_WAIT command

Signed-off-by: Justin Schuh <code@justinschuh.com>
This commit is contained in:
Justin Schuh 2020-12-22 19:09:28 -08:00 committed by KevinOConnor
parent 16963a8e1a
commit 1a9218532b
2 changed files with 5 additions and 3 deletions

View File

@ -156,8 +156,9 @@ The following standard commands are supported:
/tmp/heattest.txt will be created with a log of all temperature /tmp/heattest.txt will be created with a log of all temperature
samples taken during the test. samples taken during the test.
- `TURN_OFF_HEATERS`: Turn off all heaters. - `TURN_OFF_HEATERS`: Turn off all heaters.
- `TEMPERATURE_WAIT SENSOR=<config_name> MINIMUM=<target>`: Wait until - `TEMPERATURE_WAIT SENSOR=<config_name> MINIMUM=<target> [MAXIMUM=<target>]`:
the given temperature sensor is at or above the given target value. Wait until the given temperature sensor is at or above the given
minumum target, and (if specified) at or below the maximum target.
- `SET_VELOCITY_LIMIT [VELOCITY=<value>] [ACCEL=<value>] - `SET_VELOCITY_LIMIT [VELOCITY=<value>] [ACCEL=<value>]
[ACCEL_TO_DECEL=<value>] [SQUARE_CORNER_VELOCITY=<value>]`: Modify [ACCEL_TO_DECEL=<value>] [SQUARE_CORNER_VELOCITY=<value>]`: Modify
the printer's velocity limits. Note that one may only set values the printer's velocity limits. Note that one may only set values

View File

@ -330,6 +330,7 @@ class PrinterHeaters:
if sensor_name not in self.available_sensors: if sensor_name not in self.available_sensors:
raise gcmd.error("Unknown sensor '%s'" % (sensor_name,)) raise gcmd.error("Unknown sensor '%s'" % (sensor_name,))
min_temp = gcmd.get_float('MINIMUM') min_temp = gcmd.get_float('MINIMUM')
max_temp = gcmd.get_float('MAXIMUM', float('inf'), above=min_temp)
if self.printer.get_start_args().get('debugoutput') is not None: if self.printer.get_start_args().get('debugoutput') is not None:
return return
if sensor_name in self.heaters: if sensor_name in self.heaters:
@ -341,7 +342,7 @@ class PrinterHeaters:
eventtime = reactor.monotonic() eventtime = reactor.monotonic()
while not self.printer.is_shutdown(): while not self.printer.is_shutdown():
temp, target = sensor.get_temp(eventtime) temp, target = sensor.get_temp(eventtime)
if temp >= min_temp: if temp >= min_temp and temp <= max_temp:
return return
print_time = toolhead.get_last_move_time() print_time = toolhead.get_last_move_time()
gcmd.respond_raw(self._get_temp(eventtime)) gcmd.respond_raw(self._get_temp(eventtime))