Skip to content

Commit 0064a4a

Browse files
authored
Merge pull request #6 from FoamyGuy/dont_require_secrets_if_no_network
optional argument to specify not using network
2 parents dac415f + ece1abe commit 0064a4a

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

adafruit_esp32s2tft/__init__.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ class ESP32S2TFT(PortalBase):
6363
portrait/rotated
6464
:param scale: Default scale is 1, but can be an integer of 1 or greater
6565
:param debug: Turn on debug print outs. Defaults to False.
66+
:param use_network: Enable network initialization. Defaults to True.
67+
Setting to False will allow you to use the library without a secrets.py
68+
file with wifi configuration in it.
6669
6770
"""
6871

@@ -80,13 +83,17 @@ def __init__(
8083
rotation: int = 0,
8184
scale: int = 1,
8285
debug: bool = False,
86+
use_network: bool = True
8387
) -> None:
8488

85-
network = Network(
86-
status_neopixel=status_neopixel,
87-
extract_values=False,
88-
debug=debug,
89-
)
89+
if use_network:
90+
network = Network(
91+
status_neopixel=status_neopixel,
92+
extract_values=False,
93+
debug=debug,
94+
)
95+
else:
96+
network = None
9097

9198
graphics = Graphics(
9299
default_bg=default_bg,

examples/esp32s2tft_simpletest.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,7 @@
77
from rainbowio import colorwheel
88
from adafruit_esp32s2tft import ESP32S2TFT
99

10-
esp32s2tft = ESP32S2TFT(
11-
default_bg=0xFFFF00,
12-
scale=2,
13-
)
10+
esp32s2tft = ESP32S2TFT(default_bg=0xFFFF00, scale=2, use_network=False)
1411

1512
# Create the labels
1613
esp32s2tft.add_text(

0 commit comments

Comments
 (0)