[realtek-ambz] Fix reading MAC address without WiFi enabled
This commit is contained in:
@@ -43,6 +43,7 @@ uint32_t LibreTuya::getChipId() {
|
||||
// TODO do what EFUSE_LogicalMapRead() does, and read only the used data
|
||||
EFUSE_LogicalMap_Read(efuse);
|
||||
memcpy(id, efuse + 0x11A + 3, 3);
|
||||
free(efuse);
|
||||
return chipId;
|
||||
}
|
||||
|
||||
|
||||
@@ -145,9 +145,14 @@ IPAddress WiFiClass::localIP() {
|
||||
}
|
||||
|
||||
uint8_t *WiFiClass::macAddress(uint8_t *mac) {
|
||||
uint8_t *macLocal = LwIP_GetMAC(NETIF_RTW_STA);
|
||||
memcpy(mac, macLocal, ETH_ALEN);
|
||||
free(macLocal);
|
||||
if (getMode() == WIFI_MODE_NULL) {
|
||||
uint8_t *efuse = (uint8_t *)malloc(512);
|
||||
EFUSE_LogicalMap_Read(efuse);
|
||||
memcpy(mac, efuse + 0x11A, ETH_ALEN);
|
||||
free(efuse);
|
||||
return mac;
|
||||
}
|
||||
memcpy(mac, LwIP_GetMAC(NETIF_RTW_STA), ETH_ALEN);
|
||||
return mac;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user