Skip to content

Commit 7ce2e4a

Browse files
zheshelmzheshelm
authored andcommitted
Moved some comments to be in line with If statement and added the optional param comments for the two variables added to the init
1 parent 8d9b5cc commit 7ce2e4a

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

adafruit_pyportal.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,9 @@ class PyPortal:
143143
:param caption_color: The color of your caption. Must be a hex value, e.g. ``0x808000``.
144144
:param image_url_path: The HTTP traversal path for a background image to display.
145145
Defaults to ``None``.
146+
:param esp: A passed ESP32 object, Can be used in cases where the ESP32 chip needs to be used
147+
before calling the pyportal class. Defaults to ``None``.
148+
:param busio.SPI external_spi: A previously declared spi object. Defaults to ``None``.
146149
:param debug: Turn on debug print outs. Defaults to False.
147150
148151
"""
@@ -154,7 +157,7 @@ def __init__(self, *, url=None, headers=None, json_path=None, regexp_path=None,
154157
image_json_path=None, image_resize=None, image_position=None,
155158
caption_text=None, caption_font=None, caption_position=None,
156159
caption_color=0x808080, image_url_path=None,
157-
success_callback=None, esp=None, passed_spi=None, debug=False):
160+
success_callback=None, esp=None, external_spi=None, debug=False):
158161

159162
self._debug = debug
160163

@@ -225,16 +228,14 @@ def __init__(self, *, url=None, headers=None, json_path=None, regexp_path=None,
225228
except OSError:
226229
pass # they deleted the file, no biggie!
227230

228-
# If there was a passed ESP Object
229-
if esp:
231+
if esp: # If there was a passed ESP Object
230232
if self._debug:
231-
print("ESP32 Passed to PyPortal")
233+
print("Passed ESP32 to PyPortal")
232234
self._esp = esp
233-
if passed_spi: #If SPI Object Passed
234-
spi = passed_spi
235-
else:
235+
if external_spi: #If SPI Object Passed
236+
spi = external_spi
237+
else: # Else: Make ESP32 connection
236238
spi = busio.SPI(board.SCK, board.MOSI, board.MISO)
237-
# Else: Make ESP32 connection
238239
else:
239240
if self._debug:
240241
print("Init ESP32")

0 commit comments

Comments
 (0)