Skip to content

Fixed MAC reverse byte order issue within the ESP32SPI library as it … #66

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

Merged
merged 5 commits into from
Feb 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
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
10 changes: 10 additions & 0 deletions adafruit_esp32spi/adafruit_esp32spi.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,16 @@ def MAC_address(self): # pylint: disable=invalid-name
resp = self._send_command_get_response(_GET_MACADDR_CMD, [b'\xFF'])
return resp[0]

@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

def start_scan_networks(self):
"""Begin a scan of visible access points. Follow up with a call
to 'get_scan_networks' for response"""
Expand Down
4 changes: 4 additions & 0 deletions examples/server/esp32spi_wsgiserver.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@
spi = busio.SPI(board.SCK, board.MOSI, board.MISO)
esp = adafruit_esp32spi.ESP_SPIcontrol(spi, esp32_cs, esp32_ready, esp32_reset) # pylint: disable=line-too-long

print("MAC addr:", [hex(i) for i in esp.MAC_address])
print("MAC addr actual:", [hex(i) for i in esp.MAC_address_actual])

"""Use below for Most Boards"""
status_light = neopixel.NeoPixel(board.NEOPIXEL, 1, brightness=0.2) # Uncomment for Most Boards
"""Uncomment below for ItsyBitsy M4"""
Expand Down Expand Up @@ -213,3 +216,4 @@ def led_color(environ): # pylint: disable=unused-argument
print("Failed to update server, restarting ESP32\n", e)
wifi.reset()
continue