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