3131
3232# pylint: disable=no-name-in-module
3333
34+ from time import sleep
3435from micropython import const
3536from adafruit_esp32spi import adafruit_esp32spi
3637import adafruit_esp32spi .adafruit_esp32spi_requests as requests
@@ -42,6 +43,7 @@ class ESPSPI_WiFiManager:
4243 NORMAL = const (1 )
4344 ENTERPRISE = const (2 )
4445
46+ # pylint: disable=too-many-arguments
4547 def __init__ (self , esp , secrets , status_pixel = None , attempts = 2 , connection_type = NORMAL ):
4648 """
4749 :param ESP_SPIcontrol esp: The ESP object we are using
@@ -59,16 +61,27 @@ def __init__(self, esp, secrets, status_pixel=None, attempts=2, connection_type=
5961 self .debug = False
6062 self .ssid = secrets ['ssid' ]
6163 self .password = secrets ['password' ]
62- self .ent_ssid = secrets ['ent_ssid' ]
63- self .ent_ident = secrets ['ent_ident' ]
64- self .ent_user = secrets ['ent_user' ]
65- self .ent_password = secrets ['ent_password' ]
6664 self .attempts = attempts
6765 self ._connection_type = connection_type
6866 requests .set_interface (self .esp )
6967 self .statuspix = status_pixel
7068 self .pixel_status (0 )
7169
70+ # Check for WPA2 Enterprise keys in the secrets dictionary and load them if they exist
71+ if secrets .get ('ent_ssid' ):
72+ self .ent_ssid = secrets ['ent_ssid' ]
73+ else :
74+ self .ent_ssid = secrets ['ssid' ]
75+ if secrets .get ('ent_ident' ):
76+ self .ent_ident = secrets ['ent_ident' ]
77+ else :
78+ self .ent_ident = ''
79+ if secrets .get ('ent_user' ):
80+ self .ent_user = secrets ['ent_user' ]
81+ if secrets .get ('ent_password' ):
82+ self .ent_password = secrets ['ent_password' ]
83+ # pylint: enable=too-many-arguments
84+
7285 def reset (self ):
7386 """
7487 Perform a hard reset on the ESP32
0 commit comments