From b87deab01c44dbe8405c6735be38aad68326d182 Mon Sep 17 00:00:00 2001 From: jbruce Date: Tue, 27 Nov 2018 13:49:46 -0500 Subject: [PATCH] - added shut down temp if it's exceeded, kiln shuts down --- config.py | 3 +-- lib/oven.py | 24 ++++-------------------- 2 files changed, 5 insertions(+), 22 deletions(-) diff --git a/config.py b/config.py index 3ea7869..ab8940c 100644 --- a/config.py +++ b/config.py @@ -88,9 +88,8 @@ warning_temp_low = 5 # if measured value is N degrees above set point warning_temp_high = 5 -# not used yet # emergency shutoff the kiln if this temp is reached. # when solid state relays fail, they usually fail closed. this means your # kiln receives full power until your house burns down. # this should not replace you watching your kiln or use of a kiln-sitter -emergency_shutoff_temp = 155 +emergency_shutoff_temp = 2400 diff --git a/lib/oven.py b/lib/oven.py index f0024bf..ab7a9ad 100644 --- a/lib/oven.py +++ b/lib/oven.py @@ -134,27 +134,11 @@ class Oven (threading.Thread): # a warning low and warning high below and above # set value. If either of these are exceeded, # warn in the interface. DO NOT RESET. - # - # Maybe add an absolute MAX above which your kiln - # will be damaged and RESET then. - - - if(pid > 0): - # The temp should be changing with the heat on - # Count the number of time_steps encountered with no change and the heat on - if last_temp == self.temp_sensor.temperature: - temperature_count += 1 - else: - temperature_count = 0 - # If the heat is on and nothing is changing, reset - # The direction or amount of change does not matter - # This prevents runaway in the event of a sensor read failure - #if temperature_count > 20: - # log.info("Error reading sensor, oven temp not responding to heat.") - # self.reset() - else: - temperature_count = 0 + # if we are WAY TOO HOT, shut down + if(self.temp_sensor.temperature >= config.emergency_shutoff_temp): + log.info("emergency temperature too high, shutting down") + self.reset() #Capture the last temperature value. This must be done before set_heat, since there is a sleep in there now. last_temp = self.temp_sensor.temperature