heater: Do not require target temperature be above min_extrude_temp

Only disable the extruder if the last measured temperature is below
the minimum extrude temperature setting.  Verifying the target
temperature is not necessary, and it can incorrectly prevent some
valid moves.  It's not uncommon for scripts to retract filament
immiedietly after setting the extruder temperature to zero.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2016-11-08 09:22:43 -05:00
parent 345fc41482
commit 3b5b895a10
1 changed files with 2 additions and 5 deletions

View File

@ -29,7 +29,7 @@ class PrinterHeater:
self.thermistor_c = Thermistors.get(config.get('thermistor_type')) self.thermistor_c = Thermistors.get(config.get('thermistor_type'))
self.pullup_r = config.getfloat('pullup_resistor', 4700.) self.pullup_r = config.getfloat('pullup_resistor', 4700.)
self.min_extrude_temp = config.getfloat('min_extrude_temp', 170.) self.min_extrude_temp = config.getfloat('min_extrude_temp', 170.)
self.can_extrude = self.min_extrude_temp <= 0. self.can_extrude = (self.min_extrude_temp <= 0.)
self.lock = threading.Lock() self.lock = threading.Lock()
self.last_temp = 0. self.last_temp = 0.
self.last_temp_time = 0. self.last_temp_time = 0.
@ -91,16 +91,13 @@ class PrinterHeater:
with self.lock: with self.lock:
self.last_temp = temp self.last_temp = temp
self.last_temp_time = read_time self.last_temp_time = read_time
self.can_extrude = (self.last_temp >= self.min_extrude_temp self.can_extrude = (temp >= self.min_extrude_temp)
and self.target_temp >= self.min_extrude_temp)
self.control.adc_callback(read_time, temp) self.control.adc_callback(read_time, temp)
#logging.debug("temp: %.3f %f = %f" % (read_time, read_value, temp)) #logging.debug("temp: %.3f %f = %f" % (read_time, read_value, temp))
# External commands # External commands
def set_temp(self, print_time, degrees): def set_temp(self, print_time, degrees):
with self.lock: with self.lock:
self.target_temp = degrees self.target_temp = degrees
if self.target_temp < self.min_extrude_temp:
self.can_extrude = False
def get_temp(self): def get_temp(self):
with self.lock: with self.lock:
return self.last_temp, self.target_temp return self.last_temp, self.target_temp