slightly change explicit open/close
This commit is contained in:
parent
129b74377b
commit
c8dd92415f
@ -5,6 +5,7 @@ Created on Dec 23, 2016
|
||||
'''
|
||||
import sys
|
||||
from time import sleep
|
||||
from datetime import datetime as dt
|
||||
|
||||
from data_buffer import DataBuffer
|
||||
from gate.gate_handler import GateHandler
|
||||
@ -26,16 +27,17 @@ def main(argv):
|
||||
while True:
|
||||
power_data.push(power_sensor.power_mw())
|
||||
average = power_data.average()
|
||||
print "average power: " + str(average) + " mW"
|
||||
print str(dt.now()) + " avg pwr: " + str(average) + " mW"
|
||||
if average != None:
|
||||
if average > MAX_ENGINE_POWER["down"]:
|
||||
gate_handler.open()
|
||||
sleep(2)
|
||||
sleep(5)
|
||||
gate_handler.stop()
|
||||
print "Gate successfully closed"
|
||||
return 0
|
||||
|
||||
except KeyboardInterrupt:
|
||||
gate_handler.stop()
|
||||
print "Closing procedure interrupted."
|
||||
return 1
|
||||
|
||||
|
@ -5,6 +5,7 @@ Created on Dec 23, 2016
|
||||
'''
|
||||
import sys
|
||||
from time import sleep
|
||||
from datetime import datetime as dt
|
||||
|
||||
from data_buffer import DataBuffer
|
||||
from gate.gate_handler import GateHandler
|
||||
@ -26,16 +27,17 @@ def main(argv):
|
||||
while True:
|
||||
power_data.push(power_sensor.power_mw())
|
||||
average = power_data.average()
|
||||
print "average power: " + str(average) + " mW"
|
||||
print str(dt.now()) + " avg pwr: " + str(average) + " mW"
|
||||
if average != None:
|
||||
if average > MAX_ENGINE_POWER["up"]:
|
||||
gate_handler.close()
|
||||
sleep(2)
|
||||
sleep(5)
|
||||
gate_handler.stop()
|
||||
print "Gate successfully opened"
|
||||
return 0
|
||||
|
||||
except KeyboardInterrupt:
|
||||
gate_handler.stop()
|
||||
print "Closing procedure interrupted."
|
||||
return 1
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user