Skip to content

Commit

Permalink
added ESP32 chip ID
Browse files Browse the repository at this point in the history
  • Loading branch information
marcoschwartz committed Mar 27, 2022
1 parent bcb3e35 commit ff08df7
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 19 deletions.
12 changes: 11 additions & 1 deletion aREST.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License:
http://creativecommons.org/licenses/by-sa/4.0/
Version 2.9.5
Version 2.9.6
Changelog:
Version 2.9.6: Add ID generator for ESP32
Version 2.9.5: Compatibility with latest ESP8266 library
Version 2.9.4: Publish() fixes
Version 2.9.3: Compatibility fix
Expand Down Expand Up @@ -1669,6 +1670,15 @@ String gen_random(int length) {

randomString = String(ESP.getChipId());
randomString = randomString.substring(0, 6);
#elif defined(ESP32)

uint32_t chipId = 0;
for(int i=0; i<17; i=i+8) {
chipId |= ((ESP.getEfuseMac() >> (40 - i)) & 0xff) << i;
}

randomString = String(chipId);
randomString = randomString.substring(0, 6);

#elif defined(__arm__)

Expand Down
33 changes: 16 additions & 17 deletions library.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
{
"name": "aREST",
"keywords": "REST, wifi, ethernet, http, web, server, json, spi",
"description": "RESTful API for Arduino using HTTP or Serial communications",
"repository":
{
"type": "git",
"url": "https://github.com/marcoschwartz/aREST.git"
},
"frameworks": "arduino",
"platforms":
[
"atmelavr",
"atmelsam",
"espressif",
"teensy"
]
}
"name": "aREST",
"keywords": "REST, wifi, ethernet, http, web, server, json, spi",
"description": "RESTful API for Arduino using HTTP or Serial communications",
"repository": {
"type": "git",
"url": "https://github.com/marcoschwartz/aREST.git"
},
"frameworks": "arduino",
"version": "2.9.6",
"platforms": [
"atmelavr",
"atmelsam",
"espressif",
"teensy"
]
}
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=aREST
version=2.9.5
version=2.9.6
author=Marco Schwartz
maintainer=Marco Schwartz <[email protected]>
sentence=RESTful API for the Arduino platform.
Expand Down

0 comments on commit ff08df7

Please sign in to comment.