mirror of https://github.com/Desuuuu/klipper.git
verify_heater: Scale hysteresis duration check
If a heater falls out of the target range, accumulate the temperature differences to determine if an error should be raised. This should make it less likely to report an error for heaters that drift slightly out of range, and it should make error reporting faster for heaters that rapidly fall out of range. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
57d342b455
commit
849f4ed25f
|
@ -133,15 +133,18 @@
|
|||
# The amount of time (in seconds) that the heating_gain must be met
|
||||
# in before an error is raised. The default is 20 seconds for
|
||||
# extruders and 60 seconds for heater_bed.
|
||||
#hysteresis: 10
|
||||
#hysteresis: 5
|
||||
# The difference between the target temperature and the current
|
||||
# temperature for the heater to be considered within range of the
|
||||
# target temperature. The default is 10.
|
||||
#check_time: 15
|
||||
# The amount of time (in seconds) a heater that has reached the
|
||||
# target temperature (as defined by the hysteresis field) may fall
|
||||
# outside the target temperature range before an error is
|
||||
# raised. The default is 15.
|
||||
# target temperature. The default is 5.
|
||||
#max_error: 120
|
||||
# The maximum temperature difference a heater that falls outside the
|
||||
# target temperature range may accumulate before an error is
|
||||
# raised. For example, if the target temperature is 200, the
|
||||
# hysteresis is 5, the max_error is 120, and the temperature is
|
||||
# reported at 185 degrees for 12 seconds then an error would be
|
||||
# raised (or 24 seconds at 190, or 120 seconds at 194, etc.). The
|
||||
# default is 120.
|
||||
|
||||
|
||||
# Multi-stepper axes. On a cartesian style printer, the stepper
|
||||
|
|
|
@ -11,8 +11,8 @@ class HeaterCheck:
|
|||
self.printer = config.get_printer()
|
||||
self.heater_name = config.get_name().split()[1]
|
||||
self.heater = None
|
||||
self.hysteresis = config.getfloat('hysteresis', 10., above=0.)
|
||||
self.check_time = config.getfloat('check_time', 15., minval=1.)
|
||||
self.hysteresis = config.getfloat('hysteresis', 5., minval=0.)
|
||||
self.max_error = config.getfloat('max_error', 120., minval=0.)
|
||||
self.heating_gain = config.getfloat('heating_gain', 2., above=0.)
|
||||
default_gain_time = 20.
|
||||
if self.heater_name == 'heater_bed':
|
||||
|
@ -20,7 +20,7 @@ class HeaterCheck:
|
|||
self.check_gain_time = config.getfloat(
|
||||
'check_gain_time', default_gain_time, minval=1.)
|
||||
self.met_target = False
|
||||
self.last_target = self.goal_temp = 0.
|
||||
self.last_target = self.goal_temp = self.error = 0.
|
||||
self.fault_systime = self.printer.get_reactor().NEVER
|
||||
def printer_state(self, state):
|
||||
if state == 'connect':
|
||||
|
@ -33,12 +33,13 @@ class HeaterCheck:
|
|||
temp, target = self.heater.get_temp(eventtime)
|
||||
if temp >= target - self.hysteresis:
|
||||
# Temperature near target - reset checks
|
||||
if not self.met_target:
|
||||
if not self.met_target and target:
|
||||
logging.info("Heater %s within range of %.3f",
|
||||
self.heater_name, target)
|
||||
self.met_target = True
|
||||
self.fault_systime = eventtime + self.check_time
|
||||
self.error = 0.
|
||||
elif self.met_target:
|
||||
self.error += (target - self.hysteresis) - temp
|
||||
if target != self.last_target:
|
||||
# Target changed - reset checks
|
||||
logging.info("Heater %s approaching new target of %.3f",
|
||||
|
@ -46,7 +47,7 @@ class HeaterCheck:
|
|||
self.met_target = False
|
||||
self.goal_temp = temp + self.heating_gain
|
||||
self.fault_systime = eventtime + self.check_gain_time
|
||||
elif eventtime >= self.fault_systime:
|
||||
elif self.error >= self.max_error:
|
||||
# Failure due to inability to maintain target temperature
|
||||
return self.heater_fault()
|
||||
elif temp >= self.goal_temp:
|
||||
|
|
Loading…
Reference in New Issue