added brightness

This commit is contained in:
Justin 2023-08-23 21:21:26 +08:00 committed by GitHub
parent b291023ada
commit 9684beaf92
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8,7 +8,7 @@ try:
with open('clock_screensaver.json', 'r') as f: with open('clock_screensaver.json', 'r') as f:
settings = json.load(f)['clock2'] settings = json.load(f)['clock2']
except: except:
settings1 = {"clock1": {"time_color": "White", "weekday_color": "Cyan", "date_color": "Blue", "timezone": "Etc/GMT+4", "display_seconds": True, "display_pm": True, "12hour": True}, "clock2": {"time_color": "Orange", "date_color": "White", "timezone": "Etc/GMT+4", "display_seconds": True, "display_pm": True, "12hour": True}, "world_clock": {"city_color": "White", "display_seconds": True, "display_pm": True, "12hour": True}} settings1 = {"clock1": {"time_color": "White", "weekday_color": "Cyan", "date_color": "Blue", "timezone": "Etc/GMT+4", "display_seconds": True, "display_pm": True, "12hour": True, "brightness": "10"}, "clock2": {"time_color": "Orange", "date_color": "White", "timezone": "Etc/GMT+4", "display_seconds": True, "display_pm": True, "12hour": True, "brightness": "10"}, "world_clock": {"city_color": "White", "display_seconds": True, "display_pm": True, "12hour": True, "brightness": "10"}}
with open('clock_screensaver.json', 'w') as f: with open('clock_screensaver.json', 'w') as f:
json.dump(settings1, f) json.dump(settings1, f)
settings = settings1['clock2'] settings = settings1['clock2']
@ -21,6 +21,7 @@ options.chain_length = 1
options.parallel = 1 options.parallel = 1
options.hardware_mapping = 'adafruit-hat' # Change this if you have a different GPIO mapping options.hardware_mapping = 'adafruit-hat' # Change this if you have a different GPIO mapping
options.gpio_slowdown = 2 options.gpio_slowdown = 2
options.brightness = int(settings['brightness']) * 10
# Create the RGBMatrix object # Create the RGBMatrix object
matrix = RGBMatrix(options=options) matrix = RGBMatrix(options=options)