mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-04-10 21:03:01 +00:00
Merge branch 'Stocks' of github.com:ChuckBuilds/LEDMatrix into Stocks
This commit is contained in:
@@ -117,4 +117,4 @@ LEDSportsMatrix/
|
|||||||
- `display_manager.py` - LED matrix display handling
|
- `display_manager.py` - LED matrix display handling
|
||||||
- `config/`
|
- `config/`
|
||||||
- `config.json` - Configuration settings
|
- `config.json` - Configuration settings
|
||||||
- `config_secrets.json` - Private settings (not in git)
|
- `config_secrets.json` - Private settings (not in git)
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ class StockNewsManager:
|
|||||||
self.scroll_position = 0
|
self.scroll_position = 0
|
||||||
self.cached_text_image = None # Cache for the text image
|
self.cached_text_image = None # Cache for the text image
|
||||||
self.cached_text = None # Cache for the text string
|
self.cached_text = None # Cache for the text string
|
||||||
|
|
||||||
|
|
||||||
# Get scroll settings from config with faster defaults
|
# Get scroll settings from config with faster defaults
|
||||||
self.scroll_speed = self.stock_news_config.get('scroll_speed', 1)
|
self.scroll_speed = self.stock_news_config.get('scroll_speed', 1)
|
||||||
@@ -218,12 +219,13 @@ class StockNewsManager:
|
|||||||
|
|
||||||
text_width = self.cached_text_image.width
|
text_width = self.cached_text_image.width
|
||||||
text_height = self.cached_text_image.height
|
text_height = self.cached_text_image.height
|
||||||
|
|
||||||
display_width = self.display_manager.matrix.width
|
display_width = self.display_manager.matrix.width
|
||||||
total_width = text_width + display_width
|
total_width = text_width + display_width
|
||||||
|
|
||||||
# Update scroll position
|
# Update scroll position
|
||||||
self.scroll_position = (self.scroll_position + self.scroll_speed) % total_width
|
self.scroll_position = (self.scroll_position + self.scroll_speed) % total_width
|
||||||
|
|
||||||
# Calculate the visible portion of the text
|
# Calculate the visible portion of the text
|
||||||
visible_width = min(display_width, text_width - self.scroll_position)
|
visible_width = min(display_width, text_width - self.scroll_position)
|
||||||
if visible_width > 0:
|
if visible_width > 0:
|
||||||
|
|||||||
@@ -10,7 +10,9 @@ print(f"Current working directory: {os.getcwd()}")
|
|||||||
|
|
||||||
def main():
|
def main():
|
||||||
"""Test the StockNewsManager class directly."""
|
"""Test the StockNewsManager class directly."""
|
||||||
|
|
||||||
display_manager = None
|
display_manager = None
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Load configuration
|
# Load configuration
|
||||||
config_manager = ConfigManager()
|
config_manager = ConfigManager()
|
||||||
@@ -28,11 +30,13 @@ def main():
|
|||||||
# Initialize display manager
|
# Initialize display manager
|
||||||
display_manager = DisplayManager(display_config)
|
display_manager = DisplayManager(display_config)
|
||||||
|
|
||||||
|
|
||||||
# Clear the display and show a test pattern
|
# Clear the display and show a test pattern
|
||||||
display_manager.clear()
|
display_manager.clear()
|
||||||
display_manager.update_display()
|
display_manager.update_display()
|
||||||
time.sleep(1) # Give time to see the test pattern
|
time.sleep(1) # Give time to see the test pattern
|
||||||
|
|
||||||
|
|
||||||
# Initialize news manager with the loaded config
|
# Initialize news manager with the loaded config
|
||||||
news_manager = StockNewsManager(config, display_manager)
|
news_manager = StockNewsManager(config, display_manager)
|
||||||
|
|
||||||
@@ -54,6 +58,7 @@ def main():
|
|||||||
display_manager.clear()
|
display_manager.clear()
|
||||||
display_manager.update_display()
|
display_manager.update_display()
|
||||||
display_manager.cleanup()
|
display_manager.cleanup()
|
||||||
|
|
||||||
print("Test completed")
|
print("Test completed")
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
Reference in New Issue
Block a user