Skip to content

Commit

Permalink
update with regards to esp8266/Arduino#2309
Browse files Browse the repository at this point in the history
  • Loading branch information
suculent committed Jun 23, 2020
1 parent ce7c9a3 commit 7f4acff
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/ESPCompatibility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,19 @@ char * ESPCompatibility::get_mac_id()
{
uint8_t raw[6];

/*
uint32_t mac0 = MAC0;
uint32_t mac1 = MAC1;
uint32_t chipid = CHIPID;
uint32_t apiChipId = ESP.getChipId();
String macAddress = WiFi.macAddress();
Serial.printf("mac0 = 0x%08x\n", mac0);
Serial.printf("mac1 = 0x%08x\n", mac1);
Serial.printf("chipid = 0x%08x\n", chipid);
Serial.printf("apiChipId = 0x%08x\n", apiChipId);
Serial.printf("macaddress = %s\n", macAddress.c_str());
*/

#ifdef ESP8266
uint32_t chipid = ESP.getChipId();
sprintf(this->mac, "5CCF7F%.6X", ESP.getChipId());
Expand All @@ -20,6 +33,11 @@ char * ESPCompatibility::get_mac_id()
sprintf(this->mac, "%02X%02X%02X%02X%02X%02X", raw[0], raw[1], raw[2], raw[3], raw[4], raw[5]);
#endif

String macAddress = WiFi.macAddress();
macAddress.replace(":", "");
macAddress.replace(" ", "");
sprintf(this->mac, "%s", macAddress.c_str());

return this->mac;
}

Expand Down

0 comments on commit 7f4acff

Please sign in to comment.