mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-04-29 20:13:00 +00:00
Add team rotation limit to prevent getting stuck in NHL modes
This commit is contained in:
@@ -66,6 +66,7 @@ class DisplayController:
|
|||||||
self.current_team_index = 0
|
self.current_team_index = 0
|
||||||
self.showing_recent = True # True for recent, False for upcoming
|
self.showing_recent = True # True for recent, False for upcoming
|
||||||
self.favorite_teams = self.config.get('nhl_scoreboard', {}).get('favorite_teams', [])
|
self.favorite_teams = self.config.get('nhl_scoreboard', {}).get('favorite_teams', [])
|
||||||
|
self.team_rotation_count = 0 # Track how many times we've rotated through teams
|
||||||
|
|
||||||
# Update display durations to include NHL modes
|
# Update display durations to include NHL modes
|
||||||
self.display_durations = self.config['display'].get('display_durations', {
|
self.display_durations = self.config['display'].get('display_durations', {
|
||||||
@@ -190,6 +191,7 @@ class DisplayController:
|
|||||||
# Start with recent games for the first team
|
# Start with recent games for the first team
|
||||||
self.current_team_index = 0
|
self.current_team_index = 0
|
||||||
self.showing_recent = True
|
self.showing_recent = True
|
||||||
|
self.team_rotation_count = 0
|
||||||
if self._get_team_games(self.favorite_teams[self.current_team_index], True):
|
if self._get_team_games(self.favorite_teams[self.current_team_index], True):
|
||||||
self.current_display_mode = 'nhl_recent'
|
self.current_display_mode = 'nhl_recent'
|
||||||
logger.info(f"Switching to recent game for {self.favorite_teams[self.current_team_index]}")
|
logger.info(f"Switching to recent game for {self.favorite_teams[self.current_team_index]}")
|
||||||
@@ -206,6 +208,16 @@ class DisplayController:
|
|||||||
logger.info(f"No games for team, switching to: {self.current_display_mode}")
|
logger.info(f"No games for team, switching to: {self.current_display_mode}")
|
||||||
# If we're already in NHL recent/upcoming mode, handle team rotation
|
# If we're already in NHL recent/upcoming mode, handle team rotation
|
||||||
elif self.current_display_mode in ['nhl_recent', 'nhl_upcoming']:
|
elif self.current_display_mode in ['nhl_recent', 'nhl_upcoming']:
|
||||||
|
# Increment team rotation count
|
||||||
|
self.team_rotation_count += 1
|
||||||
|
|
||||||
|
# If we've rotated through teams twice, switch to regular rotation
|
||||||
|
if self.team_rotation_count >= len(self.favorite_teams) * 2:
|
||||||
|
self.current_mode_index = (self.current_mode_index + 1) % len(self.available_modes)
|
||||||
|
self.current_display_mode = self.available_modes[self.current_mode_index]
|
||||||
|
logger.info(f"Completed team rotation, switching to: {self.current_display_mode}")
|
||||||
|
self.team_rotation_count = 0
|
||||||
|
else:
|
||||||
if self.showing_recent:
|
if self.showing_recent:
|
||||||
# Switch from recent to upcoming for current team
|
# Switch from recent to upcoming for current team
|
||||||
self.showing_recent = False
|
self.showing_recent = False
|
||||||
|
|||||||
Reference in New Issue
Block a user