Skip to content

Commit c4ed2ec

Browse files
committed
handle no Display.auto_brightness
1 parent 0345780 commit c4ed2ec

5 files changed

Lines changed: 20 additions & 5 deletions

File tree

Hallowing_Jump_Sound/jump-sound/code.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,10 @@ def play_wav(wav):
6161

6262
AUDIO = audioio.AudioOut(board.SPEAKER) # Speaker
6363

64-
board.DISPLAY.auto_brightness = False
64+
try:
65+
board.DISPLAY.auto_brightness = False
66+
except AttributeError:
67+
pass
6568
TOUCH1 = touchio.TouchIn(board.TOUCH1) # Capacitive touch pads
6669
TOUCH2 = touchio.TouchIn(board.TOUCH2)
6770
TOUCH3 = touchio.TouchIn(board.TOUCH3)

Hallowing_Jump_Sound/stomp-and-roar/code.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,10 @@ def load_wav(name):
4848

4949
AUDIO = audioio.AudioOut(board.SPEAKER) # Speaker
5050

51-
board.DISPLAY.auto_brightness = False
51+
try:
52+
board.DISPLAY.auto_brightness = False
53+
except AttributeError:
54+
pass
5255

5356
# Set up accelerometer on I2C bus, 4G range:
5457
I2C = board.I2C()

PyPortal_MQTT_Control/code.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,10 @@ def set_backlight(val):
6363
off, and ``1`` is 100% brightness.
6464
"""
6565
val = max(0, min(1.0, val))
66-
board.DISPLAY.auto_brightness = False
66+
try:
67+
board.DISPLAY.auto_brightness = False
68+
except AttributeError:
69+
pass
6770
board.DISPLAY.brightness = val
6871

6972

PyPortal_Smart_Thermometer/code.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,10 @@ def set_backlight(val):
7676
off, and ``1`` is 100% brightness.
7777
"""
7878
val = max(0, min(1.0, val))
79-
board.DISPLAY.auto_brightness = False
79+
try:
80+
board.DISPLAY.auto_brightness = False
81+
except AttributeError:
82+
pass
8083
board.DISPLAY.brightness = val
8184

8285
while True:

PyPortal_User_Interface/code.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,10 @@
5151
# Value between 0 and 1 where 0 is OFF, 0.5 is 50% and 1 is 100% brightness.
5252
def set_backlight(val):
5353
val = max(0, min(1.0, val))
54-
board.DISPLAY.auto_brightness = False
54+
try:
55+
board.DISPLAY.auto_brightness = False
56+
except AttributeError:
57+
pass
5558
board.DISPLAY.brightness = val
5659

5760

0 commit comments

Comments
 (0)