From 384d7d3979176a2686b45a1b0dc9f5a54f35e807 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Recht=C3=A9?= Date: Fri, 22 Mar 2024 12:35:46 +0100 Subject: [PATCH] score reels no longer activate chime on score reset. --- mpf/devices/score_reel.py | 9 +++++++-- mpf/devices/score_reel_controller.py | 4 ++-- mpf/devices/score_reel_group.py | 5 ++--- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/mpf/devices/score_reel.py b/mpf/devices/score_reel.py index 15da5fe45..42378405e 100644 --- a/mpf/devices/score_reel.py +++ b/mpf/devices/score_reel.py @@ -41,6 +41,9 @@ def __init__(self, machine, name): self._destination_value = 0 # Holds the index of the destination the reel is trying to advance to. + + self._quiet = True + # Whether to use chime when advancing self._runner = None # asyncio task which advances the reel @@ -154,7 +157,8 @@ async def _advance_reel_if_position_does_not_match(self): while self._destination_value != self.assumed_value: self.machine.events.post('reel_{}_will_advance'.format(self.name)) wait_ms = self.config['coil_inc'].pulse(max_wait_ms=500) - self.machine.events.post('reel_{}_advancing'.format(self.name)) + if not self._quiet: + self.machine.events.post('reel_{}_advancing'.format(self.name)) previous_value = self.assumed_value await asyncio.sleep((wait_ms + self.config['repeat_pulse_time']) / 1000) @@ -180,7 +184,7 @@ def wait_for_ready(self): """Return a future for ready.""" return self._ready.wait() - def set_destination_value(self, value): + def set_destination_value(self, value, quiet=False): """Return the integer value of the destination this reel is moving to. Args: @@ -197,6 +201,7 @@ def set_destination_value(self, value): self._destination_value, value) self._destination_value = value + self._quiet = quiet self._busy.set() self._ready.clear() diff --git a/mpf/devices/score_reel_controller.py b/mpf/devices/score_reel_controller.py index 5b95ff23f..7c790a1cf 100644 --- a/mpf/devices/score_reel_controller.py +++ b/mpf/devices/score_reel_controller.py @@ -93,7 +93,7 @@ def _rotate_player(self, **kwargs): # Make sure this score reel group is showing the right score self.log.debug("Current player's score: %s", self.machine.game.player.score) - self.active_scorereelgroup.set_value(self.machine.game.player.score) + self.active_scorereelgroup.set_value(self.machine.game.player.score, True) self.active_scorereelgroup.light() @@ -149,7 +149,7 @@ async def _game_starting(self, **kwargs): raise AssertionError('Need a score reel group tagged "player1"') for score_reel_group in self.machine.score_reel_groups.values(): - score_reel_group.set_value(0) + score_reel_group.set_value(0, True) # No chime await score_reel_group.wait_for_ready() def _game_ending(self, **kwargs): diff --git a/mpf/devices/score_reel_group.py b/mpf/devices/score_reel_group.py index c9c19d86c..a7033e8d5 100644 --- a/mpf/devices/score_reel_group.py +++ b/mpf/devices/score_reel_group.py @@ -75,7 +75,7 @@ def chime(cls, chime, **kwargs): del kwargs chime.pulse() - def set_value(self, value): + def set_value(self, value, quiet=False): """Reset the score reel group to display the value passed. This method will "jump" the score reel group to display the value @@ -109,8 +109,7 @@ def set_value(self, value): for i, reel in enumerate(self.reels): if not reel: continue - - reel.set_destination_value(self.desired_value_list[i]) + reel.set_destination_value(self.desired_value_list[i], quiet) async def wait_for_ready(self): """Return a future which will be done when all reels reached their destination."""