added e relay code

This commit is contained in:
Tanaes 2022-01-08 19:02:23 -05:00
parent 1450662aea
commit 4d201abdc9
2 changed files with 12 additions and 0 deletions

View File

@ -30,6 +30,7 @@ currency_type = "$" # Currency Symbol to show when calculating cost to run j
### Outputs
gpio_heat = 23 # Switches zero-cross solid-state-relay
gpio_e_relay = 27 # pin 13; emergency cutoff relay
### Thermocouple Adapter selection:
# max31855 - bitbang SPI interface

View File

@ -20,6 +20,7 @@ class Output(object):
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.setup(config.gpio_heat, GPIO.OUT)
GPIO.setup(config.gpio_e_relay, GPIO.OUT)
self.active = True
self.GPIO = GPIO
except:
@ -27,6 +28,14 @@ class Output(object):
log.warning(msg)
self.active = False
def safety_off(self):
'''Energizes the safety relay'''
self.GPIO.output(config.gpio_e_relay, self.GPIO.HIGH)
def safety_on(self):
'''Deenergizes the safety relay'''
self.GPIO.output(config.gpio_e_relay, self.GPIO.LOW)
def heat(self,sleepfor):
self.GPIO.output(config.gpio_heat, self.GPIO.HIGH)
time.sleep(sleepfor)
@ -384,12 +393,14 @@ class RealOven(Oven):
# call parent init
Oven.__init__(self)
self.output.safety_off()
# start thread
self.start()
def reset(self):
super().reset()
self.output.safety_on()
self.output.cool(0)
def heat_then_cool(self):