Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Hacksaar
Sphinx
Commits
92e7d7b2
Commit
92e7d7b2
authored
Oct 23, 2013
by
Ralf
Browse files
Open the space when the switch is toggled while we are closed
parent
7896e93d
Changes
2
Hide whitespace changes
Inline
Side-by-side
actor.py
View file @
92e7d7b2
...
...
@@ -35,7 +35,7 @@ class Actor:
CMD_GREEN_ON
:
CMD
(
"green on"
,
pin
=
23
,
tid
=
2
,
todo
=
[(
True
,
0
)]),
CMD_GREEN_OFF
:
CMD
(
"green off"
,
pin
=
23
,
tid
=
2
,
todo
=
[(
False
,
0
)]),
CMD_RED_ON
:
CMD
(
"red on"
,
pin
=
26
,
tid
=
2
,
todo
=
[(
True
,
0
)]),
CMD_RED_OFF
:
CMD
(
"red o
n"
,
pin
=
26
,
tid
=
2
,
todo
=
[(
False
,
0
)]),
CMD_RED_OFF
:
CMD
(
"red o
ff"
,
pin
=
26
,
tid
=
2
,
todo
=
[(
False
,
0
)]),
}
def
__init__
(
self
):
...
...
statemachine.py
View file @
92e7d7b2
...
...
@@ -116,6 +116,9 @@ class StateMachine():
if
not
self
.
pins
().
door_locked
:
logger
.
info
(
"Door unlocked, space is about to open"
)
return
StateMachine
.
StateAboutToOpen
(
self
.
state_machine
)
if
not
self
.
old_pins
().
space_active
and
self
.
pins
().
space_active
:
logger
.
info
(
"Space toggled to active while it was closed - unlocking the door"
)
return
StateMachine
.
StateUnlocking
(
self
.
state_machine
)
return
super
().
handle_pins_event
()
class
AbstractUnlockedState
(
AbstractNonStartState
):
...
...
@@ -127,7 +130,6 @@ class StateMachine():
if
self
.
pins
().
door_locked
:
logger
.
info
(
"Door locked, closing space"
)
if
self
.
pins
().
space_active
:
# FIXME the same state can be reached by first locking the door, and then activating the space. What to do then?
logger
.
warning
(
"StateMachine: door manually locked, but space switch is still on - going to StateZu"
)
play_sound
(
"manual_lock"
)
return
StateMachine
.
StateZu
(
self
.
state_machine
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment