states should not control the keypad buffer

This commit is contained in:
petrucci4prez 2017-06-13 03:06:34 -04:00
parent 39bcda0404
commit d5d2ce6abc
2 changed files with 4 additions and 11 deletions

View File

@ -68,6 +68,7 @@ class KeypadListener:
if self._buf == '':
ctrlKeySound.play()
elif self._buf == passwd:
self.resetBuffer()
callbackDisarm()
else:
self.resetBuffer()
@ -75,6 +76,7 @@ class KeypadListener:
# arm
elif val == 'NUML':
self.resetBuffer()
callbackArm()
ctrlKeySound.play()

View File

@ -181,14 +181,8 @@ class StateMachine:
self._addManaged(PipeListener(callback=secretCallback, name= 'secret'))
keypadListener = self._addManaged(
KeypadListener(
stateMachine = self,
callbackDisarm = self.DISARM,
callbackArm = self.ARM,
passwd = '5918462'
)
)
self._addManaged(KeypadListener(stateMachine=self, callbackDisarm=self.DISARM,
callbackArm=self.ARM, passwd='5918462'))
def startTimer(t, 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)
st.disarmed.addTransition( _SIGNALS.ARM, st.disarmedCountdown)