mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-04-13 14:03:00 +00:00
Update display rotation to respect mode order instead of always returning to clock
This commit is contained in:
@@ -76,7 +76,7 @@ class DisplayController:
|
|||||||
'weather_daily': 15,
|
'weather_daily': 15,
|
||||||
'stocks': 45,
|
'stocks': 45,
|
||||||
'nhl_live': 30, # Live games update more frequently
|
'nhl_live': 30, # Live games update more frequently
|
||||||
'nhl_recent': 60, # Recent games - increased to 60 seconds to allow proper cycling
|
'nhl_recent': 15, # Recent games - 15 seconds per team
|
||||||
'nhl_upcoming': 20, # Upcoming games
|
'nhl_upcoming': 20, # Upcoming games
|
||||||
'stock_news': 30
|
'stock_news': 30
|
||||||
})
|
})
|
||||||
@@ -186,65 +186,60 @@ class DisplayController:
|
|||||||
# Check if we have any team games to show
|
# Check if we have any team games to show
|
||||||
has_team_games = self._has_team_games()
|
has_team_games = self._has_team_games()
|
||||||
|
|
||||||
# If we have team games and we're not in NHL recent/upcoming mode, switch to it
|
# If we're in a non-NHL mode and have team games, start NHL rotation
|
||||||
if has_team_games and self.current_display_mode not in ['nhl_recent', 'nhl_upcoming']:
|
if has_team_games and self.current_display_mode not in ['nhl_recent', 'nhl_upcoming']:
|
||||||
# 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"Starting NHL rotation with recent game for {self.favorite_teams[self.current_team_index]}")
|
||||||
else:
|
else:
|
||||||
# No recent game, try upcoming
|
# No recent game, try upcoming
|
||||||
self.showing_recent = False
|
self.showing_recent = False
|
||||||
if self._get_team_games(self.favorite_teams[self.current_team_index], False):
|
if self._get_team_games(self.favorite_teams[self.current_team_index], False):
|
||||||
self.current_display_mode = 'nhl_upcoming'
|
self.current_display_mode = 'nhl_upcoming'
|
||||||
logger.info(f"Switching to upcoming game for {self.favorite_teams[self.current_team_index]}")
|
logger.info(f"Starting NHL rotation with upcoming game for {self.favorite_teams[self.current_team_index]}")
|
||||||
else:
|
else:
|
||||||
# No games for this team, move to next mode
|
# No games for this team, move to next mode
|
||||||
self.current_mode_index = (self.current_mode_index + 1) % len(self.available_modes)
|
self.current_mode_index = (self.current_mode_index + 1) % len(self.available_modes)
|
||||||
self.current_display_mode = self.available_modes[self.current_mode_index]
|
self.current_display_mode = self.available_modes[self.current_mode_index]
|
||||||
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 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
|
if self.showing_recent:
|
||||||
self.team_rotation_count += 1
|
# Switch from recent to upcoming for current team
|
||||||
|
self.showing_recent = False
|
||||||
# If we've rotated through teams twice, switch to regular rotation
|
if self._get_team_games(self.favorite_teams[self.current_team_index], False):
|
||||||
if self.team_rotation_count >= len(self.favorite_teams) * 2:
|
self.current_display_mode = 'nhl_upcoming'
|
||||||
self.current_mode_index = (self.current_mode_index + 1) % len(self.available_modes)
|
logger.info(f"Switching to upcoming game for {self.favorite_teams[self.current_team_index]}")
|
||||||
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:
|
|
||||||
# Switch from recent to upcoming for current team
|
|
||||||
self.showing_recent = False
|
|
||||||
if self._get_team_games(self.favorite_teams[self.current_team_index], False):
|
|
||||||
self.current_display_mode = 'nhl_upcoming'
|
|
||||||
logger.info(f"Switching to upcoming game for {self.favorite_teams[self.current_team_index]}")
|
|
||||||
else:
|
|
||||||
# No upcoming game, move to next team's recent game
|
|
||||||
self.current_team_index = (self.current_team_index + 1) % len(self.favorite_teams)
|
|
||||||
self.showing_recent = True
|
|
||||||
if self._get_team_games(self.favorite_teams[self.current_team_index], True):
|
|
||||||
self.current_display_mode = 'nhl_recent'
|
|
||||||
logger.info(f"Switching to recent game for {self.favorite_teams[self.current_team_index]}")
|
|
||||||
else:
|
|
||||||
# No recent game for next team, move to regular rotation
|
|
||||||
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"No games for team, switching to: {self.current_display_mode}")
|
|
||||||
else:
|
else:
|
||||||
# Move to next team's recent game
|
# No upcoming game, move to next team's recent game
|
||||||
self.current_team_index = (self.current_team_index + 1) % len(self.favorite_teams)
|
self.current_team_index = (self.current_team_index + 1) % len(self.favorite_teams)
|
||||||
self.showing_recent = True
|
self.showing_recent = True
|
||||||
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]}")
|
||||||
else:
|
else:
|
||||||
# No recent game for next team, move to regular rotation
|
# No recent game for next team, move to next mode in rotation
|
||||||
|
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"No games for team, switching to: {self.current_display_mode}")
|
||||||
|
else:
|
||||||
|
# Move to next team's recent game
|
||||||
|
self.current_team_index = (self.current_team_index + 1) % len(self.favorite_teams)
|
||||||
|
if self.current_team_index == 0:
|
||||||
|
# We've completed a full rotation, move to next mode in rotation
|
||||||
|
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 NHL rotation, switching to: {self.current_display_mode}")
|
||||||
|
else:
|
||||||
|
self.showing_recent = True
|
||||||
|
if self._get_team_games(self.favorite_teams[self.current_team_index], True):
|
||||||
|
self.current_display_mode = 'nhl_recent'
|
||||||
|
logger.info(f"Switching to recent game for {self.favorite_teams[self.current_team_index]}")
|
||||||
|
else:
|
||||||
|
# No recent game for next team, move to next mode in rotation
|
||||||
self.current_mode_index = (self.current_mode_index + 1) % len(self.available_modes)
|
self.current_mode_index = (self.current_mode_index + 1) % len(self.available_modes)
|
||||||
self.current_display_mode = self.available_modes[self.current_mode_index]
|
self.current_display_mode = self.available_modes[self.current_mode_index]
|
||||||
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}")
|
||||||
|
|||||||
Reference in New Issue
Block a user