Skip to content

Lights using Previous inconsistently error depending on how much you've forgotten to configure #1946

@bosh

Description

@bosh

This is a fun one.

On latest dev (57.4 candidate), virtual platform (I'm using FAST-numbered lights, but this issue occurs in virtual, untested against real hardware)

Command: mpf game -btx

The config:

hardware: platform: fast
fast: exp: boards: exp: model: FP-0081-1 # doesnt matter which one, just providing the lighting base name
lights:
  one:
    number: exp-1-1 # on FAST this light defaults to RGB channeling with no type specified
  two:
    previous: one

Will crash saying Previous requires a type, around attract mode startup (example uses light name l_pop_ring_b_2):

17:44:08.594 : INFO [EventManager] Event: ======'machine_reset_phase_3'====== Args={}
17:44:08.594 : INFO [EventManager] Event: ======'mode_tilt_will_start'====== Args={'queue': <QueuedEvent>}
17:44:08.594 : INFO [EventManager] Event: ======'mode_tilt_starting'====== Args={'queue': <QueuedEvent>}
17:44:08.594 : INFO [drop_target_bank.slots_target_bank] All targets are already up. Will not reset bank.
17:44:08.595 : INFO [EventManager] Event: ======'diverter_orbit_diverter_deactivating'====== Args={}
17:44:08.595 : INFO [coil.c_orbit_diverter_full] Disabling Driver
17:44:08.595 : INFO [EventManager] Event: ======'diverter_orbit_diverter_skillshot_deactivating'====== Args={}
17:44:08.595 : INFO [coil.c_orbit_diverter_full] Disabling Driver
17:44:08.595 : INFO [EventManager] Event: ======'diverter_div_right_controlled_ball_gate_deactivating'====== Args={}
17:44:08.595 : INFO [coil.c_gate_right] Disabling Driver
17:44:08.595 : INFO [EventManager] Event: ======'diverter_div_right_controlled_ball_gate_alternative_profile_deactivating'====== Args={}
17:44:08.595 : INFO [coil.c_gate_right] Disabling Driver
17:44:08.595 : INFO [EventManager] Event: ======'diverter_div_left_controlled_ball_gate_deactivating'====== Args={}
17:44:08.595 : INFO [coil.c_gate_left] Disabling Driver
17:44:08.595 : INFO [EventManager] Event: ======'diverter_div_saver_post_deactivating'====== Args={}
17:44:08.595 : INFO [coil.c_saver_post] Disabling Driver
17:44:08.595 : INFO [EventManager] Event: ======'diverter_div_right_outlane_post_deactivating'====== Args={}
17:44:08.595 : INFO [coil.c_right_outlane_post] Disabling Driver
17:44:08.595 : INFO [EventManager] Event: ======'diverter_div_right_outlane_post_ramp_save_deactivating'====== Args={}
17:44:08.595 : INFO [coil.c_right_outlane_post] Disabling Driver
17:44:08.595 : INFO [Mode.tilt] Will not start because machine is shutting down.
17:44:08.595 : INFO [EventManager] Event: ======'reset_complete'====== Args={}
17:44:08.595 : INFO [EventManager] Event: ======'mode_service_will_start'====== Args={}
17:44:08.596 : INFO [EventManager] Event: ======'mode_service_starting'====== Args={}
17:44:08.596 : INFO [EventManager] Event: ======'mode_attract_will_start'====== Args={}
17:44:08.596 : INFO [Timer.attract_carousel_timer] Starting Timer.
17:44:08.596 : INFO [EventManager] Event: ======'timer_attract_carousel_timer_started'====== Args={'ticks': 0, 'ticks_remaining': 1}
17:44:08.596 : INFO [EventManager] Event: ======'timer_attract_carousel_timer_tick'====== Args={'ticks': 0, 'ticks_remaining': 1}
17:44:08.596 : INFO [EventManager] Event: ======'mode_attract_starting'====== Args={}
17:44:08.596 : INFO [Mode.attract] Will not start because machine is shutting down.
17:44:08.596 : INFO [Mode.service] Will not start because machine is shutting down.
17:44:08.597 : ERROR [asyncio] Task was destroyed but it is pending!
task: <Task pending name='Task-497' coro=<IocpProactor.accept.<locals>.accept_coro() running at C:\Users\Bosh\AppData\Local\Programs\Python\Python313\Lib\asyncio\windows_events.py:567> wait_for=<_OverlappedFuture cancelled>>
17:44:08.598 : ERROR [Machine] Runtime Exception
Traceback (most recent call last):
  File "C:\Users\Bosh\workspace\mpf\mpf\core\machine.py", line 810, in _run_loop
    raise self._exception['exception']
  File "C:\Users\Bosh\workspace\mpf\mpf\core\system_wide_device.py", line 17, in device_added_system_wide
    await self._initialize()
  File "C:\Users\Bosh\workspace\mpf\mpf\devices\light.py", line 311, in _initialize
    self._load_hw_driver_sequentially(start_channel)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
  File "C:\Users\Bosh\workspace\mpf\mpf\devices\light.py", line 202, in _load_hw_driver_sequentially
    self.raise_config_error("Cannot use previous or start_channel without type. "
    ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                            "Add a type setting to your light.", 2)
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Bosh\workspace\mpf\mpf\core\logging.py", line 175, in raise_config_error
    raise ConfigFileError(msg, error_no, self.log.name if self.log else "", context, self._url_base) \
        from source_exception
mpf.exceptions.config_file_error.ConfigFileError: Config File Error in light.l_pop_ring_b_2: Cannot use previous or start_channel without type. Add a type setting to your light. Error Code: CFE-light-2 (https://missionpinball.org/logs)

But this config, where two lights both use previous, where the last one in the chain even says type: rgb (so only the middle one is missing type)

lights:
  one:
    number: exp-1-1
  two:
    previous: one
  three
    previous: two
    type: rgb

This config will instead stop processing forward in init_phase_1, much earlier.

17:50:14.109 : INFO [Machine] Initializing MPF...
17:50:14.152 : INFO [EventManager] Event: ======'machine_var_credits_string'====== Args={'value': 'FREE PLAY', 'prev_value': None, 'change': True}
17:50:14.163 : INFO [EventManager] Event: ======'machine_var_master_volume'====== Args={'value': 0.75, 'prev_value': None, 'change': True}
17:50:14.163 : INFO [EventManager] Event: ======'machine_var_music_volume'====== Args={'value': 0.75, 'prev_value': None, 'change': True}
17:50:14.163 : INFO [EventManager] Event: ======'machine_var_player1_score'====== Args={'value': 104000, 'prev_value': None, 'change': True}
17:50:14.163 : INFO [EventManager] Event: ======'machine_var_voice_volume'====== Args={'value': 0.75, 'prev_value': None, 'change': True}
17:50:14.163 : INFO [EventManager] Event: ======'machine_var_mpf_version'====== Args={'value': 'Mission Pinball Framework v0.57.4.dev3', 'prev_value': None, 'change': True}
17:50:14.163 : INFO [EventManager] Event: ======'machine_var_mpf_extended_version'====== Args={'value': 'Mission Pinball Framework v0.57.4.dev3, Config version:6, Show version: 6, BCP version:1.1', 'prev_value': None, 'change': True}
17:50:14.163 : INFO [EventManager] Event: ======'machine_var_python_version'====== Args={'value': '3.13.9', 'prev_value': None, 'change': True}
17:50:14.201 : INFO [EventManager] Event: ======'machine_var_platform'====== Args={'value': 'Windows-11-10.0.26200-SP0', 'prev_value': None, 'change': True}
17:50:14.201 : INFO [EventManager] Event: ======'machine_var_platform_system'====== Args={'value': 'Windows', 'prev_value': None, 'change': True}
17:50:14.201 : INFO [EventManager] Event: ======'machine_var_platform_release'====== Args={'value': '11', 'prev_value': None, 'change': True}
17:50:14.201 : INFO [EventManager] Event: ======'machine_var_platform_version'====== Args={'value': '10.0.26200', 'prev_value': None, 'change': True}
17:50:14.201 : INFO [EventManager] Event: ======'machine_var_platform_machine'====== Args={'value': 'AMD64', 'prev_value': None, 'change': True}
17:50:14.201 : INFO [EventManager] Event: ======'machine_var_log_file_path'====== Args={'value': '', 'prev_value': None, 'change': True}
17:50:14.201 : INFO [EventManager] Event: ======'init_phase_1'====== Args={}

My theory is that light three using previous looks up light two, which has some crash or inconsistent behavior early on in the setup, which fails and then blocks the queue event hook init_phase_1 is waiting on from finishing, so the game just stops.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions