heater: Do not flush look-ahead queue on a heater temperature update

The print_time parameter of heater.set_temp() is not currently used
and it isn't necessary to flush the look-ahead queue just get the
print_time.  Remove the parameter from heater.set_temp() to avoid
flushing the look-ahead queue.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2020-01-02 19:17:47 -05:00
parent dabffcc22c
commit 4b6a65c1e0
4 changed files with 10 additions and 15 deletions

View File

@ -20,8 +20,7 @@ class PrinterHeaterBed:
gcode = self.printer.lookup_object('gcode') gcode = self.printer.lookup_object('gcode')
temp = gcode.get_float('S', params, 0.) temp = gcode.get_float('S', params, 0.)
toolhead = self.printer.lookup_object('toolhead') toolhead = self.printer.lookup_object('toolhead')
print_time = toolhead.get_last_move_time() self.heater.set_temp(temp)
self.heater.set_temp(print_time, temp)
if wait and temp: if wait and temp:
gcode.wait_for_temperature(self.heater) gcode.wait_for_temperature(self.heater)
def cmd_M190(self, params): def cmd_M190(self, params):

View File

@ -23,11 +23,11 @@ class PIDCalibrate:
heater = pheater.lookup_heater(heater_name) heater = pheater.lookup_heater(heater_name)
except self.printer.config_error as e: except self.printer.config_error as e:
raise self.gcode.error(str(e)) raise self.gcode.error(str(e))
print_time = self.printer.lookup_object('toolhead').get_last_move_time() self.printer.lookup_object('toolhead').get_last_move_time()
calibrate = ControlAutoTune(heater, target) calibrate = ControlAutoTune(heater, target)
old_control = heater.set_control(calibrate) old_control = heater.set_control(calibrate)
try: try:
heater.set_temp(print_time, target) heater.set_temp(target)
except self.printer.command_error as e: except self.printer.command_error as e:
heater.set_control(old_control) heater.set_control(old_control)
raise raise

View File

@ -97,7 +97,7 @@ class Heater:
return self.max_power return self.max_power
def get_smooth_time(self): def get_smooth_time(self):
return self.smooth_time return self.smooth_time
def set_temp(self, print_time, degrees): def set_temp(self, degrees):
if degrees and (degrees < self.min_temp or degrees > self.max_temp): if degrees and (degrees < self.min_temp or degrees > self.max_temp):
raise self.printer.command_error( raise self.printer.command_error(
"Requested temperature (%.1f) out of range (%.1f:%.1f)" "Requested temperature (%.1f) out of range (%.1f:%.1f)"
@ -139,9 +139,8 @@ class Heater:
return {'temperature': smoothed_temp, 'target': target_temp} return {'temperature': smoothed_temp, 'target': target_temp}
cmd_SET_HEATER_TEMPERATURE_help = "Sets a heater temperature" cmd_SET_HEATER_TEMPERATURE_help = "Sets a heater temperature"
def cmd_SET_HEATER_TEMPERATURE(self, params): def cmd_SET_HEATER_TEMPERATURE(self, params):
print_time = self.printer.lookup_object('toolhead').get_last_move_time()
temp = self.gcode.get_float('TARGET', params, 0.) temp = self.gcode.get_float('TARGET', params, 0.)
self.set_temp(print_time, temp) self.set_temp(temp)
###################################################################### ######################################################################
@ -277,13 +276,12 @@ class PrinterHeaters:
"G-Code sensor id %s already registered" % (gcode_id,)) "G-Code sensor id %s already registered" % (gcode_id,))
self.gcode_id_to_sensor[gcode_id] = psensor self.gcode_id_to_sensor[gcode_id] = psensor
self.available_sensors.append(config.get_name()) self.available_sensors.append(config.get_name())
def turn_off_all_heaters(self, print_time): def turn_off_all_heaters(self, print_time=0.):
for heater in self.heaters.values(): for heater in self.heaters.values():
heater.set_temp(print_time, 0.) heater.set_temp(0.)
cmd_TURN_OFF_HEATERS_help = "Turn off all heaters" cmd_TURN_OFF_HEATERS_help = "Turn off all heaters"
def cmd_TURN_OFF_HEATERS(self, params): def cmd_TURN_OFF_HEATERS(self, params):
print_time = self.printer.lookup_object('toolhead').get_last_move_time() self.turn_off_all_heaters()
self.turn_off_all_heaters(print_time)
def get_status(self, eventtime): def get_status(self, eventtime):
return {'available_heaters': self.available_heaters, return {'available_heaters': self.available_heaters,
'available_sensors': self.available_sensors} 'available_sensors': self.available_sensors}

View File

@ -145,7 +145,6 @@ class PrinterExtruder:
start_v, cruise_v, accel) start_v, cruise_v, accel)
def cmd_M104(self, params, wait=False): def cmd_M104(self, params, wait=False):
# Set Extruder Temperature # Set Extruder Temperature
toolhead = self.printer.lookup_object('toolhead')
gcode = self.printer.lookup_object('gcode') gcode = self.printer.lookup_object('gcode')
temp = gcode.get_float('S', params, 0.) temp = gcode.get_float('S', params, 0.)
if 'T' in params: if 'T' in params:
@ -159,10 +158,9 @@ class PrinterExtruder:
return return
raise gcode.error("Extruder not configured") raise gcode.error("Extruder not configured")
else: else:
extruder = toolhead.get_extruder() extruder = self.printer.lookup_object('toolhead').get_extruder()
print_time = toolhead.get_last_move_time()
heater = extruder.get_heater() heater = extruder.get_heater()
heater.set_temp(print_time, temp) heater.set_temp(temp)
if wait and temp: if wait and temp:
gcode.wait_for_temperature(heater) gcode.wait_for_temperature(heater)
def cmd_M109(self, params): def cmd_M109(self, params):