From c4ed2ec643687cfc57c5242206a0e359245a9df5 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Wed, 10 Aug 2022 13:37:26 -0400 Subject: [PATCH] handle no Display.auto_brightness --- Hallowing_Jump_Sound/jump-sound/code.py | 5 ++++- Hallowing_Jump_Sound/stomp-and-roar/code.py | 5 ++++- PyPortal_MQTT_Control/code.py | 5 ++++- PyPortal_Smart_Thermometer/code.py | 5 ++++- PyPortal_User_Interface/code.py | 5 ++++- 5 files changed, 20 insertions(+), 5 deletions(-) diff --git a/Hallowing_Jump_Sound/jump-sound/code.py b/Hallowing_Jump_Sound/jump-sound/code.py index 22cc5f1a6..5f4364f40 100755 --- a/Hallowing_Jump_Sound/jump-sound/code.py +++ b/Hallowing_Jump_Sound/jump-sound/code.py @@ -61,7 +61,10 @@ except AttributeError: AUDIO = audioio.AudioOut(board.SPEAKER) # Speaker -board.DISPLAY.auto_brightness = False +try: + board.DISPLAY.auto_brightness = False +except AttributeError: + pass TOUCH1 = touchio.TouchIn(board.TOUCH1) # Capacitive touch pads TOUCH2 = touchio.TouchIn(board.TOUCH2) TOUCH3 = touchio.TouchIn(board.TOUCH3) diff --git a/Hallowing_Jump_Sound/stomp-and-roar/code.py b/Hallowing_Jump_Sound/stomp-and-roar/code.py index e7ff1258b..dc2de1734 100755 --- a/Hallowing_Jump_Sound/stomp-and-roar/code.py +++ b/Hallowing_Jump_Sound/stomp-and-roar/code.py @@ -48,7 +48,10 @@ except AttributeError: AUDIO = audioio.AudioOut(board.SPEAKER) # Speaker -board.DISPLAY.auto_brightness = False +try: + board.DISPLAY.auto_brightness = False +except AttributeError: + pass # Set up accelerometer on I2C bus, 4G range: I2C = board.I2C() diff --git a/PyPortal_MQTT_Control/code.py b/PyPortal_MQTT_Control/code.py index 86ab45ce8..288831318 100644 --- a/PyPortal_MQTT_Control/code.py +++ b/PyPortal_MQTT_Control/code.py @@ -63,7 +63,10 @@ def set_backlight(val): off, and ``1`` is 100% brightness. """ val = max(0, min(1.0, val)) - board.DISPLAY.auto_brightness = False + try: + board.DISPLAY.auto_brightness = False + except AttributeError: + pass board.DISPLAY.brightness = val diff --git a/PyPortal_Smart_Thermometer/code.py b/PyPortal_Smart_Thermometer/code.py index e466723cd..b32efa04e 100755 --- a/PyPortal_Smart_Thermometer/code.py +++ b/PyPortal_Smart_Thermometer/code.py @@ -76,7 +76,10 @@ def set_backlight(val): off, and ``1`` is 100% brightness. """ val = max(0, min(1.0, val)) - board.DISPLAY.auto_brightness = False + try: + board.DISPLAY.auto_brightness = False + except AttributeError: + pass board.DISPLAY.brightness = val while True: diff --git a/PyPortal_User_Interface/code.py b/PyPortal_User_Interface/code.py index eb93049d0..a4682fde2 100644 --- a/PyPortal_User_Interface/code.py +++ b/PyPortal_User_Interface/code.py @@ -51,7 +51,10 @@ switch_state = 0 # Value between 0 and 1 where 0 is OFF, 0.5 is 50% and 1 is 100% brightness. def set_backlight(val): val = max(0, min(1.0, val)) - board.DISPLAY.auto_brightness = False + try: + board.DISPLAY.auto_brightness = False + except AttributeError: + pass board.DISPLAY.brightness = val