Skip to content

Commit f6e1695

Browse files
committed
Add more docs and fix linting
1 parent 02477df commit f6e1695

File tree

2 files changed

+20
-9
lines changed

2 files changed

+20
-9
lines changed

adafruit_esp32spi/adafruit_esp32spi.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -412,14 +412,24 @@ def wifi_set_entenable(self):
412412
raise RuntimeError("Failed to enable enterprise mode")
413413

414414
def wifi_set_ap_network(self, ssid, channel):
415-
"""TODO Docs"""
415+
"""
416+
Creates an Access point with SSID and Channel
417+
418+
:param ssid: the SSID of the created Access Point. Must be 8 or more characters
419+
:param channel: channel of created Access Point (1 - 14).
420+
"""
416421
resp = self._send_command_get_response(_SET_AP_NET_CMD, [ssid, channel])
417422
if resp[0][0] != 1:
418423
raise RuntimeError("Failed to setup AP network")
419424

420425
def wifi_set_ap_passphrase(self, ssid, passphrase, channel):
421-
"""TODO Docs"""
422-
""" TODO: Why does this command refuse to work? creating AP w/out password works fine"""
426+
"""
427+
Creates an Access point with SSID, passphrase, and Channel
428+
429+
:param ssid: the SSID of the created Access Point. Must be 8 or more characters
430+
:param passphrase: the password of the created Access Point. Must be 8 or more characters.
431+
:param channel: channel of created Access Point (1 - 14).
432+
"""
423433
resp = self._send_command_get_response(_SET_AP_PASSPHRASE_CMD, [ssid, passphrase, channel])
424434
if resp[0][0] != 1:
425435
raise RuntimeError("Failed to setup AP password")
@@ -497,7 +507,7 @@ def connect_AP(self, ssid, password): # pylint: disable=invalid-name
497507
raise RuntimeError("No such ssid", ssid)
498508
raise RuntimeError("Unknown error 0x%02X" % stat)
499509

500-
def create_AP(self, ssid, password, channel=b'\x01'):
510+
def create_ap(self, ssid, password, channel=b'\x01'):
501511
"""Create an access point with the given name and password."""
502512
if isinstance(ssid, str):
503513
ssid = bytes(ssid, 'utf-8')

adafruit_esp32spi/adafruit_esp32spi_wifimanager.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,20 +97,21 @@ def connect(self):
9797
def create_ap(self):
9898
"""
9999
Attempt to initialize in Access Point (AP) mode.
100+
Uses SSID and optional passphrase from the current settings
100101
Other WiFi devices will be able to connect to the created Access Point
101102
"""
102103
failure_count = 0
103104
while not self._esp.ap_listening:
104105
try:
105106
if self.debug:
106107
print("Waiting for AP to be initialized...")
107-
self.pixel_status((100,0,0))
108-
if(self.password):
109-
self._esp.create_AP(bytes(self.ssid, 'utf-8'), bytes(self.password, 'utf-8'))
108+
self.pixel_status((100, 0, 0))
109+
if self.password:
110+
self._esp.create_ap(bytes(self.ssid, 'utf-8'), bytes(self.password, 'utf-8'))
110111
else:
111-
self._esp.create_AP(bytes(self.ssid, 'utf-8'), None)
112+
self._esp.create_ap(bytes(self.ssid, 'utf-8'), None)
112113
failure_count = 0
113-
self.pixel_status((0,100,0))
114+
self.pixel_status((0, 100, 0))
114115
except (ValueError, RuntimeError) as error:
115116
print("Failed to create access point\n", error)
116117
failure_count += 1

0 commit comments

Comments
 (0)