constants
This commit is contained in:
parent
f1b37139ef
commit
d68e642f21
@ -29,9 +29,9 @@ LIGHT_SENSOR_I2C_ADDRESS = 0x23
|
|||||||
|
|
||||||
POWER_SENSOR_I2C_BUS = 1
|
POWER_SENSOR_I2C_BUS = 1
|
||||||
POWER_SENSOR_I2C_ADDRESS = 0x40
|
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}
|
MAX_GATE_RUNTIME = {"open":250, "close":250}
|
||||||
|
|
||||||
|
|
||||||
@ -117,6 +117,7 @@ class GateState(object):
|
|||||||
|
|
||||||
|
|
||||||
def __opening_handler(self, light_avg):
|
def __opening_handler(self, light_avg):
|
||||||
|
next_state = self.__next_state
|
||||||
if self.__is_transition():
|
if self.__is_transition():
|
||||||
self.__gate_handler.open()
|
self.__gate_handler.open()
|
||||||
self.__gate_move_timeout = time() + MAX_GATE_RUNTIME["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())
|
self.__power_data.push(self.__power_sensor.power_mw())
|
||||||
current_avg = self.__power_data.average()
|
current_avg = self.__power_data.average()
|
||||||
if current_avg != None:
|
if current_avg != None:
|
||||||
print "current_avg: " + str(current_avg)
|
|
||||||
if current_avg > MAX_ENGINE_POWER["up"]:
|
if current_avg > MAX_ENGINE_POWER["up"]:
|
||||||
next_state = STATE_OPENED
|
next_state = STATE_OPENED
|
||||||
|
|
||||||
@ -149,7 +149,6 @@ class GateState(object):
|
|||||||
self.__power_data.push(self.__power_sensor.power_mw())
|
self.__power_data.push(self.__power_sensor.power_mw())
|
||||||
current_avg = self.__power_data.average()
|
current_avg = self.__power_data.average()
|
||||||
if current_avg != None:
|
if current_avg != None:
|
||||||
print "current_avg: " + str(current_avg)
|
|
||||||
if current_avg > MAX_ENGINE_POWER["down"]:
|
if current_avg > MAX_ENGINE_POWER["down"]:
|
||||||
next_state = STATE_CLOSED
|
next_state = STATE_CLOSED
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user