mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-04-11 05:13:01 +00:00
Optimize display updates: Skip display when no games available for NHL and NBA managers
This commit is contained in:
@@ -762,8 +762,7 @@ class NBARecentManager(BaseNBAManager):
|
|||||||
"""Display recent games."""
|
"""Display recent games."""
|
||||||
if not self.recent_games:
|
if not self.recent_games:
|
||||||
self.logger.info("[NBA] No recent games to display")
|
self.logger.info("[NBA] No recent games to display")
|
||||||
self.display_manager.clear()
|
return # Skip display update entirely
|
||||||
return
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
current_time = time.time()
|
current_time = time.time()
|
||||||
@@ -860,8 +859,7 @@ class NBAUpcomingManager(BaseNBAManager):
|
|||||||
if time.time() - self.last_warning_time > self.warning_cooldown:
|
if time.time() - self.last_warning_time > self.warning_cooldown:
|
||||||
self.logger.info("[NBA] No upcoming games to display")
|
self.logger.info("[NBA] No upcoming games to display")
|
||||||
self.last_warning_time = time.time()
|
self.last_warning_time = time.time()
|
||||||
self.display_manager.clear()
|
return # Skip display update entirely
|
||||||
return
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Draw the scorebug layout
|
# Draw the scorebug layout
|
||||||
|
|||||||
@@ -692,8 +692,7 @@ class NHLRecentManager(BaseNHLManager):
|
|||||||
"""Display recent games."""
|
"""Display recent games."""
|
||||||
if not self.games_list:
|
if not self.games_list:
|
||||||
self.logger.info("[NHL] No recent games to display")
|
self.logger.info("[NHL] No recent games to display")
|
||||||
self.display_manager.clear()
|
return # Skip display update entirely
|
||||||
return
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
current_time = time.time()
|
current_time = time.time()
|
||||||
@@ -725,6 +724,8 @@ class NHLUpcomingManager(BaseNHLManager):
|
|||||||
self.update_interval = 300 # 5 minutes
|
self.update_interval = 300 # 5 minutes
|
||||||
self.last_log_time = 0
|
self.last_log_time = 0
|
||||||
self.log_interval = 300 # Only log status every 5 minutes
|
self.log_interval = 300 # Only log status every 5 minutes
|
||||||
|
self.last_warning_time = 0
|
||||||
|
self.warning_cooldown = 300 # Only show warning every 5 minutes
|
||||||
self.logger.info(f"Initialized NHLUpcomingManager with {len(self.favorite_teams)} favorite teams")
|
self.logger.info(f"Initialized NHLUpcomingManager with {len(self.favorite_teams)} favorite teams")
|
||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
@@ -779,9 +780,11 @@ class NHLUpcomingManager(BaseNHLManager):
|
|||||||
def display(self, force_clear=False):
|
def display(self, force_clear=False):
|
||||||
"""Display upcoming games."""
|
"""Display upcoming games."""
|
||||||
if not self.upcoming_games:
|
if not self.upcoming_games:
|
||||||
self.logger.info("[NHL] No upcoming games to display")
|
current_time = time.time()
|
||||||
self.display_manager.clear()
|
if current_time - self.last_warning_time > self.warning_cooldown:
|
||||||
return
|
self.logger.info("[NHL] No upcoming games to display")
|
||||||
|
self.last_warning_time = current_time
|
||||||
|
return # Skip display update entirely
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Draw the scorebug layout
|
# Draw the scorebug layout
|
||||||
|
|||||||
Reference in New Issue
Block a user