From 6f21627197f1062c9dc5f8376d091e36df956970 Mon Sep 17 00:00:00 2001 From: Jan Kantert Date: Thu, 14 Apr 2016 23:35:31 +0200 Subject: [PATCH] trigger switch again after recycle_secs passed. #176 --- mpf/core/switch_controller.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mpf/core/switch_controller.py b/mpf/core/switch_controller.py index 372a33036..300e23a75 100644 --- a/mpf/core/switch_controller.py +++ b/mpf/core/switch_controller.py @@ -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 @@ -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