diff --git a/src/close.py b/src/close.py index 421e95f..806c4f0 100644 --- a/src/close.py +++ b/src/close.py @@ -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 diff --git a/src/open.py b/src/open.py index 5aa0e65..269d258 100644 --- a/src/open.py +++ b/src/open.py @@ -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