Service Mode - Crashes on loading

99 views
Skip to first unread message

Time

unread,
Jul 2, 2018, 12:16:20 AM7/2/18
to MPF Users

Running 0.50.11

Running a very simple config just to test service mode and volume control. On Door open switch activation, service mode tries to load and crashes MPF. In the logs it says "<Text Widget text=> has an invalid style name: small" 

I have not set any text widgets with small style name so I'm assuming this is coming from the default service screen itself? Any advice or tips to fix this? Anyone have service working on their games?

Thanks,
- Jayson

driskel

unread,
Jul 2, 2018, 12:21:55 AM7/2/18
to MPF Users
Not sure if this will work or not.

I was looking at the source code for mpf and base implementation has the following slides.  Try adding these to your config for the service mode and pull the styles out of them.  I am curious to hear the results. 

Good luck.


slides
:
 
# door open
  service_door_open
:
 
- type: text
    text
: Door Open
    style
: medium
    anchor_y
: bottom
    x
: center
    y
: bottom+21
 
- type: text
    text
: Press enter for service
    style
: small
    anchor_y
: bottom
    x
: center
    y
: bottom+12
 
# menu
  service_menu
:
 
- type: text
    text
: Service Menu
    style
: small
    anchor_y
: top
    x
: center
    y
: top
 
# switch test
  service_switch_test
:
 
- type: text
    text
: Switch Test
    style
: small
    anchor_y
: top
    x
: center
    y
: top
 
- type: text
    text
: "Last: (switch_num)"
    style
: small
    y
: center+6
 
- type: text
    text
: "(switch_name)"
    style
: small
    y
: center
 
- type: text
    text
: "(switch_label)"
    style
: small
    y
: center-6
 
- type: text
    text
: (switch_state)
    style
: small
    anchor_y
: bottom
    y
: bottom
 
# coil test
  service_coil_test
:
 
- type: text
    text
: "Coil Test - (board_name)"
    style
: small
    anchor_y
: top
    x
: center
    y
: top
 
- type: text
    text
: "(coil_name)"
    style
: small
    y
: center+6
 
- type: text
    text
: "(coil_label)"
    style
: small
    y
: center
 
- type: text
    text
: "(coil_num)"
    style
: small
    y
: center-6
 
# coil test
  service_light_test
:
 
- type: text
    text
: "Light Test - (board_name)"
    style
: small
    anchor_y
: top
    x
: center
    y
: top
 
- type: text
    text
: "(light_name)"
    style
: small
    y
: center+6
 
- type: text
    text
: "(light_label)"
    style
: small
    y
: center
 
- type: text
    text
: "(light_num)/(test_color)"
    style
: small
    y
: center-6
 
# settings
  service_settings
:
 
- type: text
    text
: "Settings"
    style
: small
    anchor_y
: top
    x
: center
    y
: top
 
- type: text
    text
: "(settings_label)"
    style
: small
    y
: center+6
 
- type: text
    text
: "(value_label)"
    style
: small
    y
: center


Time

unread,
Jul 2, 2018, 12:51:05 AM7/2/18
to MPF Users
No dice. I removed the styles and placed these slide definitions both in the master config file and the ~/service_mode/config/config.yaml

I'm still getting invalid style name. Stupid question but do I need to define style names somehow in a total new mostly empty config? The only thing I have defined in this config is some test switches and sounds, service buttons, and call for service mode.

018-07-01 20:59:31,985 : mpfmc : SlidePlayer: Play called with settings={'slides': {'service_menu': {'action': 'play', 'show': True, 'background_color': [0.0, 0.0, 0.0, 1.0], 'force': False, 'target': None, 'slide': None, 'transition_out': None, 'priority': 1, 'expire': None, 'transition': None}}}
2018-07-01 20:59:31,989 : kivy : Base: Leaving application in progress...
2018-07-01 20:59:31,989 : kivy : <Text Widget text=> has an invalid style name: small
Traceback (most recent call last):
 
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/mpfmc/uix/widget.py", line 383, in _apply_style
    style
= self.mc.machine_config['widget_styles'][self.config['style']]
KeyError: 'small'

driskel

unread,
Jul 2, 2018, 12:54:25 AM7/2/18
to MPF Users
your mode structure should look like this

/modes/service/config/service.yaml

and the slides would go in there.



driskel

unread,
Jul 2, 2018, 12:56:55 AM7/2/18
to MPF Users
you could try defining the missing widget_styles in

/config/config.yaml

that might work

jabdoa

