Created
February 14, 2022 14:14
-
-
Save likeablob/1eafa67c0995c188ff6fb507ddbd237f to your computer and use it in GitHub Desktop.
ESP32 ESP.getChipId() alternative
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Esp.h> | |
#include <byteswap.h> | |
// Get the lower 3 bytes of 6 byte MAC | |
// aa:bb:cc:dd:ee:ff -> dd:ee:ff | |
// (3 byte shift, byte-swap and 1 byte shift) | |
uint32_t partialMac = __bswap_32(ESP.getEfuseMac() >> 24) >> 8; | |
String clientId = String("eee-") + String(partialMac, HEX); | |
uint32_t getChipId(){ | |
return __bswap_32(ESP.getEfuseMac() >> 24) >> 8; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment