Skip to content

Commit

Permalink
Merge pull request #1399 from missionpinball/reserve_keys_in_show_tokens
Browse files Browse the repository at this point in the history
Reserve keys in show tokens
  • Loading branch information
jabdoa2 committed Aug 6, 2019
2 parents 67a7ba5 + 8557aa3 commit 0979965
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
13 changes: 13 additions & 0 deletions mpf/config_players/show_player.py
@@ -1,6 +1,11 @@
"""Show config player."""
from mpf.config_players.device_config_player import DeviceConfigPlayer

reserved_keys = ["show", "priority", "speed", "block_queue", "start_step", "loops", "sync_ms", "manual_advance",
"key", "show_tokens", "events_when_played", "events_when_stopped", "events_when_looped",
"events_when_paused", "events_when_resumed", "events_when_advanced",
"events_when_stepped_back", "events_when_updated", "events_when_completed"]


class ShowPlayer(DeviceConfigPlayer):

Expand Down Expand Up @@ -57,6 +62,14 @@ def _expand_device(self, device):
devices[index] = self.machine.placeholder_manager.parse_conditional_template(device_entry)
return devices

def _expand_device_config(self, device_settings):
"""Validate show_tokens."""
for key in reserved_keys:
if key in device_settings["show_tokens"]:
self.raise_config_error("Key {} is not allowed in show_tokens of your show_player because it is also "
"an option in show_player. Did indent that option too far?".format(key), 1)
return device_settings

def handle_subscription_change(self, value, settings, priority, context):
"""Handle subscriptions."""
instance_dict = self._get_instance_dict(context)
Expand Down
3 changes: 3 additions & 0 deletions mpf/platforms/spike/spike.py
Expand Up @@ -972,6 +972,9 @@ def _initialize(self) -> Generator[int, None, None]: # noqa: MC0001

self.log.debug("Resetting node bus and configuring traffic.")
yield from self.send_cmd_sync(0, SpikeNodebus.Reset, bytearray())
# wait 3s (same as spike)
for _ in range(12):
yield from self._send_raw(bytearray([1, 250]))

yield from self.send_cmd_sync(0, SpikeNodebus.SetTraffic, bytearray([34])) # block traffic (false)
yield from self.send_cmd_sync(0, SpikeNodebus.SetTraffic, bytearray([17])) # set traffic
Expand Down

0 comments on commit 0979965

Please sign in to comment.