mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-04-11 21:33:00 +00:00
reduce dynamic duration logging
This commit is contained in:
@@ -296,6 +296,9 @@ class DisplayController:
|
|||||||
# Set initial display to first available mode (clock)
|
# Set initial display to first available mode (clock)
|
||||||
self.current_mode_index = 0
|
self.current_mode_index = 0
|
||||||
self.current_display_mode = self.available_modes[0] if self.available_modes else 'none'
|
self.current_display_mode = self.available_modes[0] if self.available_modes else 'none'
|
||||||
|
# Reset logged duration when mode is initialized
|
||||||
|
if hasattr(self, '_last_logged_duration'):
|
||||||
|
delattr(self, '_last_logged_duration')
|
||||||
self.last_switch = time.time()
|
self.last_switch = time.time()
|
||||||
self.force_clear = True
|
self.force_clear = True
|
||||||
self.update_interval = 0.01 # Reduced from 0.1 to 0.01 for smoother scrolling
|
self.update_interval = 0.01 # Reduced from 0.1 to 0.01 for smoother scrolling
|
||||||
@@ -447,7 +450,10 @@ class DisplayController:
|
|||||||
if mode_key == 'news_manager' and self.news_manager:
|
if mode_key == 'news_manager' and self.news_manager:
|
||||||
try:
|
try:
|
||||||
dynamic_duration = self.news_manager.get_dynamic_duration()
|
dynamic_duration = self.news_manager.get_dynamic_duration()
|
||||||
logger.info(f"Using dynamic duration for news_manager: {dynamic_duration} seconds")
|
# Only log if duration has changed or we haven't logged this duration yet
|
||||||
|
if not hasattr(self, '_last_logged_duration') or self._last_logged_duration != dynamic_duration:
|
||||||
|
logger.info(f"Using dynamic duration for news_manager: {dynamic_duration} seconds")
|
||||||
|
self._last_logged_duration = dynamic_duration
|
||||||
return dynamic_duration
|
return dynamic_duration
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Error getting dynamic duration for news_manager: {e}")
|
logger.error(f"Error getting dynamic duration for news_manager: {e}")
|
||||||
@@ -853,6 +859,9 @@ class DisplayController:
|
|||||||
if self.current_display_mode != new_mode:
|
if self.current_display_mode != new_mode:
|
||||||
logger.info(f"Switching to only active live sport: {new_mode} from {self.current_display_mode}")
|
logger.info(f"Switching to only active live sport: {new_mode} from {self.current_display_mode}")
|
||||||
self.current_display_mode = new_mode
|
self.current_display_mode = new_mode
|
||||||
|
# Reset logged duration when mode changes
|
||||||
|
if hasattr(self, '_last_logged_duration'):
|
||||||
|
delattr(self, '_last_logged_duration')
|
||||||
self.force_clear = True
|
self.force_clear = True
|
||||||
else:
|
else:
|
||||||
self.force_clear = False
|
self.force_clear = False
|
||||||
@@ -873,6 +882,9 @@ class DisplayController:
|
|||||||
if previous_mode_before_switch == 'music' and self.music_manager:
|
if previous_mode_before_switch == 'music' and self.music_manager:
|
||||||
self.music_manager.deactivate_music_display()
|
self.music_manager.deactivate_music_display()
|
||||||
self.current_display_mode = new_mode
|
self.current_display_mode = new_mode
|
||||||
|
# Reset logged duration when mode changes
|
||||||
|
if hasattr(self, '_last_logged_duration'):
|
||||||
|
delattr(self, '_last_logged_duration')
|
||||||
self.force_clear = True
|
self.force_clear = True
|
||||||
self.last_switch = current_time
|
self.last_switch = current_time
|
||||||
manager_to_display = getattr(self, f"{live_priority_sport}_live", None)
|
manager_to_display = getattr(self, f"{live_priority_sport}_live", None)
|
||||||
@@ -896,6 +908,9 @@ class DisplayController:
|
|||||||
if previous_mode_before_switch == 'music' and self.music_manager and new_mode_after_timer != 'music':
|
if previous_mode_before_switch == 'music' and self.music_manager and new_mode_after_timer != 'music':
|
||||||
self.music_manager.deactivate_music_display()
|
self.music_manager.deactivate_music_display()
|
||||||
self.current_display_mode = new_mode_after_timer
|
self.current_display_mode = new_mode_after_timer
|
||||||
|
# Reset logged duration when mode changes
|
||||||
|
if hasattr(self, '_last_logged_duration'):
|
||||||
|
delattr(self, '_last_logged_duration')
|
||||||
if needs_switch:
|
if needs_switch:
|
||||||
self.force_clear = True
|
self.force_clear = True
|
||||||
self.last_switch = current_time
|
self.last_switch = current_time
|
||||||
|
|||||||
@@ -173,7 +173,7 @@ class NewsManager:
|
|||||||
self.prepare_headlines_for_display()
|
self.prepare_headlines_for_display()
|
||||||
|
|
||||||
self.last_update = time.time()
|
self.last_update = time.time()
|
||||||
logger.info(f"Fetched {len(all_headlines)} total headlines from {len(self.enabled_feeds)} feeds")
|
logger.debug(f"Fetched {len(all_headlines)} total headlines from {len(self.enabled_feeds)} feeds")
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Error fetching news data: {e}")
|
logger.error(f"Error fetching news data: {e}")
|
||||||
@@ -216,7 +216,7 @@ class NewsManager:
|
|||||||
self.calculate_scroll_dimensions()
|
self.calculate_scroll_dimensions()
|
||||||
|
|
||||||
self.current_headlines = display_headlines
|
self.current_headlines = display_headlines
|
||||||
logger.info(f"Prepared {len(display_headlines)} headlines for display")
|
logger.debug(f"Prepared {len(display_headlines)} headlines for display")
|
||||||
|
|
||||||
def calculate_scroll_dimensions(self):
|
def calculate_scroll_dimensions(self):
|
||||||
"""Calculate exact dimensions needed for smooth scrolling"""
|
"""Calculate exact dimensions needed for smooth scrolling"""
|
||||||
@@ -241,8 +241,8 @@ class NewsManager:
|
|||||||
# Calculate dynamic display duration
|
# Calculate dynamic display duration
|
||||||
self.calculate_dynamic_duration()
|
self.calculate_dynamic_duration()
|
||||||
|
|
||||||
logger.info(f"Text width calculated: {self.total_scroll_width} pixels")
|
logger.debug(f"Text width calculated: {self.total_scroll_width} pixels")
|
||||||
logger.info(f"Dynamic duration calculated: {self.dynamic_duration} seconds")
|
logger.debug(f"Dynamic duration calculated: {self.dynamic_duration} seconds")
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Error calculating scroll dimensions: {e}")
|
logger.error(f"Error calculating scroll dimensions: {e}")
|
||||||
@@ -254,7 +254,7 @@ class NewsManager:
|
|||||||
# If dynamic duration is disabled, use fixed duration from config
|
# If dynamic duration is disabled, use fixed duration from config
|
||||||
if not self.dynamic_duration_enabled:
|
if not self.dynamic_duration_enabled:
|
||||||
self.dynamic_duration = self.news_config.get('fixed_duration', 60)
|
self.dynamic_duration = self.news_config.get('fixed_duration', 60)
|
||||||
logger.info(f"Dynamic duration disabled, using fixed duration: {self.dynamic_duration}s")
|
logger.debug(f"Dynamic duration disabled, using fixed duration: {self.dynamic_duration}s")
|
||||||
return
|
return
|
||||||
|
|
||||||
if not self.total_scroll_width:
|
if not self.total_scroll_width:
|
||||||
|
|||||||
Reference in New Issue
Block a user