Ball Search¶
-
class
mpf.core.ball_search.
BallSearch
(machine, playfield)¶ Bases:
mpf.core.mpf_controller.MpfController
Ball search controller.
Methods & Attributes
The Ball Search has the following methods & attributes available. Note that methods & attributes inherited from the base class are not included here.
-
block
(**kwargs)¶ Block ball search for this playfield.
Blocking will disable ball search if it's enabled or running, and will prevent ball search from enabling if it's disabled until ball_search_unblock() is called.
-
cancel_ball_search
(**kwargs)¶ Cancel the current ball search and mark the ball as missing.
-
configure_logging
(logger, console_level='basic', file_level='basic')¶ Configure the logging for the module this class is mixed into.
Parameters: - logger -- The string name of the logger to use
- console_level -- The level of logging for the console. Valid options are "none", "basic", or "full".
- file_level -- The level of logging for the console. Valid options are "none", "basic", or "full".
-
debug_log
(msg, *args, **kwargs)¶ Log a message at the debug level.
Note that whether this message shows up in the console or log file is controlled by the settings used with configure_logging().
-
disable
(**kwargs)¶ Disable ball search.
Will stop the ball search if it is running.
-
enable
(**kwargs)¶ Enable but do not start ball search.
Ball search is started by a timeout. Enable also resets that timer.
-
error_log
(msg, *args, **kwargs)¶ Log a message at the error level.
These messages will always be shown in the console and the log file.
-
give_up
()¶ Give up the ball search.
Did not find the missing ball. Execute the failed action which either adds a replacement ball or ends the game.
-
info_log
(msg, *args, **kwargs)¶ Log a message at the info level.
Whether this message shows up in the console or log file is controlled by the settings used with configure_logging().
-
register
(priority, callback, name)¶ Register a callback for sequential ball search.
Callbacks are called by priority. Ball search only waits if the callback returns true.
Parameters: - priority -- priority of this callback in the ball search procedure
- callback -- callback to call. ball search will wait before the next callback, if it returns true
- name -- string name which is used for debugging & the logs
-
request_to_start_game
(**kwargs)¶ Method registered for the request_to_start_game event.
Prevents the game from starting while ball search is running.
-
reset_timer
()¶ Reset the timer to start ball search.
This also cancels an active running ball search.
This is called by the playfield anytime a playfield switch is hit.
-
start
()¶ Actually start ball search.
-
stop
()¶ Stop an active running ball search.
-
unblock
(**kwargs)¶ Unblock ball search for this playfield.
This will check to see if there are balls on the playfield, and if so, enable ball search.
-
warning_log
(msg, *args, **kwargs)¶ Log a message at the warning level.
These messages will always be shown in the console and the log file.
-