states should not control the keypad buffer
This commit is contained in:
parent
39bcda0404
commit
d5d2ce6abc
|
@ -68,6 +68,7 @@ class KeypadListener:
|
||||||
if self._buf == '':
|
if self._buf == '':
|
||||||
ctrlKeySound.play()
|
ctrlKeySound.play()
|
||||||
elif self._buf == passwd:
|
elif self._buf == passwd:
|
||||||
|
self.resetBuffer()
|
||||||
callbackDisarm()
|
callbackDisarm()
|
||||||
else:
|
else:
|
||||||
self.resetBuffer()
|
self.resetBuffer()
|
||||||
|
@ -75,6 +76,7 @@ class KeypadListener:
|
||||||
|
|
||||||
# arm
|
# arm
|
||||||
elif val == 'NUML':
|
elif val == 'NUML':
|
||||||
|
self.resetBuffer()
|
||||||
callbackArm()
|
callbackArm()
|
||||||
ctrlKeySound.play()
|
ctrlKeySound.play()
|
||||||
|
|
||||||
|
|
|
@ -181,14 +181,8 @@ class StateMachine:
|
||||||
|
|
||||||
self._addManaged(PipeListener(callback=secretCallback, name= 'secret'))
|
self._addManaged(PipeListener(callback=secretCallback, name= 'secret'))
|
||||||
|
|
||||||
keypadListener = self._addManaged(
|
self._addManaged(KeypadListener(stateMachine=self, callbackDisarm=self.DISARM,
|
||||||
KeypadListener(
|
callbackArm=self.ARM, passwd='5918462'))
|
||||||
stateMachine = self,
|
|
||||||
callbackDisarm = self.DISARM,
|
|
||||||
callbackArm = self.ARM,
|
|
||||||
passwd = '5918462'
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
def startTimer(t, sound):
|
def startTimer(t, sound):
|
||||||
self._timer = _CountdownTimer(t, self.TIMOUT, sound)
|
self._timer = _CountdownTimer(t, self.TIMOUT, sound)
|
||||||
|
@ -232,9 +226,6 @@ class StateMachine:
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
|
|
||||||
for obj in stateObjs:
|
|
||||||
obj.entryCallbacks.append(keypadListener.resetBuffer)
|
|
||||||
|
|
||||||
self.states = st = namedtuple('States', [obj.name for obj in stateObjs])(*stateObjs)
|
self.states = st = namedtuple('States', [obj.name for obj in stateObjs])(*stateObjs)
|
||||||
|
|
||||||
st.disarmed.addTransition( _SIGNALS.ARM, st.disarmedCountdown)
|
st.disarmed.addTransition( _SIGNALS.ARM, st.disarmedCountdown)
|
||||||
|
|
Loading…
Reference in New Issue