From 8fbb3ab649d46e1a913ccd637d3b240e7d43ab93 Mon Sep 17 00:00:00 2001 From: jbruce Date: Thu, 11 Aug 2022 08:18:25 -0400 Subject: [PATCH] adding configurable emergencies --- config.py | 22 ++++++++++++++-------- lib/oven.py | 10 +++++----- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/config.py b/config.py index ea2365e..b74ba20 100644 --- a/config.py +++ b/config.py @@ -130,12 +130,6 @@ pid_control_window = 5 #degrees # cheap thermocouple. Invest in a better thermocouple. thermocouple_offset=0 -# some kilns/thermocouples start erroneously reporting "short" -# errors at higher temperatures due to plasma forming in the kiln. -# Set this to False to ignore these errors and assume the temperature -# reading was correct anyway -honour_theromocouple_short_errors = False - # number of samples of temperature to average. # If you suffer from the high temperature kiln issue and have set # honour_theromocouple_short_errors to False, @@ -145,13 +139,25 @@ temperature_average_samples = 40 # Thermocouple AC frequency filtering - set to True if in a 50Hz locale, else leave at False for 60Hz locale ac_freq_50hz = False +######################################################################## +# Emergencies - or maybe not +######################################################################## # There are all kinds of emergencies that can happen including: # - temperature is too high (emergency_shutoff_temp exceeded) # - lost connection to thermocouple # - unknown error with thermocouple # - too many errors in a short period from thermocouple -# and some people just want to ignore all of that and just log the emergencies but do not quit -ignore_emergencies = False +# but in some cases, you might want to ignore a specific error, log it, +# and continue running your profile. +ignore_temp_too_high = False +ignore_lost_connection_tc = False +ignore_unknown_tc_error = False +ignore_too_many_tc_errors = False +# some kilns/thermocouples start erroneously reporting "short" +# errors at higher temperatures due to plasma forming in the kiln. +# Set this to True to ignore these errors and assume the temperature +# reading was correct anyway +ignore_tc_short_errors = False ######################################################################## # automatic restarts - if you have a power brown-out and the raspberry pi diff --git a/lib/oven.py b/lib/oven.py index 35a06f6..301e939 100644 --- a/lib/oven.py +++ b/lib/oven.py @@ -164,7 +164,7 @@ class TempSensorReal(TempSensor): self.unknownError = self.thermocouple.unknownError is_bad_value = self.noConnection | self.unknownError - if config.honour_theromocouple_short_errors: + if not config.ignore_tc_short_errors: is_bad_value |= self.shortToGround | self.shortToVCC if not is_bad_value: @@ -273,22 +273,22 @@ class Oven(threading.Thread): if (self.board.temp_sensor.temperature + config.thermocouple_offset >= config.emergency_shutoff_temp): log.info("emergency!!! temperature too high") - if not config.ignore_emergencies == True: + if config.ignore_temp_too_high == False: self.abort_run() if self.board.temp_sensor.noConnection: log.info("emergency!!! lost connection to thermocouple") - if not config.ignore_emergencies == True: + if config.ignore_lost_connection_tc == False: self.abort_run() if self.board.temp_sensor.unknownError: log.info("emergency!!! unknown thermocouple error") - if not config.ignore_emergencies == True: + if config.ignore_unknown_tc_error == False: self.abort_run() if self.board.temp_sensor.bad_percent > 30: log.info("emergency!!! too many errors in a short period") - if not config.ignore_emergencies == True: + if config.ignore_too_many_tc_errors == False: self.abort_run() def reset_if_schedule_ended(self):