diff --git a/config/config.json b/config/config.json index 1f49432e..9c168347 100644 --- a/config/config.json +++ b/config/config.json @@ -6,10 +6,30 @@ "country": "US" }, "display": { - "brightness": 50, - "rows": 32, - "cols": 64, - "chain_length": 2, + "hardware": { + "rows": 32, + "cols": 64, + "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 }, "clock": { diff --git a/src/display_manager.py b/src/display_manager.py index 5e919f73..0ecb1751 100644 --- a/src/display_manager.py +++ b/src/display_manager.py @@ -26,24 +26,33 @@ class DisplayManager: """Setup the RGB matrix with the provided configuration.""" options = RGBMatrixOptions() - # Hardware specific settings - options.hardware_mapping = 'adafruit-hat' # Set for Adafruit Bonnet/HAT - options.gpio_slowdown = 4 # Required for Pi 3 - 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 + # Get hardware and runtime configs + hw_config = self.config.get('hardware', {}) + runtime_config = self.config.get('runtime', {}) - # Additional options for stability - options.disable_hardware_pulsing = False - options.show_refresh_rate = 0 # Turn off refresh rate display - options.limit_refresh_rate_hz = 100 + # Hardware specific settings + options.rows = hw_config.get('rows', 32) + options.cols = hw_config.get('cols', 64) + 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)