Display tuning

added config settings for display tuning
This commit is contained in:
Chuck
2025-04-07 20:15:13 -05:00
parent cdcf6a1d7a
commit ca12ed7f55
2 changed files with 50 additions and 21 deletions

View File

@@ -6,10 +6,30 @@
"country": "US" "country": "US"
}, },
"display": { "display": {
"brightness": 50, "hardware": {
"rows": 32, "rows": 32,
"cols": 64, "cols": 64,
"chain_length": 2, "chain_length": 2,
"parallel": 1,
"brightness": 50,
"hardware_mapping": "adafruit-hat-pwm",
"scan_mode": "progressive",
"pwm_bits": 11,
"pwm_dither_bits": 0,
"pwm_lsb_nanoseconds": 130,
"led_rgb_sequence": "RGB",
"pixel_mapper_config": "U-mapper",
"panel_type": "",
"row_addr_type": 0,
"multiplexing": 0,
"disable_hardware_pulsing": false,
"inverse_colors": false,
"show_refresh_rate": false,
"limit_refresh_rate_hz": 100
},
"runtime": {
"gpio_slowdown": 3
},
"rotation_interval": 10 "rotation_interval": 10
}, },
"clock": { "clock": {

View File

@@ -26,24 +26,33 @@ class DisplayManager:
"""Setup the RGB matrix with the provided configuration.""" """Setup the RGB matrix with the provided configuration."""
options = RGBMatrixOptions() options = RGBMatrixOptions()
# Hardware specific settings # Get hardware and runtime configs
options.hardware_mapping = 'adafruit-hat' # Set for Adafruit Bonnet/HAT hw_config = self.config.get('hardware', {})
options.gpio_slowdown = 4 # Required for Pi 3 runtime_config = self.config.get('runtime', {})
options.rows = self.config.get('rows', 32)
options.cols = self.config.get('cols', 64)
options.chain_length = self.config.get('chain_length', 2)
options.parallel = 1
options.pwm_bits = 11
options.brightness = self.config.get('brightness', 50)
options.pwm_lsb_nanoseconds = 130
options.led_rgb_sequence = "RGB"
options.pixel_mapper_config = ""
options.multiplexing = 0
# Additional options for stability # Hardware specific settings
options.disable_hardware_pulsing = False options.rows = hw_config.get('rows', 32)
options.show_refresh_rate = 0 # Turn off refresh rate display options.cols = hw_config.get('cols', 64)
options.limit_refresh_rate_hz = 100 options.chain_length = hw_config.get('chain_length', 2)
options.parallel = hw_config.get('parallel', 1)
options.brightness = hw_config.get('brightness', 50)
options.hardware_mapping = hw_config.get('hardware_mapping', 'adafruit-hat')
options.pwm_bits = hw_config.get('pwm_bits', 11)
options.pwm_lsb_nanoseconds = hw_config.get('pwm_lsb_nanoseconds', 130)
options.led_rgb_sequence = hw_config.get('led_rgb_sequence', 'RGB')
options.pixel_mapper_config = hw_config.get('pixel_mapper_config', '')
options.multiplexing = hw_config.get('multiplexing', 0)
options.row_address_type = hw_config.get('row_addr_type', 0)
options.panel_type = hw_config.get('panel_type', '')
# Display options
options.show_refresh_rate = hw_config.get('show_refresh_rate', False)
options.limit_refresh_rate_hz = hw_config.get('limit_refresh_rate_hz', 100)
options.inverse_colors = hw_config.get('inverse_colors', False)
options.disable_hardware_pulsing = hw_config.get('disable_hardware_pulsing', False)
# Runtime options
options.gpio_slowdown = runtime_config.get('gpio_slowdown', 4)
return RGBMatrix(options=options) return RGBMatrix(options=options)