unread,
Jul 2, 2018, 1:08:47 AM7/2/18
to MPF Users
You can find a working example here: https://github.com/missionpinball/mpf-mc/blob/dev/mpfmc/integration/machine_files/service_mode/config/config.yaml. I guess we should either remove the styles from the default slides or add them to the default config as well.


Jan

Time

unread,
Jul 2, 2018, 1:10:19 AM7/2/18
to MPF Users
This example has it in a different location. http://docs.missionpinball.org/en/latest/examples/service_mode/

I have tried putting it in the modes folder too and it just automatically loads service on boot and then crashes with the same error. So I'm not sure which is actually proper location for service config at this point.

driskel

unread,
Jul 2, 2018, 1:32:24 AM7/2/18
to MPF Users
when you put it in the modes folder, did you name the directory service or service_mode?  service is what I believe it should be.

Time

unread,
Jul 2, 2018, 1:55:13 AM7/2/18
to MPF Users
Ok I got it working by defining the default styles in config/config.yaml:

widget_styles:
  text_default
:
    font_size
: 16
    adjust_top
: 2
    adjust_bottom
: 3
  medium
:
    font_size
: 8
    adjust_top
: 1
    adjust_bottom
: 1
  small
:
    font_size
: 9
    adjust_top
: 2
    adjust_bottom
: 3

I'm able to enter and exit service mode now.

Time

unread,
Jul 2, 2018, 2:00:10 AM7/2/18
to MPF Users
whenever I put a config in: ~/modes/service/config/service.yaml

It automatically tries to boot service mode on startup. Then it fails giving me the undefined style error even though I've since defined those style in the master config. If I don't put that service.yaml file in the modes folder and instead use ~/service_mode/config.yaml everything works. This is a mystery to me

Greg Sealby

unread,
May 4, 2019, 7:29:38 AM5/4/19
to MPF Users
Thanks guys for posting this one.  I had the same issue and was able to rectify it quickly by adding the widget styles defined below.  Jan, I think it would be handy to add this into the doco.  The text sizes come out very small on an LCD screen.

Now that I have it working I'd like to customise the look and feel but am not sure how the navigation and inputs work.  Does anyone have some tips (or a working example) that cycles through the options (Settings, Switches etc) and allows for options to be selected?  Driskel, I might use your slides as a base to overwrite the out of box service mode slides but not sure how to configure the events to make them interactive.

Do you need to add _overwrite: true to the top of the slides: placeholder?

Greg Sealby

unread,
May 4, 2019, 12:19:27 PM5/4/19
to MPF Users
OK, so I have since tried a few things and thought others might benefit from an update on my progress so far.

  1. I tried to create a service config YAML file under my modes directory ~/modes/service/config/service.yaml and this gave me an error:  FileNotFoundError: The file associated with the disk-based asset 'power_off' declared in the 'sounds' config section could not be found.  I checked the service.yaml in my MPF setup and found it needs two sound files (power_off and switch_hit) so I added sound config for both of those and tried again.  Same result.
  2. I tried moving the slides into config.yaml and received an error: AssertionError: bcp connection local_display not found, probably because the displays have not been set at this stage ... not sure.
  3. I then put the slides into my attract mode config file as this is running at the start of the game ... and they all seemed to work fine.  I changed background colours, fonts etc.  All good.  I was able to modify a few settings and they saved correctly.
Clearly, I don't want this to run in attract mode as it is not always active.  So, I'll try tomorrow with a new mode (that starts and ends with the machine startup/shutdown) named something else other than "service" and put all my custom screens in there and see if this works.  I'll update again with my progress.


jabdoa

unread,
May 4, 2019, 4:27:06 PM5/4/19
to MPF Users
Those sounds should be part of MPF. Not sure why it cannot find them. Those slides should work inside the service mode. Can you post your mode so I can try it?


Jan

Greg Sealby

unread,
May 4, 2019, 7:59:58 PM5/4/19
to MPF Users
Thanks Jan.  Attached are my YAMLs for service mode, located in ~\{machine_dir}\modes\service\config

I also attached my MC and MPF logs which contain details of the error.
service.yaml
service_slides.yaml
2019-05-05-09-53-55-mc-LAPTOP-PPHMBS71.log
2019-05-05-09-53-55-mpf-LAPTOP-PPHMBS71.log

jabdoa

unread,
May 5, 2019, 4:17:33 AM5/5/19
to MPF Users
It complained about the missing sounds which is kind of weird. You can overwrite the sound_player as a workaround of you want. Not sure why that happens for you. Seems to work for me.

Jan

Greg Sealby

unread,
May 5, 2019, 10:00:17 AM5/5/19
to MPF Users
Jan, is it possible to add other menus in the YAML or do you need to change the python for that?

jabdoa

