- raise exception i case hendi cannot be enabled
git-svn-id: http://moon:8086/svn/projects/HendiControl@369 fda53097-d464-4ada-af97-ba876c37ca34
This commit is contained in:
+14
-6
@@ -16,16 +16,24 @@ class Plant(APlant):
|
||||
self.cycleCounter = 0
|
||||
|
||||
def activate(self, enable=True):
|
||||
if enable == True:
|
||||
self.heater.remoteEnable(enable)
|
||||
self.heater.setSwitch(enable)
|
||||
if enable:
|
||||
if not self.heater.isRemoteEnable():
|
||||
raise Exception ("Heater: Cannot enable remote mode!")
|
||||
else:
|
||||
try:
|
||||
self.heater.remoteEnable(enable)
|
||||
except:
|
||||
raise Exception("Error: Could not activate heater!")
|
||||
self.heater.setSwitch(enable)
|
||||
self.heater.remoteEnable(enable)
|
||||
print ("Plant activated")
|
||||
else:
|
||||
if self.heater.isRemoteEnable():
|
||||
self.heater.setSwitch(enable)
|
||||
self.heater.remoteEnable(enable)
|
||||
print ("Plant deactivated")
|
||||
|
||||
def process(self, dt=1):
|
||||
if not self.heater.isRemoteEnable():
|
||||
return
|
||||
|
||||
isOn = self.isOn
|
||||
self.cycleCounter += dt
|
||||
if self.cycleCounter >= self.cycleTime:
|
||||
|
||||
Reference in New Issue
Block a user