Skip to content

Commit

Permalink
Merge pull request #1797 from missionpinball/service-mode-refactor-0.80
Browse files Browse the repository at this point in the history
Service Mode Refactor for 0.80
  • Loading branch information
avanwinkle committed Jun 28, 2024
2 parents 17c6984 + d87b33d commit a230102
Show file tree
Hide file tree
Showing 12 changed files with 302 additions and 509 deletions.
6 changes: 3 additions & 3 deletions mpf/core/bcp/bcp_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,10 @@ def remove_registered_trigger_event_for_client(self, client, event):
if not self.machine.bcp.transport.get_transports_for_handler(event):
self.machine.events.remove_handler_by_event(event=event, handler=self.bcp_trigger)

async def _bcp_receive_set_machine_var(self, client, name, value):
async def _bcp_receive_set_machine_var(self, client, name, value, persist=False):
"""Set machine var via bcp."""
del client
self.machine.variables.set_machine_var(name, value)
self.machine.variables.set_machine_var(name, value, persist)
# document variables injected by MC
'''machine_var: mc_version
Expand Down Expand Up @@ -472,7 +472,7 @@ def _monitor_machine_vars_stop(self, client):
self.machine.machine_var_monitor = False

def _send_machine_settings(self, client, setting_type=None):
settings = [setting_type] if setting_type else ["standard", "feature", "game", "coin"]
settings = [setting_type] if setting_type else ["standard", "feature", "game", "coin", "hw_volume"]
for s in settings:
self.machine.bcp.transport.send_to_client(
client, bcp_command='settings',
Expand Down
6 changes: 3 additions & 3 deletions mpf/core/config_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,12 @@ def _check_sections(self, config_spec, config, config_type, filename, ignore_unk

deprecated_080 = ["sound_pools"]
invalid_080 = ["playlists", "playlist_player", "slides", "sounds", "sound_loop_player",
"sound_loop_sets", "sound_system", "track_player", "widgets"]
"sound_loop_sets", "sound_system", "track_player", "widgets"]
for k in config.keys():
if k in config_spec:
if k in deprecated_080:
self.log.warning("Config section '%s' is deprecated in MPF 0.80 and will be unsupported in future versions. "
"Please migrate this config to GMC.", k)
self.log.warning("Config section '%s' is deprecated in MPF 0.80 and will be unsupported "
"in future versions. Please migrate this config to GMC.", k)
if config_type not in config_spec[k]['__valid_in__']:
raise ConfigFileError('Found a "{}:" section in config file {}, '
'but that section is not valid in {} config '
Expand Down
2 changes: 1 addition & 1 deletion mpf/core/config_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ def _validate_type_subconfig(self, item, param, validation_failure_info):
# The inclusion of sound_pools causes a nested ducking subconfig that
# fails due to missing required properties. Check for an empty dict
# as subconfig and ignore it.
if item is None or (item is Dict and not len(item)):
if item is None or (item is Dict and len(item) == 0):
return {}
try:
attribute, base_spec_str = param.split(",", 1)
Expand Down
2 changes: 1 addition & 1 deletion mpf/core/crash_reporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def analyze_traceback(tb, inspection_level=None, limit=None):


def _send_crash_report(report, reporting_url):
r = requests.post(reporting_url, json=report)
r = requests.post(reporting_url, json=report, timeout=60)
if r.status_code != 200:
print("Failed to send report. Got response code {}. Error: {}", r.status_code, r.content)
else:
Expand Down
3 changes: 3 additions & 0 deletions mpf/core/machine_vars.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,9 @@ def set_machine_var(self, name: str, value: Any, persist=False) -> None:
----
name: String name of the variable you're setting the value for.
value: The value you're setting. This can be any Type.
persist: Whether to persist this machine var to disk. Only
applies to new/unconfigured vars; vars defined in the
machine_vars config will use their config setting.
"""
if name not in self.machine_vars:
self.configure_machine_var(name=name, persist=persist)
Expand Down
Loading

0 comments on commit a230102

Please sign in to comment.