3434from adafruit_esp32spi import adafruit_esp32spi
3535import adafruit_esp32spi .adafruit_esp32spi_requests as requests
3636
37+ class WiFiConnType : # pylint: disable=too-few-public-methods
38+ """An enum-like class representing the different types of WiFi connections
39+ that can be made. The values can be referenced like ``WiFiConnType.normal``.
40+ Possible values are
41+ - ``ThermocoupleType.normal``
42+ - ``ThermocoupleType.enterprise``
43+ """
44+ # pylint: disable=invalid-name
45+ normal = 1
46+ enterprise = 2
47+
3748class ESPSPI_WiFiManager :
3849 """
3950 A class to help manage the Wifi connection
4051 """
41- def __init__ (self , esp , secrets , status_pixel = None , attempts = 2 , con_type = 1 ):
52+ def __init__ (self , esp , secrets , status_pixel = None , attempts = 2 , wificonntype = WiFiConnType . normal ):
4253 """
4354 :param ESP_SPIcontrol esp: The ESP object we are using
4455 :param dict secrets: The WiFi and Adafruit IO secrets dict (See examples)
4556 :param status_pixel: (Optional) The pixel device - A NeoPixel, DotStar,
4657 or RGB LED (default=None)
4758 :type status_pixel: NeoPixel, DotStar, or RGB LED
4859 :param int attempts: (Optional) Failed attempts before resetting the ESP32 (default=2)
49- :param int con_type: (Optional) Type of WiFi connection to make: normal=1, WPA2 Enterprise=2
60+ :param const con_type: (Optional) Type of WiFi connection: normal=1, WPA2 Enterprise=2
61+ :param ~adafruit_esp32spi_wifimanager.WiFiConnType wificonntype: The type of WiFi \
62+ connection to make. The default is "normal".
5063 """
5164 # Read the settings
5265 self .esp = esp
@@ -58,8 +71,8 @@ def __init__(self, esp, secrets, status_pixel=None, attempts=2, con_type=1):
5871 self .ent_user = secrets ['ent_user' ]
5972 self .ent_passwd = secrets ['ent_passwd' ]
6073 self .attempts = attempts
74+ self ._connection_type = connection_type
6175 requests .set_interface (self .esp )
62- self .con_type = con_type
6376 self .statuspix = status_pixel
6477 self .pixel_status (0 )
6578
0 commit comments