From d68e642f2149d42dd50c72b5d35e549805413637 Mon Sep 17 00:00:00 2001 From: Thomas Klaehn Date: Fri, 23 Dec 2016 12:27:32 +0100 Subject: [PATCH] constants --- src/gate/gate_state.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/gate/gate_state.py b/src/gate/gate_state.py index 729efd0..fc470a2 100644 --- a/src/gate/gate_state.py +++ b/src/gate/gate_state.py @@ -29,9 +29,9 @@ LIGHT_SENSOR_I2C_ADDRESS = 0x23 POWER_SENSOR_I2C_BUS = 1 POWER_SENSOR_I2C_ADDRESS = 0x40 -CONSECUTIVE_CURRENT_READS = 100 +CONSECUTIVE_CURRENT_READS = 1000 -MAX_ENGINE_POWER = {"up":330, "down":300} +MAX_ENGINE_POWER = {"up":330, "down":290} MAX_GATE_RUNTIME = {"open":250, "close":250} @@ -117,6 +117,7 @@ class GateState(object): def __opening_handler(self, light_avg): + next_state = self.__next_state if self.__is_transition(): self.__gate_handler.open() self.__gate_move_timeout = time() + MAX_GATE_RUNTIME["open"] @@ -129,7 +130,6 @@ class GateState(object): self.__power_data.push(self.__power_sensor.power_mw()) current_avg = self.__power_data.average() if current_avg != None: - print "current_avg: " + str(current_avg) if current_avg > MAX_ENGINE_POWER["up"]: next_state = STATE_OPENED @@ -149,7 +149,6 @@ class GateState(object): self.__power_data.push(self.__power_sensor.power_mw()) current_avg = self.__power_data.average() if current_avg != None: - print "current_avg: " + str(current_avg) if current_avg > MAX_ENGINE_POWER["down"]: next_state = STATE_CLOSED