Skip to content

Commit d8465f8

Browse files
committed
ESP32 - fix chip swap bytes
Swap the bytes to make the last byte most unsignificantly.
1 parent fb7552d commit d8465f8

File tree

3 files changed

+20
-20
lines changed

3 files changed

+20
-20
lines changed

README.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -41,25 +41,25 @@ ESP microcontroller has basically two versions, ESP8266 and ESP32, each one has
4141

4242
| UniqueID | ESP8266 | ESP32 |
4343
| :-------: | :------: | :------:|
44-
| Byte 0| Byte 0 | Byte 0 |
45-
| Byte 1| Byte 1 | Byte 1 |
46-
| Byte 2| Byte 2 | Byte 2 |
47-
| Byte 3| Byte 3 | Byte 3 |
48-
| Byte 4| - | Byte 4 |
49-
| Byte 5| - | Byte 5 |
44+
| Byte 0| Byte 0 | Byte 5 |
45+
| Byte 1| Byte 1 | Byte 4 |
46+
| Byte 2| Byte 2 | Byte 3 |
47+
| Byte 3| Byte 3 | Byte 2 |
48+
| Byte 4| - | Byte 1 |
49+
| Byte 5| - | Byte 0 |
5050

5151
To make the variable UniqueID8 to work propably the library uses the default bytes to 0x00. <br/>
5252

5353
| UniqueID8 | ESP8266 | ESP32 |
5454
| :-------: | :------: | :------:|
5555
| Byte 0| 0x00 | 0x00 |
5656
| Byte 1| 0x00 | 0x00 |
57-
| Byte 2| 0x00 | Byte 0 |
58-
| Byte 3| 0x00 | Byte 1 |
59-
| Byte 4| Byte 0 | Byte 2 |
60-
| Byte 5| Byte 1 | Byte 3 |
61-
| Byte 6| Byte 2 | Byte 4 |
62-
| Byte 7| Byte 3 | Byte 5 |
57+
| Byte 2| 0x00 | Byte 5 |
58+
| Byte 3| 0x00 | Byte 4 |
59+
| Byte 4| Byte 0 | Byte 3 |
60+
| Byte 5| Byte 1 | Byte 2 |
61+
| Byte 6| Byte 2 | Byte 1 |
62+
| Byte 7| Byte 3 | Byte 0 |
6363

6464
## Tested Microcontroller
6565

@@ -73,7 +73,7 @@ This library only supports AVR Microcontroller and ESP Microcontroller.
7373
## Installation
7474

7575
* Install the library by [Using the Library Manager](https://www.arduino.cc/en/Guide/Libraries#toc3)
76-
* **OR** by [Importing the .zip library](https://www.arduino.cc/en/Guide/Libraries#toc4) using either the [master](https://github.com/ricaun/ArduinoUniqueID/archive/1.0.4.zip) or one of the [releases](https://github.com/ricaun/ArduinoUniqueID/releases) ZIP files.
76+
* **OR** by [Importing the .zip library](https://www.arduino.cc/en/Guide/Libraries#toc4) using either the [master](https://github.com/ricaun/ArduinoUniqueID/archive/1.0.5.zip) or one of the [releases](https://github.com/ricaun/ArduinoUniqueID/releases) ZIP files.
7777

7878
## Examples
7979

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=ArduinoUniqueID
2-
version=1.0.4
2+
version=1.0.5
33
author=Luiz Henrique Cassettari
44
maintainer=Luiz Henrique Cassettari <ricaun@gmail.com>
55
sentence=Arduino Library to get the AVR microcontroler Unique ID / Manufacture Serial Number.

src/ArduinoUniqueID.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ ArduinoUniqueID::ArduinoUniqueID()
2525
uint64_t chipid = ESP.getEfuseMac();
2626
id[0] = 0;
2727
id[1] = 0;
28-
id[2] = chipid >> 40;
29-
id[3] = chipid >> 32;
30-
id[4] = chipid >> 24;
31-
id[5] = chipid >> 16;
32-
id[6] = chipid >> 8;
33-
id[7] = chipid;
28+
id[2] = chipid;
29+
id[3] = chipid >> 8;
30+
id[4] = chipid >> 16;
31+
id[5] = chipid >> 24;
32+
id[6] = chipid >> 32;
33+
id[7] = chipid >> 40;
3434
#endif
3535
}
3636

0 commit comments

Comments
 (0)