@@ -143,6 +143,9 @@ class PyPortal:
143
143
:param caption_color: The color of your caption. Must be a hex value, e.g. ``0x808000``.
144
144
:param image_url_path: The HTTP traversal path for a background image to display.
145
145
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``.
146
149
:param debug: Turn on debug print outs. Defaults to False.
147
150
148
151
"""
@@ -154,7 +157,7 @@ def __init__(self, *, url=None, headers=None, json_path=None, regexp_path=None,
154
157
image_json_path = None , image_resize = None , image_position = None ,
155
158
caption_text = None , caption_font = None , caption_position = None ,
156
159
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 ):
158
161
159
162
self ._debug = debug
160
163
@@ -225,16 +228,14 @@ def __init__(self, *, url=None, headers=None, json_path=None, regexp_path=None,
225
228
except OSError :
226
229
pass # they deleted the file, no biggie!
227
230
228
- # If there was a passed ESP Object
229
- if esp :
231
+ if esp : # If there was a passed ESP Object
230
232
if self ._debug :
231
- print ("ESP32 Passed to PyPortal" )
233
+ print ("Passed ESP32 to PyPortal" )
232
234
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
236
238
spi = busio .SPI (board .SCK , board .MOSI , board .MISO )
237
- # Else: Make ESP32 connection
238
239
else :
239
240
if self ._debug :
240
241
print ("Init ESP32" )
0 commit comments