mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-04-10 21:03:01 +00:00
Display changes
display manager changes
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user