unread,
May 5, 2019, 11:42:58 AM5/5/19
to MPF Users
Currently you can only add settings in config: http://docs.missionpinball.org/en/dev/config/settings.html. I started to document that for tilt and credits yesterday (runtime settings for those modes will be available in 0.53/dev). If you want entire new menues with functionality than you need to overload the mode code.


Jan

Matt Irwin

unread,
May 11, 2019, 5:38:34 PM5/11/19
to MPF Users
I have the service mode running and ended up just putting the sounds that it was looking for (I pulled them out of the mpf install itself) in my games directory structure and it worked fine. Not desired behavior but it was one that I could around. 

Matt Irwin

unread,
May 11, 2019, 5:49:41 PM5/11/19
to MPF Users
I put the sounds needed for my machine in the (game_directory)/modes/service/sounds directory.  With  power_off.ogg and switch_hit.ogg there  service mode works fine for me. 


Matt

jabdoa

unread,
May 11, 2019, 6:03:49 PM5/11/19
to MPF Users
Thanks for the feedback! This should not be needed and I created issue #1366 (https://github.com/missionpinball/mpf/issues/1366).

Can you post your sound and asset config? That might be related to why it does not load those sounds.


Jan

Matt Irwin

unread,
May 11, 2019, 8:45:22 PM5/11/19
to MPF Users

assets:

    images:

      default:

           load: preload

      preload:

           load: preload

      on_demand:

           load: on_demand

      mode_start:

           load: mode_start

    sounds:

      default:

           load: on_demand

      music:

           track: music

      sfx:

           track: sfx

      voice:

           track: voice



sound_system:

    buffer: 2048

    channels: 2

    use_sdl_mixer_loader: False

    enabled: True

    frequency: 22050

    master_volume: 0.85

    tracks:

       music:

          simultaneous_sounds: 1

          events_when_stopped: music_track_stopped

          events_when_played: music_track_played, keep_going

          events_when_paused: music_track_paused

          volume: 0.5

       voice:

          simultaneous_sounds: 1

          volume: 0.7

       sfx:

          simultaneous_sounds: 8

          volume: 0.4




sounds:


#music


    Hope:

        file: Hope22.ogg

        #streaming: True

        track: music

        #volume: -4.5 db

        priority: 50

        mode_end_action: stop


    Calm:

        file: Calm22.ogg

        #streaming: True

        track: music

        #volume: -4.5 db

        priority: 50

        mode_end_action: stop


    Idle:

        file: IdleTheme-TheKingdomsBallad.ogg

        #streaming: True

        track: music

        #volume: -4.5 db

        priority: 50

        mode_end_action: stop



    GreenKnightSong:

        file: greenknight.ogg

        #streaming: True

        track: music

        #volume: -4.5 db

        priority: 70

        mode_end_action: stop



    FisherKing:

        file: Fisher_King.ogg

        #streaming: True

        track: music

        #volume: -4.5 db

        priority: 70

        mode_end_action: stop



    Morgana:

        file: morgana.ogg

        #streaming: True

        track: music

        #volume: -4.5 db

        priority: 90

        mode_end_action: stop



    ShopTheme:

        file: shop_theme.ogg

        #streaming: True

        track: music

        #volume: -4.5 db

        priority: 90

        mode_end_action: stop



    GrailQuest:

        file: grail_quest.ogg

        #streaming: True

        track: music

        #volume: -4.5 db

        priority: 90

        mode_end_action: stop


    RoundTable:

        file: round_table.ogg

        #streaming: True

        track: music

        #volume: -4.5 db

        priority: 90

        mode_end_action: stop



(this part goes on for a bit separated into the music / sfx / and voices. with ducking turned on for most of those) 

Greg Sealby

unread,
Jan 14, 2020, 6:40:47 AM1/14/20
to MPF Users
Something I just identified that might be a trap for some regarding Service Mode.  The slide config seems to have to reside within the service.yaml file.  I had the following at the top of my service.yaml file:
config:
   
- service_slides.yaml

I kept getting the following error:
2020-01-14 22:26:18,932 : INFO : ConfigProcessor : Loading config: c:\Projects\Code Repositories\Pinball Machines\Game_Folder\modes\service\config\service_slides.yaml
2020-01-14 22:26:18,937 : ERROR : asyncio : Exception in callback EventManager._async_handler_done(<QueuedEvent>)(<Task finishe...=KeyError(0,)>) at c:\users\username\appdata\local\programs\python\python36\lib\site-packages\mpf\core\events.py:99
handle
: <Handle EventManager._async_handler_done(<QueuedEvent>)(<Task finishe...=KeyError(0,)>) at c:\users\username\appdata\local\programs\python\python36\lib\site-packages\mpf\core\events.py:99>

