Skip to content

Commit 7b98eec

Browse files
committed
Force display configuration
1 parent 60cd407 commit 7b98eec

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

src/code.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -62,17 +62,15 @@
6262
}
6363

6464
display = supervisor.runtime.display
65-
if display is None:
66-
width_config = os.getenv("CIRCUITPY_DISPLAY_WIDTH")
67-
if width_config is None:
68-
request_display_config(720, 400)
69-
elif width_config in [x[0] for x in VALID_DISPLAY_SIZES]:
70-
for display_size in VALID_DISPLAY_SIZES:
71-
if display_size[0] == width_config:
72-
request_display_config(*display_size)
73-
break
74-
else:
65+
if (width_config := os.getenv("CIRCUITPY_DISPLAY_WIDTH")) is not None:
66+
if width_config not in [x[0] for x in VALID_DISPLAY_SIZES]:
7567
raise ValueError(f"Invalid display size. Must be one of: {VALID_DISPLAY_SIZES}")
68+
for display_size in VALID_DISPLAY_SIZES:
69+
if display_size[0] == width_config:
70+
break
71+
else:
72+
display_size = (720, 400)
73+
request_display_config(*display_size)
7674

7775
scale = 1
7876
if display.width > 360:

0 commit comments

Comments
 (0)