Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve native wifi API compatibility #199

Merged
merged 6 commits into from
May 3, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions adafruit_esp32spi/adafruit_esp32spi.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,12 +372,12 @@ def MAC_address(self): # pylint: disable=invalid-name
@property
def MAC_address_actual(self): # pylint: disable=invalid-name
"""A bytearray containing the actual MAC address of the ESP32"""
if self._debug:
print("MAC address")
resp = self._send_command_get_response(_GET_MACADDR_CMD, [b"\xFF"])
new_resp = bytearray(resp[0])
new_resp = reversed(new_resp)
return new_resp
return bytearray(reversed(self.MAC_address))

@property
def mac_address(self):
"""A bytes containing the actual MAC address of the ESP32"""
return bytes(reversed(self.MAC_address))
anecdata marked this conversation as resolved.
Show resolved Hide resolved

def start_scan_networks(self):
"""Begin a scan of visible access points. Follow up with a call
Expand Down Expand Up @@ -573,8 +573,10 @@ def disconnect(self):
if resp[0][0] != 1:
raise OSError("Failed to disconnect")

def connect(self, ssid, password, timeout=10):
def connect(self, ssid, password=None, timeout=10):
"""Connect to an access point with given name and password."""
if isinstance(ssid, dict): # secrets
ssid, password = ssid["ssid"], ssid["password"]
anecdata marked this conversation as resolved.
Show resolved Hide resolved
self.connect_AP(ssid, password, timeout_s=timeout)

def connect_AP(self, ssid, password, timeout_s=10): # pylint: disable=invalid-name
Expand Down
Loading