예제 #1
0
 async def handle_mechanial_eject_during_idle(self):
     """Handle mechanical eject."""
     # handle lost balls via outgoing balls handler (if mechanical eject)
     self.config['eject_targets'][0].available_balls += 1
     eject = OutgoingBall(self.config['eject_targets'][0])
     eject.eject_timeout = self.config['eject_timeouts'][eject.target] / 1000
     eject.max_tries = self.config['max_eject_attempts']
     eject.mechanical = True
     eject.already_left = True
     self.outgoing_balls_handler.add_eject_to_queue(eject)
예제 #2
0
파일: ball_device.py 프로젝트: vgrillot/mpf
 def lost_idle_ball(self):
     """Lost an ball while the device was idle."""
     if self.config['mechanical_eject']:
         # handle lost balls via outgoing balls handler (if mechanical eject)
         self.config['eject_targets'][0].available_balls += 1
         eject = OutgoingBall(self.config['eject_targets'][0])
         eject.eject_timeout = self.config['eject_timeouts'][eject.target] / 1000
         eject.max_tries = self.config['max_eject_attempts']
         eject.mechanical = True
         eject.already_left = True
         self.outgoing_balls_handler.add_eject_to_queue(eject)
     else:
         # handle lost balls
         self.config['ball_missing_target'].add_missing_balls(1)
         yield from self._balls_missing(1)
예제 #3
0
    def setup_eject_chain_next_hop(self, path, player_controlled):
        """Set up one hop of the eject chain."""
        next_hop = path.popleft()
        self.debug_log("Adding eject chain")

        if next_hop not in self.config['eject_targets']:
            raise AssertionError("Broken path")

        eject = OutgoingBall(next_hop)
        eject.eject_timeout = self.config['eject_timeouts'][next_hop] / 1000
        eject.max_tries = self.config['max_eject_attempts']
        eject.player_controlled = player_controlled

        self.outgoing_balls_handler.add_eject_to_queue(eject)

        # check if we traversed the whole path
        if path:
            next_hop.setup_eject_chain_next_hop(path, player_controlled)