Display changes

display manager changes
This commit is contained in:
Chuck
2025-04-07 21:19:46 -05:00
parent 27347b13d0
commit 2171364d38
2 changed files with 23 additions and 3 deletions

View File

@@ -1,19 +1,25 @@
import time
import logging
from typing import Dict, Any
from src.clock import Clock
from src.weather_manager import WeatherManager
from src.display_manager import DisplayManager
from src.config_manager import ConfigManager
# Configure logging
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
class DisplayController:
def __init__(self):
self.config_manager = ConfigManager()
self.config = self.config_manager.config
self.display_manager = DisplayManager(self.config.get('display', {}))
self.clock = Clock()
self.clock = Clock(display_manager=self.display_manager)
self.weather = WeatherManager(self.config, self.display_manager)
self.current_display = 'clock'
self.last_switch = time.time()
logger.info("DisplayController initialized with display_manager: %s", id(self.display_manager))
def run(self):
"""Run the display controller, switching between displays."""
@@ -24,13 +30,18 @@ class DisplayController:
# Switch display if interval has passed
if current_time - self.last_switch > rotation_interval:
logger.info("Switching display from %s to %s",
self.current_display,
'weather' if self.current_display == 'clock' else 'clock')
self.current_display = 'weather' if self.current_display == 'clock' else 'clock'
self.last_switch = current_time
# Display current screen
if self.current_display == 'clock':
logger.debug("Updating clock display")
self.clock.display_time()
else:
logger.debug("Updating weather display")
self.weather.display_weather()
# Small delay to prevent CPU overload