Optimize scrolling text performance for news ticker

This commit is contained in:
ChuckBuilds
2025-04-11 09:47:13 -05:00
parent 7925bf515b
commit e8aa05a0b4
2 changed files with 43 additions and 31 deletions

View File

@@ -36,18 +36,18 @@ class DisplayManager:
options.parallel = hardware_config.get('parallel', 1)
options.hardware_mapping = hardware_config.get('hardware_mapping', 'adafruit-hat-pwm')
# Optimize display settings for chained panels
# Optimize display settings for performance
options.brightness = 100
options.pwm_bits = 11
options.pwm_lsb_nanoseconds = 200 # Increased for better stability
options.pwm_bits = 8 # Reduced for better performance
options.pwm_lsb_nanoseconds = 100 # Reduced for faster updates
options.led_rgb_sequence = 'RGB'
options.pixel_mapper_config = ''
options.row_address_type = 0
options.multiplexing = 0
options.disable_hardware_pulsing = False # Enable hardware pulsing for better sync
options.disable_hardware_pulsing = True # Disable pulsing for better performance
options.show_refresh_rate = False
options.limit_refresh_rate_hz = 60 # Reduced refresh rate for stability
options.gpio_slowdown = 2 # Increased slowdown for better stability
options.limit_refresh_rate_hz = 120 # Increased refresh rate
options.gpio_slowdown = 1 # Reduced slowdown for better performance
# Initialize the matrix
self.matrix = RGBMatrix(options=options)
@@ -94,14 +94,13 @@ class DisplayManager:
# Copy the current image to the offscreen canvas
self.offscreen_canvas.SetImage(self.image)
# Wait for the next vsync before swapping
self.matrix.SwapOnVSync(self.offscreen_canvas)
# Swap buffers immediately without waiting for vsync
self.matrix.SwapOnVSync(self.offscreen_canvas, False)
# Swap our canvas references
self.offscreen_canvas, self.current_canvas = self.current_canvas, self.offscreen_canvas
# Small delay to ensure stable refresh
time.sleep(0.001)
# No delay needed since we're not waiting for vsync
except Exception as e:
logger.error(f"Error updating display: {e}")