Skip to content

Commit

Permalink
trigger switch again after recycle_secs passed. #176
Browse files Browse the repository at this point in the history
  • Loading branch information
jabdoa2 committed Apr 14, 2016
1 parent 894ddf7 commit 6f21627
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions mpf/core/switch_controller.py
Expand Up @@ -307,6 +307,8 @@ def process_switch(self, name, state=1, logical=False):

# if the switch is active, check to see if it's recycle_time has passed
if state and not self._check_recycle_time(obj, state):
self.machine.clock.schedule_once(lambda dt: self._recycle_passed(obj, state, logical, obj.hw_state),
timeout=obj.recycle_clear_time - self.machine.clock.get_time())
return

obj.state = state # update the switch device
Expand Down Expand Up @@ -341,6 +343,10 @@ def process_switch(self, name, state=1, logical=False):

self._post_switch_events(name, state)

def _recycle_passed(self, obj, state, logical, hw_state):
if obj.hw_state == hw_state:
self.process_switch(obj.name, state, logical)

def _cancel_timed_handlers(self, name, state):
# now check if the opposite state is in the active timed switches list
# if so, remove it
Expand Down

0 comments on commit 6f21627

Please sign in to comment.