merged conflicts

This commit is contained in:
Dustin Mollo 2019-07-13 12:02:08 -07:00
parent 447955a76f
commit 0c07ceb51c

View file

@ -36,6 +36,17 @@ from micropython import const
from adafruit_esp32spi import adafruit_esp32spi
import adafruit_esp32spi.adafruit_esp32spi_requests as requests
class WiFiConnType: # pylint: disable=too-few-public-methods
"""An enum-like class representing the different types of WiFi connections
that can be made. The values can be referenced like ``WiFiConnType.normal``.
Possible values are
- ``ThermocoupleType.normal``
- ``ThermocoupleType.enterprise``
"""
# pylint: disable=invalid-name
normal = 1
enterprise = 2
class ESPSPI_WiFiManager:
"""
A class to help manage the Wifi connection
@ -117,12 +128,12 @@ class ESPSPI_WiFiManager:
Attempt a regular style WiFi connection
"""
failure_count = 0
while not self._esp.is_connected:
while not self.esp.is_connected:
try:
if self.debug:
print("Connecting to AP...")
self.pixel_status((100, 0, 0))
self._esp.connect_AP(bytes(self.ssid, 'utf-8'), bytes(self.password, 'utf-8'))
self.esp.connect_AP(bytes(self.ssid, 'utf-8'), bytes(self.password, 'utf-8'))
failure_count = 0
self.pixel_status((0, 100, 0))
except (ValueError, RuntimeError) as error:
@ -138,12 +149,12 @@ class ESPSPI_WiFiManager:
Attempt an enterprise style WiFi connection
"""
failure_count = 0
self._esp.wifi_set_network(bytes(self.ent_ssid, 'utf-8'))
self._esp.wifi_set_entidentity(bytes(self.ent_ident, 'utf-8'))
self._esp.wifi_set_entusername(bytes(self.ent_user, 'utf-8'))
self._esp.wifi_set_entpassword(bytes(self.ent_password, 'utf-8'))
self._esp.wifi_set_entenable()
while not self._esp.is_connected:
self.esp.wifi_set_network(bytes(self.ent_ssid, 'utf-8'))
self.esp.wifi_set_entidentity(bytes(self.ent_ident, 'utf-8'))
self.esp.wifi_set_entusername(bytes(self.ent_user, 'utf-8'))
self.esp.wifi_set_entpassword(bytes(self.ent_password, 'utf-8'))
self.esp.wifi_set_entenable()
while not self.esp.is_connected:
try:
if self.debug:
print("Waiting for the ESP32 to connect to the WPA2 Enterprise AP...")