32 lines
683 B
Python
32 lines
683 B
Python
"""Constants"""
|
|
ERROR_THRESHOLD = 350
|
|
OPEN_THRESHOLD = 190
|
|
CLOSED_THRESHOLD = 6*7
|
|
CLOSED_WANT = 4*7
|
|
MIN_IDLE_TIME = 0.5
|
|
|
|
UPDATE_RATE = 1
|
|
MAX_UPDATE_RATE = 20
|
|
COMMAND_IDLE_TIME = 0.5
|
|
|
|
class state:
|
|
IDLE, CLOSE, OPEN_THEN_CLOSE, OPEN, CLOSE_THEN_OPEN, ERROR, RESTART = range(7)
|
|
|
|
|
|
state_names = {
|
|
state.OPEN: "open",
|
|
state.CLOSE: "closed",
|
|
state.ERROR: "error",
|
|
state.OPEN_THEN_CLOSE: "open, then close",
|
|
state.CLOSE_THEN_OPEN: "close, then open",
|
|
state.RESTART: "reset MCU",
|
|
state.IDLE: "idle",
|
|
}
|
|
|
|
action_names = {
|
|
state.IDLE: "idling",
|
|
state.OPEN: "waiting for open door",
|
|
state.CLOSE: "waiting for closed door",
|
|
state.ERROR: "error",
|
|
}
|