From 52c2d61dcf5ca0a71b543a17fc8b5bab86cd5daf Mon Sep 17 00:00:00 2001 From: ChuckBuilds <33324927+ChuckBuilds@users.noreply.github.com> Date: Mon, 18 Aug 2025 21:50:38 -0500 Subject: [PATCH] Fix odds ticker black display issue when returning to rotation - Reset display start time when force_clear is True or when starting fresh - Reset scroll position for clean start when display is reset - Add check for old display start time and reset if it's more than 2x dynamic duration - Prevents the odds ticker from staying black when it comes back into rotation - Ensures proper state management between display sessions --- src/odds_ticker_manager.py | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/odds_ticker_manager.py b/src/odds_ticker_manager.py index cb27523c..67d61c78 100644 --- a/src/odds_ticker_manager.py +++ b/src/odds_ticker_manager.py @@ -1178,8 +1178,8 @@ class OddsTickerManager: if sport == 'baseball': is_baseball_live = True # Draw graphical bases instead of text - # Position bases at the right edge of odds column to be closer to inning indicator - bases_x = current_x + odds_width - 12 # Move to right edge, offset by half cluster width (24/2 = 12) + # Position bases at the left side of odds column to be closer to scores + bases_x = current_x + 12 # Position at left side, offset by half cluster width (24/2 = 12) # Shift bases down a bit more for better positioning bases_y = (height // 2) + 2 # Move down 2 pixels from center @@ -1455,10 +1455,20 @@ class OddsTickerManager: logger.debug("Odds ticker is disabled, exiting display method.") return - # Initialize display start time if not set - if not hasattr(self, '_display_start_time'): + # Reset display start time when force_clear is True or when starting fresh + if force_clear or not hasattr(self, '_display_start_time'): self._display_start_time = time.time() - logger.debug(f"Initialized display start time: {self._display_start_time}") + logger.debug(f"Reset/initialized display start time: {self._display_start_time}") + # Also reset scroll position for clean start + self.scroll_position = 0 + else: + # Check if the display start time is too old (more than 2x the dynamic duration) + current_time = time.time() + elapsed_time = current_time - self._display_start_time + if elapsed_time > (self.dynamic_duration * 2): + logger.debug(f"Display start time is too old ({elapsed_time:.1f}s), resetting") + self._display_start_time = current_time + self.scroll_position = 0 logger.debug(f"Number of games in data at start of display method: {len(self.games_data)}") if not self.games_data: