pylint
This commit is contained in:
parent
b0a3f6b711
commit
8730ed0913
@ -4,29 +4,37 @@ Created on Dec 19, 2016
|
||||
@author: klaehn
|
||||
'''
|
||||
|
||||
from engine.engine import engine
|
||||
from power_sensor.power_sensor import power_sensor
|
||||
from time import time
|
||||
import numpy as np
|
||||
from engine.engine import engine
|
||||
from power_sensor.power_sensor import power_sensor
|
||||
|
||||
class gate_handler:
|
||||
class GateHandler(object):
|
||||
"""Gate handler class"""
|
||||
def __init__(self):
|
||||
self.__engine = engine(13, 19)
|
||||
self.__power_sensor = power_sensor(1, 0x40)
|
||||
self.__max_current_up = 315
|
||||
self.__max_current_down = 280
|
||||
self.__max_time_open = 250
|
||||
self.__max_time_close = 250
|
||||
self.__timeout_open = 0
|
||||
self.__timeout_close = 0
|
||||
self.__max_current = {"up":315, "down":280}
|
||||
self.__max_time = {"open":250, "close":250}
|
||||
return
|
||||
|
||||
def open(self):
|
||||
self.__timeout_open = time() + self.__max_time_open
|
||||
"""Open the gate"""
|
||||
timeout_open = time() + self.__max_time["open"]
|
||||
self.__engine.run_up()
|
||||
power = np.array([])
|
||||
timestamps = np.array([])
|
||||
while(time() < self.__max_time_open):
|
||||
while timeout_open > time():
|
||||
timestamps = np.append(timestamps, time())
|
||||
power = np.append(power, self.__power_sensor.power_mw())
|
||||
|
||||
def close(self):
|
||||
"""Close the gate"""
|
||||
timeout_open = time() + self.__max_time["close"]
|
||||
self.__engine.run_down()
|
||||
power = np.array([])
|
||||
timestamps = np.array([])
|
||||
while timeout_open > time():
|
||||
timestamps = np.append(timestamps, time())
|
||||
power = np.append(power, self.__power_sensor.power_mw())
|
||||
|
Loading…
Reference in New Issue
Block a user