Skip to content

Commit be6cf7d

Browse files
committed
ANAVI Knobs 3: Fix when running without a display
Handle runtime error if mini I2C OLED display has not been attached to ANAVI Knobs 3. Fixes: RuntimeError: No pull up found on SDA or SCL; check your wiring Signed-off-by: Leon Anavi <leon@anavi.org>
1 parent 6949753 commit be6cf7d

1 file changed

Lines changed: 11 additions & 8 deletions

File tree

boards/anavi/knobs3/code.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,17 @@
1515
knob.SCL = board.D5
1616
knob.SDA = board.D4
1717

18-
display = Display(
19-
display=SSD1306(sda=board.D4, scl=board.D5),
20-
entries=[
21-
TextEntry(text='ANAVI Knobs 3\n\nKMK Firmware'),
22-
],
23-
height=64,
24-
)
25-
knob.extensions.append(display)
18+
try:
19+
display = Display(
20+
display=SSD1306(sda=board.D4, scl=board.D5),
21+
entries=[
22+
TextEntry(text='ANAVI Knobs 3\n\nKMK Firmware'),
23+
],
24+
height=64,
25+
)
26+
knob.extensions.append(display)
27+
except RuntimeError as e:
28+
print('Mini OLED I2C Display is not available')
2629

2730
knob.matrix = KeysScanner([], value_when_pressed=False)
2831

0 commit comments

Comments
 (0)