Skip to content

Commit

Permalink
score reels no longer activate chime on score reset.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrechte committed Mar 22, 2024
1 parent a9b12f1 commit 384d7d3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
9 changes: 7 additions & 2 deletions mpf/devices/score_reel.py
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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:
Expand All @@ -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()
4 changes: 2 additions & 2 deletions mpf/devices/score_reel_controller.py
Expand Up @@ -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()

Expand Down Expand Up @@ -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):
Expand Down
5 changes: 2 additions & 3 deletions mpf/devices/score_reel_group.py
Expand Up @@ -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
Expand Down Expand Up @@ -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."""
Expand Down

0 comments on commit 384d7d3

Please sign in to comment.