Display
Entrypoint to control the displays and audio
Display (Game)
Gameclass to manage displays and audio
on_end(self)
async
Display shows winner when game ends. After a period of time the display shwos the logo again.
Source code in src/display.py
async def on_end(self):
"""
Display shows winner when game ends.
After a period of time the display shwos the logo again.
"""
self.audio.end()
self.display.end_display()
await asyncio.sleep(3)
self.display.show_circle()
on_exit(self, err=None)
async
Cleans display when the game is finished.
Source code in src/display.py
async def on_exit(self, err: Exception = None):
"""
Cleans display when the game is finished.
"""
self.display.close()
await self.on_exit(err)
on_init(self)
async
Configures pins and spi for connection of the display
Source code in src/display.py
async def on_init(self):
"""
Configures pins and spi for connection of the display
"""
self.display = DisplayHAL()
self.audio = SoundHAL()
logging.info("Display initalized")
on_pregame(self)
async
Display shows logo until game starts (ready)
Source code in src/display.py
async def on_pregame(self):
"""
Display shows logo until game starts (ready)
"""
self.audio.start()
self.display.show_score(0, 0)
on_score(self)
async
Updates score on the display when a player makes a point
Source code in src/display.py
async def on_score(self):
"""
Updates score on the display when a player makes a point
"""
scores_dict = self.players.score
score_A = 0
score_B = 0
for key, value in scores_dict.items():
if key in self.config['team_A']:
score_A += value
elif key in self.config['team_B']:
score_B += value
self.audio.hit()
self.display.show_score(score_A, score_B)
logging.info("Score update")