Skip to content

Commit 196ed97

Browse files
committed
neaten up mac
1 parent 3c0ba7a commit 196ed97

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

adafruit_miniesptool.py

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -163,12 +163,8 @@ def md5(self, offset, size):
163163
def mac_addr(self):
164164
"""The MAC address burned into the OTP memory of the ESP chip"""
165165
mac_addr = [0] * 6
166+
mac0, mac1, mac2, mac3 = self._efuses
166167
if self._chipfamily == ESP8266:
167-
print([hex(i) for i in self._efuses])
168-
mac0 = self._efuses[0]
169-
mac1 = self._efuses[1]
170-
mac3 = self._efuses[3]
171-
172168
if (mac3 != 0):
173169
oui = ((mac3 >> 16) & 0xff, (mac3 >> 8) & 0xff, mac3 & 0xff)
174170
elif ((mac1 >> 16) & 0xff) == 0:
@@ -185,12 +181,12 @@ def mac_addr(self):
185181
mac_addr[4] = mac1 & 0xff
186182
mac_addr[5] = (mac0>>24) & 0xff
187183
if self._chipfamily == ESP32:
188-
mac_addr[0] = self._efuses[2] >> 8 & 0xFF
189-
mac_addr[1] = self._efuses[2] & 0xFF
190-
mac_addr[2] = self._efuses[1] >> 24 & 0xFF
191-
mac_addr[3] = self._efuses[1] >> 16 & 0xFF
192-
mac_addr[4] = self._efuses[1] >> 8 & 0xFF
193-
mac_addr[5] = self._efuses[1] & 0xFF
184+
mac_addr[0] = mac2 >> 8 & 0xFF
185+
mac_addr[1] = mac2 & 0xFF
186+
mac_addr[2] = mac1 >> 24 & 0xFF
187+
mac_addr[3] = mac1 >> 16 & 0xFF
188+
mac_addr[4] = mac1 >> 8 & 0xFF
189+
mac_addr[5] = mac1 & 0xFF
194190
return mac_addr
195191

196192
@property

0 commit comments

Comments
 (0)