mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-04-10 21:03:01 +00:00
troubleshooting test script
This commit is contained in:
@@ -7,11 +7,9 @@ class ConfigManager:
|
|||||||
# Use current working directory as base
|
# Use current working directory as base
|
||||||
self.config_path = config_path or "config/config.json"
|
self.config_path = config_path or "config/config.json"
|
||||||
self.secrets_path = secrets_path or "config/config_secrets.json"
|
self.secrets_path = secrets_path or "config/config_secrets.json"
|
||||||
|
|
||||||
self.config: Dict[str, Any] = {}
|
self.config: Dict[str, Any] = {}
|
||||||
self.load_config()
|
|
||||||
|
|
||||||
def load_config(self) -> None:
|
def load_config(self) -> Dict[str, Any]:
|
||||||
"""Load configuration from JSON files."""
|
"""Load configuration from JSON files."""
|
||||||
try:
|
try:
|
||||||
# Load main config
|
# Load main config
|
||||||
@@ -26,10 +24,13 @@ class ConfigManager:
|
|||||||
# Deep merge secrets into config
|
# Deep merge secrets into config
|
||||||
self._deep_merge(self.config, secrets)
|
self._deep_merge(self.config, secrets)
|
||||||
|
|
||||||
|
return self.config
|
||||||
|
|
||||||
except FileNotFoundError as e:
|
except FileNotFoundError as e:
|
||||||
if str(e).find('config_secrets.json') == -1: # Only raise if main config is missing
|
if str(e).find('config_secrets.json') == -1: # Only raise if main config is missing
|
||||||
print(f"Configuration file not found at {os.path.abspath(self.config_path)}")
|
print(f"Configuration file not found at {os.path.abspath(self.config_path)}")
|
||||||
raise
|
raise
|
||||||
|
return self.config
|
||||||
except json.JSONDecodeError:
|
except json.JSONDecodeError:
|
||||||
print("Error parsing configuration file")
|
print("Error parsing configuration file")
|
||||||
raise
|
raise
|
||||||
|
|||||||
@@ -15,10 +15,19 @@ def main():
|
|||||||
config_manager = ConfigManager()
|
config_manager = ConfigManager()
|
||||||
config = config_manager.load_config()
|
config = config_manager.load_config()
|
||||||
|
|
||||||
# Initialize display manager
|
if not config:
|
||||||
display_manager = DisplayManager(config.get('display', {}))
|
print("Error: Failed to load configuration")
|
||||||
|
return
|
||||||
|
|
||||||
|
display_config = config.get('display')
|
||||||
|
if not display_config:
|
||||||
|
print("Error: No display configuration found")
|
||||||
|
return
|
||||||
|
|
||||||
# Initialize news manager
|
# Initialize display manager
|
||||||
|
display_manager = DisplayManager(display_config)
|
||||||
|
|
||||||
|
# Initialize news manager with the loaded config
|
||||||
news_manager = NewsManager(config, display_manager)
|
news_manager = NewsManager(config, display_manager)
|
||||||
|
|
||||||
# Test the scrolling behavior
|
# Test the scrolling behavior
|
||||||
@@ -38,6 +47,8 @@ def main():
|
|||||||
print("\nTest interrupted by user")
|
print("\nTest interrupted by user")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"Error during test: {e}")
|
print(f"Error during test: {e}")
|
||||||
|
import traceback
|
||||||
|
traceback.print_exc()
|
||||||
finally:
|
finally:
|
||||||
print("Test completed")
|
print("Test completed")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user