34
34
from adafruit_esp32spi import adafruit_esp32spi
35
35
import adafruit_esp32spi .adafruit_esp32spi_requests as requests
36
36
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
+
37
48
class ESPSPI_WiFiManager :
38
49
"""
39
50
A class to help manage the Wifi connection
40
51
"""
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 ):
42
53
"""
43
54
:param ESP_SPIcontrol esp: The ESP object we are using
44
55
:param dict secrets: The WiFi and Adafruit IO secrets dict (See examples)
45
56
:param status_pixel: (Optional) The pixel device - A NeoPixel, DotStar,
46
57
or RGB LED (default=None)
47
58
:type status_pixel: NeoPixel, DotStar, or RGB LED
48
59
: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".
50
63
"""
51
64
# Read the settings
52
65
self .esp = esp
@@ -58,8 +71,8 @@ def __init__(self, esp, secrets, status_pixel=None, attempts=2, con_type=1):
58
71
self .ent_user = secrets ['ent_user' ]
59
72
self .ent_passwd = secrets ['ent_passwd' ]
60
73
self .attempts = attempts
74
+ self ._connection_type = connection_type
61
75
requests .set_interface (self .esp )
62
- self .con_type = con_type
63
76
self .statuspix = status_pixel
64
77
self .pixel_status (0 )
65
78
0 commit comments