diff --git a/Control/brewpi/plant.py b/Control/brewpi/plant.py index 78da918..bffcf8a 100644 --- a/Control/brewpi/plant.py +++ b/Control/brewpi/plant.py @@ -10,6 +10,7 @@ class Plant(APlant): self.heater = HendiCtrl('/dev/ttyUSB0', 115200) self.tempsensor = Max31865() self.P = 0 + self.isOn = False def activate(self, enable): if enable: @@ -25,6 +26,14 @@ class Plant(APlant): def setPower(self, power_w): self.P = power_w self.heater.setPowerWatts(power_w) + if power_w < 250: + if self.isOn: + self.heater.setSwitch(False) + self.isOn = False + elif power_w >= 500: + if not self.isOn: + self.heater.setSwitch(True) + self.isOn = True def getPower(self): return self.heater.getPowerWatts()