Traceback (most recent call last):

 
File "c:\users\username\appdata\local\programs\python\python36\lib\asyncio\events.py", line 145, in _run
   
self._callback(*self._args)
 
File "c:\users\username\appdata\local\programs\python\python36\lib\site-packages\mpf\core\events.py", line 102, in _async_handler_done
    future
.result()
 
File "c:\users\username\appdata\local\programs\python\python36\lib\site-packages\mpf\core\mode_controller.py", line 110, in load_modes
   
self.machine.modes[mode] = self._load_mode(mode)
 
File "c:\users\username\appdata\local\programs\python\python36\lib\site-packages\mpf\core\mode_controller.py", line 259, in _load_mode
    config
= self._load_mode_config(mode_string)
 
File "c:\users\username\appdata\local\programs\python\python36\lib\site-packages\mpf\core\mode_controller.py", line 177, in _load_mode_config
    store_to_cache
=self.machine.options['create_config_cache'])
 
File "c:\users\username\appdata\local\programs\python\python36\lib\site-packages\mpf\core\config_processor.py", line 115, in load_config_files_with_cache
    config
= Util.dict_merge(config, file_config)
 
File "c:\users\username\appdata\local\programs\python\python36\lib\site-packages\mpf\core\utility_functions.py", line 228, in dict_merge
    result
[k] = Util.dict_merge(result[k], v)
 
File "c:\users\username\appdata\local\programs\python\python36\lib\site-packages\mpf\core\utility_functions.py", line 230, in dict_merge
   
if isinstance(v, dict) and v[0] == dict(_overwrite=True):
KeyError: 0
2020-01-14 22:26:18,966 : INFO : Machine : Starting the main run loop.
2020-01-14 22:26:18,968 : INFO : Machine : Shutting down...
2020-01-14 22:26:18,973 : INFO : EventManager : Event: ======'shutdown'====== Args={}
2020-01-14 22:26:18,977 : ERROR : Machine : Runtime Exception

Traceback (most recent call last):

 
File "c:\users\username\appdata\local\programs\python\python36\lib\site-packages\mpf\core\machine.py", line 765, in _run_loop
   
raise self._exception['exception']
 
File "c:\users\username\appdata\local\programs\python\python36\lib\asyncio\events.py", line 145, in _run
   
self._callback(*self._args)
 
File "c:\users\username\appdata\local\programs\python\python36\lib\site-packages\mpf\core\events.py", line 102, in _async_handler_done
    future
.result()
 
File "c:\users\username\appdata\local\programs\python\python36\lib\site-packages\mpf\core\mode_controller.py", line 110, in load_modes
   
self.machine.modes[mode] = self._load_mode(mode)
 
File "c:\users\username\appdata\local\programs\python\python36\lib\site-packages\mpf\core\mode_controller.py", line 259, in _load_mode
    config
= self._load_mode_config(mode_string)
 
File "c:\users\username\appdata\local\programs\python\python36\lib\site-packages\mpf\core\mode_controller.py", line 177, in _load_mode_config
    store_to_cache
=self.machine.options['create_config_cache'])
 
File "c:\users\username\appdata\local\programs\python\python36\lib\site-packages\mpf\core\config_processor.py", line 115, in load_config_files_with_cache
    config
= Util.dict_merge(config, file_config)
 
File "c:\users\username\appdata\local\programs\python\python36\lib\site-packages\mpf\core\utility_functions.py", line 228, in dict_merge
    result
[k] = Util.dict_merge(result[k], v)
 
File "c:\users\username\appdata\local\programs\python\python36\lib\site-packages\mpf\core\utility_functions.py", line 230, in dict_merge
   
if isinstance(v, dict) and v[0] == dict(_overwrite=True):
KeyError: 0
2020-01-14 22:26:18,980 : INFO : root : MPF run loop ended.

Slitting out my slide configs into a separate file is a standard I have in my game to reduce the size of the main file.

I commented out this config statement and moved all of my slide and widget config into the main service.yaml file and the service mode started working.

jabdoa

unread,
Jan 14, 2020, 12:14:49 PM1/14/20
to MPF Users
I guess the order in which configs are merged breaks this. Probably something we could fix.

Jan

Greg Sealby

unread,
Jan 15, 2020, 9:48:03 AM1/15/20
to MPF Users
Do you  want me to update the doco with this workaround?

jabdoa

unread,
Jan 15, 2020, 1:36:44 PM1/15/20
to MPF Users
I would love that. Always help to get a small hint when something goes wrong.

Jan

Reply all
Reply to author
Forward
0 new messages