Skip to content

Commit ff08df7

Browse files
committed
added ESP32 chip ID
1 parent bcb3e35 commit ff08df7

File tree

3 files changed

+28
-19
lines changed

3 files changed

+28
-19
lines changed

aREST.h

+11-1
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@
77
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License:
88
http://creativecommons.org/licenses/by-sa/4.0/
99
10-
Version 2.9.5
10+
Version 2.9.6
1111
Changelog:
1212
13+
Version 2.9.6: Add ID generator for ESP32
1314
Version 2.9.5: Compatibility with latest ESP8266 library
1415
Version 2.9.4: Publish() fixes
1516
Version 2.9.3: Compatibility fix
@@ -1669,6 +1670,15 @@ String gen_random(int length) {
16691670

16701671
randomString = String(ESP.getChipId());
16711672
randomString = randomString.substring(0, 6);
1673+
#elif defined(ESP32)
1674+
1675+
uint32_t chipId = 0;
1676+
for(int i=0; i<17; i=i+8) {
1677+
chipId |= ((ESP.getEfuseMac() >> (40 - i)) & 0xff) << i;
1678+
}
1679+
1680+
randomString = String(chipId);
1681+
randomString = randomString.substring(0, 6);
16721682

16731683
#elif defined(__arm__)
16741684

library.json

+16-17
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
{
2-
"name": "aREST",
3-
"keywords": "REST, wifi, ethernet, http, web, server, json, spi",
4-
"description": "RESTful API for Arduino using HTTP or Serial communications",
5-
"repository":
6-
{
7-
"type": "git",
8-
"url": "https://github.com/marcoschwartz/aREST.git"
9-
},
10-
"frameworks": "arduino",
11-
"platforms":
12-
[
13-
"atmelavr",
14-
"atmelsam",
15-
"espressif",
16-
"teensy"
17-
]
18-
}
2+
"name": "aREST",
3+
"keywords": "REST, wifi, ethernet, http, web, server, json, spi",
4+
"description": "RESTful API for Arduino using HTTP or Serial communications",
5+
"repository": {
6+
"type": "git",
7+
"url": "https://github.com/marcoschwartz/aREST.git"
8+
},
9+
"frameworks": "arduino",
10+
"version": "2.9.6",
11+
"platforms": [
12+
"atmelavr",
13+
"atmelsam",
14+
"espressif",
15+
"teensy"
16+
]
17+
}

library.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=aREST
2-
version=2.9.5
2+
version=2.9.6
33
author=Marco Schwartz
44
maintainer=Marco Schwartz <marcolivier.schwartz@gmail.com>
55
sentence=RESTful API for the Arduino platform.

0 commit comments

Comments
 (0)