Skip to content

Commit 180ceaa

Browse files
committed
fix valid SSID and passphrase requirements
1 parent 5a73905 commit 180ceaa

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

adafruit_esp32spi/adafruit_esp32spi.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -504,21 +504,21 @@ def connect_AP(self, ssid, password, timeout_s=10): # pylint: disable=invalid-na
504504
raise RuntimeError("No such ssid", ssid)
505505
raise RuntimeError("Unknown error 0x%02X" % stat)
506506

507-
def create_AP(self, ssid, password, channel=1, timeout_s=10): # pylint: disable=invalid-name
507+
def create_AP(self, ssid, password, channel=1, timeout=10): # pylint: disable=invalid-name
508508
"""
509509
Create an access point with the given name, password, and channel.
510510
Will wait until specified timeout seconds and return on success
511511
or raise an exception on failure.
512512
513-
:param ssid: the SSID of the created Access Point. Must be 8 or more characters
514-
:param passphrase: the password of the created Access Point. Must be 8 or more characters.
515-
:param channel: channel of created Access Point (1 - 14).
516-
:param timeout_s: number of seconds until we time out and fail to create AP
513+
:param str ssid: the SSID of the created Access Point. Must be less than 32 chars.
514+
:param str password: the password of the created Access Point. Must be 8-63 chars.
515+
:param int channel: channel of created Access Point (1 - 14).
516+
:param int timeout: number of seconds until we time out and fail to create AP
517517
"""
518-
if len(ssid) < 8:
519-
raise RuntimeError("ssid must be 8 more more characters")
520-
if len(password) < 8:
521-
raise RuntimeError("password must be 8 or more characters")
518+
if len(ssid) > 32:
519+
raise RuntimeError("ssid must be no more than 32 characters")
520+
if len(password) < 8 or len(password) < 64:
521+
raise RuntimeError("password must be 8 - 63 characters")
522522
if channel < 1 or channel > 14:
523523
raise RuntimeError("channel must be between 1 and 14")
524524

@@ -534,7 +534,7 @@ def create_AP(self, ssid, password, channel=1, timeout_s=10): # pylint: disable=
534534
self._wifi_set_ap_network(ssid, channel)
535535

536536
times = time.monotonic()
537-
while (time.monotonic() - times) < timeout_s: # wait up until timeout
537+
while (time.monotonic() - times) < timeout: # wait up to timeout
538538
stat = self.status
539539
if stat == WL_AP_LISTENING:
540540
return stat

0 commit comments

Comments
 (0)