def __init__(self, machine, name): """Initialise drop target.""" self.reset_coil = None self.knockdown_coil = None self.banks = None super().__init__(machine, name) self._in_ball_search = False self.complete = False self.delay = DelayManager(machine.delayRegistry) self._ignore_switch_hits = False
def __init__(self, machine: "MachineController", name: str) -> None: """Initialise drop target.""" self.reset_coil = None # type: Driver self.knockdown_coil = None # type: Driver self.banks = None # type: Set[DropTargetBank] super().__init__(machine, name) self._in_ball_search = False self.complete = False self.delay = DelayManager(machine) self._ignore_switch_hits = False
def __init__(self, machine: "MachineController", name: str) -> None: """Initialise drop target bank.""" super().__init__(machine, name) self.drop_targets = list() # type: List[DropTarget] self.reset_coil = None # type: Driver self.reset_coils = set() # type: Set[Driver] self.complete = False self.down = 0 self.up = 0 self.delay = DelayManager(machine) self._ignore_switch_hits = False
def __init__(self, machine: "MachineController", config, name: str, path) -> None: """Initialise mode. Args: machine: the machine controller config: config dict for mode name: name of mode path: path of mode Returns: """ super().__init__() self.machine = machine # type: MachineController self.config = config # type: ignore self.name = name.lower() self.path = path self.priority = 0 self._active = False self._starting = False self._mode_start_wait_queue = None # type: QueuedEvent self.stop_methods = list( ) # type: List[Tuple[Callable[[Any], None], Any]] self.start_callback = None # type: Callable[[], None] self.stop_callbacks = [] # type: List[Callable[[], None]] self.event_handlers = set() # type: Set[EventHandlerKey] self.switch_handlers = list() # type: List[SwitchHandler] self.mode_stop_kwargs = dict() # type: Dict[str, Any] self.mode_devices = set() # type: Set[ModeDevice] self.start_event_kwargs = None # type: Dict[str, Any] self.stopping = False self.delay = DelayManager(self.machine.delayRegistry) '''DelayManager instance for delays in this mode. Note that all delays scheduled here will be automatically canceled when the mode stops.''' self.player = None # type: Player '''Reference to the current player object.''' self.configure_logging('Mode.' + name, self.config['mode']['console_log'], self.config['mode']['file_log']) self.configure_mode_settings(config.get('mode', dict())) self.auto_stop_on_ball_end = self.config['mode']['stop_on_ball_end'] '''Controls whether this mode is stopped when the ball ends, regardless of its stop_events settings. ''' self.restart_on_next_ball = self.config['mode']['restart_on_next_ball'] '''Controls whether this mode will restart on the next ball. This only
def __init__(self, ball_device, config): """Initialise entrance switch counter.""" for option in ["entrance_switch", "entrance_switch_ignore_window_ms", "entrance_switch_full_timeout", "ball_capacity"]: if option not in config and option in ball_device.config: config[option] = ball_device.config[option] super().__init__(ball_device, config) self._settle_delay = DelayManager(self.machine) self.config = self.machine.config_validator.validate_config("ball_device_counter_entrance_switches", self.config) self.recycle_secs = self.config['entrance_switch_ignore_window_ms'] / 1000.0 self.recycle_clear_time = {} for switch in self.config['entrance_switch']: # Configure switch handlers for entrance switch activity self.machine.switch_controller.add_switch_handler_obj( switch=switch, state=1, ms=0, callback=self._entrance_switch_handler, callback_kwargs={"switch_name": switch.name}) self.machine.switch_controller.add_switch_handler_obj( switch=switch, state=0, ms=0, callback=self._entrance_switch_released_handler, callback_kwargs={"switch_name": switch.name}) if self.config['entrance_switch_full_timeout'] and self.config['ball_capacity']: if len(self.config['entrance_switch']) > 1: raise AssertionError("entrance_switch_full_timeout not supported with multiple entrance switches.") self.machine.switch_controller.add_switch_handler_obj( switch=self.config['entrance_switch'][0], state=1, ms=self.config['entrance_switch_full_timeout'], callback=self._entrance_switch_full_handler) # Handle initial ball count with entrance_switch. If there is a ball on the entrance_switch at boot # assume that we are at max capacity. if (self.config['ball_capacity'] and self.config['entrance_switch_full_timeout'] and self.machine.switch_controller.is_active(self.config['entrance_switch'][0], ms=self.config['entrance_switch_full_timeout'])): self._last_count = self.config['ball_capacity'] else: self._last_count = 0 self._count_stable.set() # TODO validate that we are not used with mechanical eject if not self.config['ball_capacity']: self.ball_device.raise_config_error("Need ball capacity if there are no switches.", 2) elif self.ball_device.config.get('ball_switches'): self.ball_device.raise_config_error("Cannot use capacity and ball switches.", 3)
def __init__(self, machine, name): """Initialise diverter.""" super().__init__(machine, name) self.delay = DelayManager(machine) # Attributes self.active = False self.enabled = False self.diverting_ejects_count = 0 self.eject_state = False self.eject_attempt_queue = deque()
def __init__(self, machine: "MachineController", name: str) -> None: """Initialise ball save.""" self.unlimited_saves = None # type: bool self.source_playfield = None # type: Playfield super().__init__(machine, name) self.delay = DelayManager(machine.delayRegistry) self.enabled = False self.timer_started = False self.saves_remaining = 0 self.early_saved = 0 self.state = 'disabled' self._scheduled_balls = 0
def __init__(self, machine, name): """Initialise stepper.""" self.hw_stepper = None # type: Optional[StepperPlatformInterface] self.platform = None # type: Optional[Stepper] self._target_position = 0 # in user units self._current_position = 0 # in user units self._ball_search_started = False self._ball_search_old_target = 0 self._is_homed = False self._is_moving = asyncio.Event(loop=machine.clock.loop) self._move_task = None # type: Optional[asyncio.Task] self.delay = DelayManager(machine) super().__init__(machine, name)
def __init__(self, machine, mode, name, config): """Initialise mode timer.""" self.machine = machine self.mode = mode self.name = name self.config = config self.running = False self.start_value = self.config['start_value'].evaluate([]) self.restart_on_complete = self.config['restart_on_complete'] self._ticks = 0 self.tick_var = '{}_{}_tick'.format(self.mode.name, self.name) try: self.end_value = self.config['end_value'].evaluate([]) except AttributeError: self.end_value = None self.ticks_remaining = 0 self.max_value = self.config['max_value'] self.direction = self.config['direction'].lower() self.tick_secs = self.config['tick_interval'] / 1000.0 self.timer = None self.event_keys = set() self.delay = DelayManager(self.machine.delayRegistry) if self.config['debug']: self.configure_logging('Timer.' + name, 'full', 'full') else: self.configure_logging('Timer.' + name, self.config['console_log'], self.config['file_log']) if self.direction == 'down' and not self.end_value: self.end_value = 0 # need it to be 0 not None self.ticks = self.start_value self.debug_log("----------- Initial Values -----------") self.debug_log("running: %s", self.running) self.debug_log("start_value: %s", self.start_value) self.debug_log("restart_on_complete: %s", self.restart_on_complete) self.debug_log("_ticks: %s", self.ticks) self.debug_log("end_value: %s", self.end_value) self.debug_log("ticks_remaining: %s", self.ticks_remaining) self.debug_log("max_value: %s", self.max_value) self.debug_log("direction: %s", self.direction) self.debug_log("tick_secs: %s", self.tick_secs) self.debug_log("--------------------------------------") if self.config['control_events']: self._setup_control_events(self.config['control_events'])
def __init__(self, machine, name): """Create the playfield.""" super().__init__(machine, name) self.ball_search = BallSearch(self.machine, self) self.delay = DelayManager(self.machine.delayRegistry) self.machine.ball_devices[name] = self # Attributes self._balls = 0 self.available_balls = 0 self.unexpected_balls = 0 self.num_balls_requested = 0
def __init__(self, machine, name): """Initialise light.""" self.hw_drivers = {} self.platforms = set() # type: Set[LightsPlatform] super().__init__(machine, name) self.machine.light_controller.initialise_light_subsystem() self.delay = DelayManager(self.machine.delayRegistry) self.default_fade_ms = None self._color_correction_profile = None self.stack = list() """A list of dicts which represents different commands that have come
def __init__(self, machine): """Initialise ball controller.""" self.machine = machine self.log = logging.getLogger("BallController") self.log.debug("Loading the BallController") self.delay = DelayManager(self.machine.delayRegistry) self.num_balls_known = -999 # register for events self.machine.events.add_handler('request_to_start_game', self.request_to_start_game) self.machine.events.add_handler('machine_reset_phase_2', self._initialize) self.machine.events.add_handler('init_phase_2', self._init2)
def __init__(self, machine: "MachineController", name: str) -> None: """Initialise ball save.""" self.ball_locks = None self.unlimited_saves = None # type: Optional[bool] self.source_playfield = None # type: Optional[Playfield] super().__init__(machine, name) self.delay = DelayManager(machine) self.enabled = False self.timer_started = False self.saves_remaining = 0 self.early_saved = 0 self.state = 'disabled' self._scheduled_balls = 0 self.active_time = 0
def __init__(self, machine, name): """Initialise light.""" self.hw_drivers = {} # type: Dict[str, LightPlatformInterface] self.hw_driver_functions = [] self.platforms = set() # type: Set[LightsPlatform] super().__init__(machine, name) self.machine.light_controller.initialise_light_subsystem() self.delay = DelayManager(self.machine) self.default_fade_ms = None self._off_color = RGBColor("off") self._color_correction_profile = None self.stack = list() # type: List[LightStackEntry] """A list of dicts which represents different commands that have come
def __init__(self, machine, name): """Initialise stepper.""" self.hw_stepper = None self.platform = None # type: Stepper self._cachedPosition = 0 # in user units self._ball_search_started = False self._min_pos = 0 self._max_pos = 1 self.positionMode = False self._cachedVelocity = 0 self._isHomed = False self._isMoving = False self._move_complete_pollrate = 100 #ms self._resetPosition = 0 self.delay = DelayManager(machine.delayRegistry) super().__init__(machine, name)
def __init__(self, machine: MachineController, name: str, player: Player, config: dict): """Initialise counter.""" if 'events_when_hit' not in config: # for compatibility post the same default as previously for # counters. This one is deprecated. config['events_when_hit'] = ['counter_' + name + '_hit'] # this is the one moving forward config['events_when_hit'].append('logicblock_' + name + '_hit') super().__init__(machine, name, player, config) self.log = logging.getLogger('Counter.' + name) self.debug_log("Creating Counter LogicBlock") self.delay = DelayManager(self.machine.delayRegistry) self.ignore_hits = False self.hit_value = -1 if not self.config['player_variable']: self.config['player_variable'] = self.name + '_count' '''player_var: (logic_block)_count desc: The default player variable name that's used to store the count value for a counter player variable. Note that the (logic_block) part of the player variable name is replaced with the actual logic block's name. Also note that it's possible to override the player variable name that's used by default and to specify your own name. You do this in the ``player_variable:`` part of the logic block config. ''' self.hit_value = self.config['count_interval'] if self.config['direction'] == 'down' and self.hit_value > 0: self.hit_value *= -1 elif self.config['direction'] == 'up' and self.hit_value < 0: self.hit_value *= -1 if not self.config['persist_state'] or not self.player.is_player_var( self.config['player_variable']): self.player[self.config['player_variable']] = self.config[ 'starting_count'].evaluate([])
def __init__(self, machine, name): """Create the playfield.""" super().__init__(machine, name) self.ball_search = BallSearch(self.machine, self) """An instance of :class:`mpf.core.ball_search.BallSearch` which handles ball search for this playfield.""" self.delay = DelayManager(self.machine.delayRegistry) """An instance of :class:`mpf.core.delays.DelayManager` which handles delays for this playfield.""" self.machine.ball_devices[name] = self # Attributes self._balls = 0 self.available_balls = 0 self.num_balls_requested = 0 self._incoming_balls = []
def __init__(self, machine): """Initialise ball controller.""" super().__init__(machine) self.delay = DelayManager(self.machine.delayRegistry) self.num_balls_known = 0 # register for events self.machine.events.add_handler('request_to_start_game', self.request_to_start_game) self.machine.events.add_handler('init_phase_2', self._initialize) self.machine.events.add_handler('init_phase_4', self._init4, priority=100) self.machine.events.add_handler('shutdown', self._stop) self._add_new_balls_task = None self._captured_balls = asyncio.Queue(loop=self.machine.clock.loop)
def __init__(self, machine): """Initialise switch player.""" self.log = logging.getLogger('switch_player') if 'switch_player' not in machine.config: machine.log.debug('"switch_player:" section not found in ' 'machine configuration, so the Switch Player' 'plugin will not be used.') return self.machine = machine self.delay = DelayManager(self.machine.delayRegistry) self.current_step = 0 self.config = self.machine.config['switch_player'] self.machine.config_validator.validate_config("switch_player", self.config) self.machine.events.add_handler(self.config['start_event'], self._start_event_callback) self.step_list = self.config['steps']
def __init__(self, machine, playfield): """Initialise ball search.""" self.machine = machine self.playfield = playfield self.log = logging.getLogger("BallSearch " + playfield.name) self.delay = DelayManager(self.machine.delayRegistry) self.started = False self.enabled = False self.callbacks = [] self.iteration = False self.iterator = False self.phase = False # register for events self.machine.events.add_handler('request_to_start_game', self.request_to_start_game) self.machine.events.add_handler('cancel_ball_search', self.cancel_ball_search) '''event: cancel_ball_search
def __init__(self, machine, name): """Initialise score reel.""" super().__init__(machine, name) self.delay = DelayManager(machine.delayRegistry) self.value_switches = [] # This is a list with each element corresponding to a value on the # reel. An entry of None means there's no value switch there. An entry # of a reference to a switch object means there # is a switch there. self.hw_sync = False # Specifies whether this reel has verified it's positions via the # switches since it was last advanced.""" self.ready = True # Whether this reel is ready to advance. Typically used to make sure # it's not trying to re-fire a stuck position. self.assumed_value = -999 # The assumed value the machine thinks this reel is showing. A value # of -999 indicates that the value is unknown. self._destination_value = 0 # Holds the index of the destination the reel is trying to advance to. self._runner = None # asyncio task which advances the reel self._busy = asyncio.Event(loop=self.machine.clock.loop) self._busy.set() # will be cleared when the runner is done. set to trigger the runner self._ready = asyncio.Event(loop=self.machine.clock.loop) # will be set when this real is ready and shows the destination value # stop device on shutdown self.machine.events.add_handler("shutdown", self.stop)
def __init__(self, machine: MachineController, playfield: "Playfield") -> None: """Initialize ball search.""" self.module_name = 'BallSearch.' + playfield.name self.config_name = 'ball_search' super().__init__(machine) self.playfield = playfield """The playfield device this ball search instance is attached to.""" self.delay = DelayManager(self.machine) self.started = False """Is the ball search process started (running) now.""" self.enabled = False """Is ball search enabled.""" self.blocked = False """If True, ball search will be blocked and will not start.""" self.callbacks = [] # type: List[BallSearchCallback] self.iteration = False """Current iteration of the ball search, or ``False`` if ball search is not started.""" self.iterator = False self.phase = False """Current phase of the ball search, or ``False`` if ball search is not started.""" # register for events self.machine.events.add_handler('request_to_start_game', self.request_to_start_game) self.machine.events.add_handler('cancel_ball_search', self.cancel_ball_search) '''event: cancel_ball_search
def __init__(self, machine: "MachineController") -> None: """Initialize TextUi.""" super().__init__(machine) self.delay = DelayManager(machine) self.config = machine.config.get('text_ui', {}) self.screen = None if not machine.options['text_ui'] or not Scene: return # hack to add themes until https://github.com/peterbrittain/asciimatics/issues/207 is implemented THEMES["mpf_theme"] = defaultdict( lambda: (Screen.COLOUR_WHITE, Screen.A_NORMAL, Screen.COLOUR_BLACK), { "active_switch": (Screen.COLOUR_BLACK, Screen.A_NORMAL, Screen.COLOUR_GREEN), "pf_active": (Screen.COLOUR_GREEN, Screen.A_NORMAL, Screen.COLOUR_BLACK), "pf_inactive": (Screen.COLOUR_WHITE, Screen.A_NORMAL, Screen.COLOUR_BLACK), "label": (Screen.COLOUR_WHITE, Screen.A_NORMAL, Screen.COLOUR_BLACK), "title": (Screen.COLOUR_WHITE, Screen.A_NORMAL, Screen.COLOUR_RED), "title_exit": (Screen.COLOUR_BLACK, Screen.A_NORMAL, Screen.COLOUR_RED), "footer_cpu": (Screen.COLOUR_CYAN, Screen.A_NORMAL, Screen.COLOUR_BLACK), "footer_path": (Screen.COLOUR_YELLOW, Screen.A_NORMAL, Screen.COLOUR_BLACK), "footer_memory": (Screen.COLOUR_GREEN, Screen.A_NORMAL, Screen.COLOUR_BLACK), "footer_mc_cpu": (Screen.COLOUR_MAGENTA, Screen.A_NORMAL, Screen.COLOUR_BLACK), }) self.start_time = datetime.now() self.machine = machine self.mpf_process = Process() self.ball_devices = list() # type: List[BallDevice] self.switches = {} # type: Dict[str, Switch] self.machine.events.add_handler('init_phase_2', self._init) # self.machine.events.add_handler('init_phase_3', self._init2) self.machine.events.add_handler('loading_assets', self._asset_load_change) self.machine.events.add_handler('bcp_connection_attempt', self._bcp_connection_attempt) self.machine.events.add_handler('asset_loading_complete', self._asset_load_complete) self.machine.events.add_handler('bcp_clients_connected', self._bcp_connected) self.machine.events.add_handler('shutdown', self.stop) self.machine.add_crash_handler(self.stop) self.machine.events.add_handler('player_number', self._update_player) self.machine.events.add_handler('player_ball', self._update_player) self.machine.events.add_handler('player_score', self._update_player) self.machine.events.add_handler('ball_ended', self._update_player) self._pending_bcp_connection = False self._asset_percent = 0 self._bcp_status = (0, 0, 0) # type: Tuple[float, int, int] self.switch_widgets = [] # type: List[Widget] self.mode_widgets = [] # type: List[Widget] self.ball_device_widgets = [] # type: List[Widget] self._machine_widgets = [] # type: List[Widget] self._player_widgets = [] # type: List[Widget] self.footer_memory = None self.footer_cpu = None self.footer_mc_cpu = None self.footer_uptime = None self._layout_change = True self._tick_task = self.machine.clock.schedule_interval(self._tick, 1) self._create_window() self._draw_screen()
def __init__(self, machine: "MachineController", config, name: str, path, asset_paths) -> None: """Initialise mode. Args: ---- machine: the machine controller config: config dict for mode name: name of mode path: path of mode asset_paths: all paths to consider for assets in this mode """ super().__init__() self.machine = machine # type: MachineController self.config = config # type: ignore self.name = name self.path = path self.asset_paths = asset_paths self.priority = 0 self._active = False self._starting = False self._mode_start_wait_queue = None # type: Optional[QueuedEvent] self.stop_methods = list( ) # type: List[Tuple[Callable[[Any], None], Any]] self.start_callback = None # type: Optional[Callable[[], None]] self.stop_callbacks = [] # type: List[Callable[[], None]] self.event_handlers = set() # type: Set[EventHandlerKey] self.switch_handlers = list() # type: List[SwitchHandler] self.mode_stop_kwargs = dict() # type: Dict[str, Any] self.mode_devices = set() # type: Set[ModeDevice] self.start_event_kwargs = {} # type: Dict[str, Any] self.stopping = False self.delay = DelayManager(self.machine) '''DelayManager instance for delays in this mode. Note that all delays scheduled here will be automatically canceled when the mode stops.''' self.player = None # type: Optional[Player] '''Reference to the current player object.''' self.configure_logging('Mode.' + name, self.config['mode']['console_log'], self.config['mode']['file_log']) self.configure_mode_settings(config.get('mode', dict())) self.auto_stop_on_ball_end = self.config['mode']['stop_on_ball_end'] '''Controls whether this mode is stopped when the ball ends, regardless of its stop_events settings. ''' self.restart_on_next_ball = self.config['mode']['restart_on_next_ball'] '''Controls whether this mode will restart on the next ball. This only works if the mode was running when the ball ended. It's tracked per- player in the 'restart_modes_on_next_ball' player variable. ''' if self.config['mode'][ 'game_mode'] and not self.config['mode']['stop_on_ball_end']: self.raise_config_error( "All game modes need to stop at ball end. If you want to set stop_on_ball_end to " "False also set game_mode to False.", 1)
def __init__(self, machine, config: dict, name: str, path): """Initialise mode. Args: machine(mpf.core.machine.MachineController): the machine controller config: config dict for mode name: name of mode path: path of mode Returns: """ self.machine = machine self.config = config self.name = name.lower() self.path = path self.log = logging.getLogger('Mode.' + name) self.delay = DelayManager(self.machine.delayRegistry) self.priority = 0 self._active = False self._mode_start_wait_queue = None self.stop_methods = list() self.timers = dict() self.start_callback = None self.stop_callback = None self.event_handlers = set() self.switch_handlers = list() self.mode_stop_kwargs = dict() self.mode_devices = set() self.start_event_kwargs = None self.stopping = False self.player = None '''Reference to the current player object.''' self._create_mode_devices() self._validate_mode_config() self._initialise_mode_devices() self.configure_mode_settings(config.get('mode', dict())) self.auto_stop_on_ball_end = self.config['mode']['stop_on_ball_end'] '''Controls whether this mode is stopped when the ball ends, regardless of its stop_events settings. ''' self.restart_on_next_ball = self.config['mode']['restart_on_next_ball'] '''Controls whether this mode will restart on the next ball. This only works if the mode was running when the ball ended. It's tracked per- player in the 'restart_modes_on_next_ball' player variable. ''' # Call registered remote loader methods for item in self.machine.mode_controller.loader_methods: if (item.config_section and item.config_section in self.config and self.config[item.config_section]): item.method(config=self.config[item.config_section], mode_path=self.path, mode=self, root_config_dict=self.config, **item.kwargs) elif not item.config_section: item.method(config=self.config, mode_path=self.path, **item.kwargs) self.mode_init()
def __init__(self, machine): """Initialise smart virtual platform.""" super().__init__(machine) self.delay = DelayManager(self.machine.delayRegistry) self.actions = {} # type: Dict[BallDevice, AddBallToTargetAction]
def __init__(self, mpf_path: str, machine_path: str, options: dict) -> None: """Initialize machine controller.""" super().__init__() self.log = logging.getLogger("Machine") # type: Logger self.log.info("Mission Pinball Framework Core Engine v%s", __version__) self.log.info("Command line arguments: %s", options) self.options = options self.config_processor = ConfigProcessor() self.log.info("MPF path: %s", mpf_path) self.mpf_path = mpf_path self.log.info("Machine path: %s", machine_path) self.machine_path = machine_path self.verify_system_info() self._exception = None # type: Any self._boot_holds = set() # type: Set[str] self.is_init_done = None # type: asyncio.Event self._done = False self.monitors = dict() # type: Dict[str, Set[Callable]] self.plugins = list() # type: List[Any] self.scriptlets = list() # type: List[Scriptlet] self.modes = DeviceCollection(self, 'modes', None) # type: Dict[str, Mode] self.game = None # type: Game self.machine_vars = dict() self.machine_var_monitor = False self.machine_var_data_manager = None # type: DataManager self.thread_stopper = threading.Event() self.config = None # type: Any # add some type hints MYPY = False # noqa if MYPY: # pragma: no cover # controllers self.events = None # type: EventManager self.switch_controller = None # type: SwitchController self.mode_controller = None # type: ModeController self.settings = None # type: SettingsController self.bcp = None # type: Bcp self.asset_manager = None # type: BaseAssetManager self.ball_controller = None # type: BallController self.show_controller = None # type: ShowController self.placeholder_manager = None # type: PlaceholderManager self.device_manager = None # type: DeviceManager self.auditor = None # type: Auditor self.tui = None # type: TextUi self.service = None # type: ServiceController # devices self.autofires = None # type: DeviceCollectionType[str, AutofireCoil] self.motors = None # type: DeviceCollectionType[str, Motor] self.digital_outputs = None # type: DeviceCollectionType[str, DigitalOutput] self.shows = None # type: DeviceCollectionType[str, Show] self.shots = None # type: DeviceCollectionType[str, Shot] self.shot_groups = None # type: DeviceCollectionType[str, ShotGroup] self.switches = None # type: DeviceCollectionType[str, Switch] self.coils = None # type: DeviceCollectionType[str, Driver] self.lights = None # type: DeviceCollectionType[str, Light] self.ball_devices = None # type: DeviceCollectionType[str, BallDevice] self.accelerometers = None # type: DeviceCollectionType[str, Accelerometer] self.playfield = None # type: Playfield self.playfields = None # type: DeviceCollectionType[str, Playfield] self.counters = None # type: DeviceCollectionType[str, Counter] self.sequences = None # type: DeviceCollectionType[str, Sequence] self.accruals = None # type: DeviceCollectionType[str, Accrual] self.drop_targets = None # type: DeviceCollectionType[str, DropTarget] self.servos = None # type: DeviceCollectionType[str, Servo] self.segment_displays = None # type: DeviceCollectionType[str, SegmentDisplay] self._set_machine_path() self.config_validator = ConfigValidator(self) self._load_config() self.machine_config = self.config # type: Any self.configure_logging( 'Machine', self.config['logging']['console']['machine_controller'], self.config['logging']['file']['machine_controller']) self.delayRegistry = DelayManagerRegistry(self) self.delay = DelayManager(self.delayRegistry) self.hardware_platforms = dict() # type: Dict[str, SmartVirtualHardwarePlatform] self.default_platform = None # type: SmartVirtualHardwarePlatform self.clock = self._load_clock() self.stop_future = asyncio.Future(loop=self.clock.loop) # type: asyncio.Future
def __init__(self, machine: MachineController, name: str) -> None: """Initialise driver.""" self.hw_driver = None # type: DriverPlatformInterface super().__init__(machine, name) self.delay = DelayManager(self.machine) self.platform = None # type: DriverPlatform
def __init__(self, machine): """Initialise flasher_player.""" super().__init__(machine) self.delay = DelayManager(self.machine.delayRegistry)
def __init__(self, machine): """Initialise smart virtual platform.""" super().__init__(machine) self.delay = DelayManager(self.machine.delayRegistry)