mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-04-10 21:03:01 +00:00
fix: force display updates for live NHL games when new data is received
This commit is contained in:
@@ -308,6 +308,13 @@ class DisplayController:
|
||||
# Check for live games
|
||||
has_live_games, sport_type = self._check_live_games()
|
||||
|
||||
# If we have live games, update their display immediately
|
||||
if has_live_games:
|
||||
if sport_type == 'nhl' and self.nhl_live:
|
||||
self.nhl_live.display(force_clear=True)
|
||||
elif sport_type == 'nba' and self.nba_live:
|
||||
self.nba_live.display(force_clear=True)
|
||||
|
||||
# Check for mode switch
|
||||
if current_time - self.last_switch > self.get_current_duration():
|
||||
# If there are live games, check if they involve favorite teams
|
||||
@@ -361,38 +368,35 @@ class DisplayController:
|
||||
self.force_clear = True
|
||||
self.last_switch = current_time
|
||||
|
||||
# Display current mode frame
|
||||
# Display current mode frame (only for non-live modes)
|
||||
try:
|
||||
if self.current_display_mode == 'clock' and self.clock:
|
||||
self.clock.display_time(force_clear=self.force_clear)
|
||||
|
||||
elif self.current_display_mode == 'weather_current' and self.weather:
|
||||
self.weather.display_weather(force_clear=self.force_clear)
|
||||
elif self.current_display_mode == 'weather_hourly' and self.weather:
|
||||
self.weather.display_hourly_forecast(force_clear=self.force_clear)
|
||||
elif self.current_display_mode == 'weather_daily' and self.weather:
|
||||
self.weather.display_daily_forecast(force_clear=self.force_clear)
|
||||
|
||||
elif self.current_display_mode == 'stocks' and self.stocks:
|
||||
self.stocks.display_stocks(force_clear=self.force_clear)
|
||||
|
||||
elif self.current_display_mode == 'nhl_live' and self.nhl_live:
|
||||
self.nhl_live.display(force_clear=self.force_clear)
|
||||
elif self.current_display_mode == 'nhl_recent' and self.nhl_recent:
|
||||
self.nhl_recent.display(force_clear=self.force_clear)
|
||||
elif self.current_display_mode == 'nhl_upcoming' and self.nhl_upcoming:
|
||||
self.nhl_upcoming.display(force_clear=self.force_clear)
|
||||
|
||||
elif self.current_display_mode == 'nba_live' and self.nba_live:
|
||||
self.nba_live.display(force_clear=self.force_clear)
|
||||
elif self.current_display_mode == 'nba_recent' and self.nba_recent:
|
||||
self.nba_recent.display(force_clear=self.force_clear)
|
||||
elif self.current_display_mode == 'nba_upcoming' and self.nba_upcoming:
|
||||
self.nba_upcoming.display(force_clear=self.force_clear)
|
||||
|
||||
elif self.current_display_mode == 'stock_news' and self.news:
|
||||
self.news.display_news()
|
||||
|
||||
if self.current_display_mode != 'nhl_live' and self.current_display_mode != 'nba_live':
|
||||
if self.current_display_mode == 'clock' and self.clock:
|
||||
self.clock.display_time(force_clear=self.force_clear)
|
||||
|
||||
elif self.current_display_mode == 'weather_current' and self.weather:
|
||||
self.weather.display_weather(force_clear=self.force_clear)
|
||||
elif self.current_display_mode == 'weather_hourly' and self.weather:
|
||||
self.weather.display_hourly_forecast(force_clear=self.force_clear)
|
||||
elif self.current_display_mode == 'weather_daily' and self.weather:
|
||||
self.weather.display_daily_forecast(force_clear=self.force_clear)
|
||||
|
||||
elif self.current_display_mode == 'stocks' and self.stocks:
|
||||
self.stocks.display_stocks(force_clear=self.force_clear)
|
||||
|
||||
elif self.current_display_mode == 'nhl_recent' and self.nhl_recent:
|
||||
self.nhl_recent.display(force_clear=self.force_clear)
|
||||
elif self.current_display_mode == 'nhl_upcoming' and self.nhl_upcoming:
|
||||
self.nhl_upcoming.display(force_clear=self.force_clear)
|
||||
|
||||
elif self.current_display_mode == 'nba_recent' and self.nba_recent:
|
||||
self.nba_recent.display(force_clear=self.force_clear)
|
||||
elif self.current_display_mode == 'nba_upcoming' and self.nba_upcoming:
|
||||
self.nba_upcoming.display(force_clear=self.force_clear)
|
||||
|
||||
elif self.current_display_mode == 'stock_news' and self.news:
|
||||
self.news.display_news()
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"Error updating display for mode {self.current_display_mode}: {e}", exc_info=True)
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user