diff --git a/README.md b/README.md index d5d54513..9f48f9c2 100644 --- a/README.md +++ b/README.md @@ -251,9 +251,9 @@ This [**Ethernet_Manager** library](https://github.com/khoih-prog/Ethernet_Manag - [`Adafruit's LittleFS/InternalFS`](www.adafruit.com) for nRF52 16. [`EthernetWebServer library v2.2.2+`](https://github.com/khoih-prog/EthernetWebServer). To install. check [![arduino-library-badge](https://www.ardu-badge.com/badge/EthernetWebServer.svg?)](https://www.ardu-badge.com/EthernetWebServer). 17. [`WebServer_WT32_ETH01 library v1.5.0+`](https://github.com/khoih-prog/WebServer_WT32_ETH01) for WT32_ETH01 boards. To install. check [![arduino-library-badge](https://www.ardu-badge.com/badge/WebServer_WT32_ETH01.svg?)](https://www.ardu-badge.com/WebServer_WT32_ETH01). -18. [`ESP_DoubleResetDetector library v1.3.1+`](https://github.com/khoih-prog/ESP_DoubleResetDetector) for ESP32 and ESP8266. To install. check [![arduino-library-badge](https://www.ardu-badge.com/badge/ESP_DoubleResetDetector.svg?)](https://www.ardu-badge.com/ESP_DoubleResetDetector). +18. [`ESP_DoubleResetDetector library v1.3.2+`](https://github.com/khoih-prog/ESP_DoubleResetDetector) for ESP32 and ESP8266. To install. check [![arduino-library-badge](https://www.ardu-badge.com/badge/ESP_DoubleResetDetector.svg?)](https://www.ardu-badge.com/ESP_DoubleResetDetector). 19. [`DoubleResetDetector_Generic library v1.8.1+`](https://github.com/khoih-prog/DoubleResetDetector_Generic) for other boards (not ESP32 or ESP8266). To install. check [![arduino-library-badge](https://www.ardu-badge.com/badge/DoubleResetDetector_Generic.svg?)](https://www.ardu-badge.com/DoubleResetDetector_Generic). -20. [`LittleFS_esp32 v1.0.6+`](https://github.com/lorol/LITTLEFS) for ESP32-based boards using LittleFS with ESP32 core v1.0.5-. To install, check [![arduino-library-badge](https://www.ardu-badge.com/badge/LittleFS_esp32.svg?)](https://www.ardu-badge.com/LittleFS_esp32). **Notice**: This [`LittleFS_esp32 library`](https://github.com/lorol/LITTLEFS) has been integrated to Arduino [ESP32 core v1.0.6+](https://github.com/espressif/arduino-esp32/tree/master/libraries/LITTLEFS) and you don't need to install it if using ESP32 core v1.0.6+ +20. [`LittleFS_esp32 v1.0.6+`](https://github.com/lorol/LITTLEFS) for ESP32-based boards using LittleFS with ESP32 core **v1.0.5-**. To install, check [![arduino-library-badge](https://www.ardu-badge.com/badge/LittleFS_esp32.svg?)](https://www.ardu-badge.com/LittleFS_esp32). **Notice**: This [`LittleFS_esp32 library`](https://github.com/lorol/LITTLEFS) has been integrated to Arduino [ESP32 core v1.0.6+](https://github.com/espressif/arduino-esp32/tree/master/libraries/LITTLEFS) and **you don't need to install it if using ESP32 core v1.0.6+** --- @@ -1440,7 +1440,7 @@ This is the terminal output of an Adafruit NRF52840_FEATHER board with W5500 Eth ``` Start Ethernet_nRF52 on NRF52840_FEATHER Ethernet Shield type W5x00 using Ethernet_Generic Library -Ethernet_Manager v1.8.0 +Ethernet_Manager v1.8.1 DoubleResetDetector_Generic v1.8.1 [EWS] =========== USE_ETHERNET_GENERIC =========== [EWS] Default SPI pinout: @@ -1532,7 +1532,7 @@ Pubs Topics = old-mqtt-PubTopic ```cpp Start Ethernet_nRF52 on NRF52840_FEATHER Ethernet Shield type : W5x00 using Ethernet_Generic Library -Ethernet_Manager v1.8.0 +Ethernet_Manager v1.8.1 DoubleResetDetector_Generic v1.8.1 [EWS] =========== USE_ETHERNET_GENERIC =========== [EWS] Default SPI pinout: @@ -1715,7 +1715,7 @@ This is the terminal output of an SeeedStudio SAMD21 SEEED_XIAO_M0 board with W5 ``` Start Ethernet_SAMD on SEEED_XIAO_M0 Ethernet Shield type : W5x00 using Ethernet Library -Ethernet_Manager v1.8.0 +Ethernet_Manager v1.8.1 DoubleResetDetector_Generic v1.8.1 Flag read = 0xffffffff No doubleResetDetected @@ -1792,7 +1792,7 @@ This is the terminal output of an Arduino SAM DUE board with W5100 Ethernet shie ``` Start Ethernet_SAM_DUE on SAM DUE Ethernet Shield type : W5x00 using Ethernet_Generic Library -Ethernet_Manager v1.8.0 +Ethernet_Manager v1.8.1 DoubleResetDetector_Generic v1.8.1 Flag read = 0xd0d01234 doubleResetDetected @@ -1878,8 +1878,8 @@ If no valid config data are stored in EEPROM, it will switch to `Configuration M ``` Start MQTT_ThingStream_Ethernet_Generic using LittleFS on ESP8266_NODEMCU Ethernet Shield type : W5x00 using Ethernet_Generic Library -Ethernet_Manager v1.8.0 -ESP_DoubleResetDetector v1.3.1 +Ethernet_Manager v1.8.1 +ESP_DoubleResetDetector v1.3.2 ========================= Currently Used SPI pinout: MOSI:13 @@ -1926,8 +1926,8 @@ Enter your credentials (Blynk Servers/Tokens and Port). If you prefer static IP, ``` Start MQTT_ThingStream_Ethernet_Generic using LittleFS on ESP8266_NODEMCU Ethernet Shield type : W5x00 using Ethernet_Generic Library -Ethernet_Manager v1.8.0 -ESP_DoubleResetDetector v1.3.1 +Ethernet_Manager v1.8.1 +ESP_DoubleResetDetector v1.3.2 ========================= Currently Used SPI pinout: MOSI:13 @@ -1986,7 +1986,7 @@ This is the terminal output of NRF52840_FEATHER board with ENC28J60 using Ethern ``` Start MQTT_ThingStream_Ethernet_Generic on NRF52840_FEATHER Ethernet Shield type : ENC28J60 using EthernetENC Library -Ethernet_Manager v1.8.0 +Ethernet_Manager v1.8.1 DoubleResetDetector_Generic v1.8.1 LittleFS Flag read = 0xd0d01234 Flag read = 0xd0d01234 @@ -2024,7 +2024,7 @@ esp32-sniffer/12345678/ble ``` Start MQTT_ThingStream_Ethernet_Generic on NRF52840_FEATHER Ethernet Shield type : ENC28J60 using EthernetENC Library -Ethernet_Manager v1.8.0 +Ethernet_Manager v1.8.1 DoubleResetDetector_Generic v1.8.1 LittleFS Flag read = 0xd0d04321 Flag read = 0xd0d04321 @@ -2081,7 +2081,7 @@ This is the terminal output of RASPBERRY_PI_PICO board with W5x00 using Ethernet ``` Start MQTT_ThingStream_Ethernet_RP2040 on RASPBERRY_PI_PICO Ethernet Shield type : W5x00 using Ethernet_Generic Library -Ethernet_Manager v1.8.0 +Ethernet_Manager v1.8.1 DoubleResetDetector_Generic v1.8.1 [EWS] =========== USE_ETHERNET_GENERIC =========== [EWS] Default SPI pinout: @@ -2138,7 +2138,7 @@ esp32-sniffer/12345678/ble ``` Start MQTT_ThingStream_Ethernet_RP2040 on RASPBERRY_PI_PICO Ethernet Shield type : W5x00 using Ethernet_Generic Library -Ethernet_Manager v1.8.0 +Ethernet_Manager v1.8.1 DoubleResetDetector_Generic v1.8.1 [EWS] =========== USE_ETHERNET_GENERIC =========== [EWS] Default SPI pinout: @@ -2211,7 +2211,7 @@ This is the terminal output of an MBED RASPBERRY_PI_PICO board with W5500 Ethern ``` Start Ethernet_RP2040 on MBED RASPBERRY_PI_PICO Ethernet Shield type : W5x00 using Ethernet_Generic Library -Ethernet_Manager v1.8.0 +Ethernet_Manager v1.8.1 DoubleResetDetector_Generic v1.8.1 [[EWS] =========== USE_ETHERNET_GENERIC =========== [EWS] Default SPI pinout: @@ -2284,7 +2284,7 @@ HHHH[ETM] h:Updating LittleFS: /fs/etm_config.dat ``` Start Ethernet_RP2040 on MBED RASPBERRY_PI_PICO Ethernet Shield type : W5x00 using Ethernet_Generic Library -Ethernet_Manager v1.8.0 +Ethernet_Manager v1.8.1 DoubleResetDetector_Generic v1.8.1 [EWS] =========== USE_ETHERNET_GENERIC =========== [EWS] Default SPI pinout: @@ -2354,8 +2354,8 @@ This is the terminal output of WT32-ETH01 board with LAN8720 Ethernet, running c Start MQTT_ThingStream_Ethernet_WT32_ETH01 on WT32-ETH01 Ethernet Shield type : ETH_PHY_LAN8720 WebServer_WT32_ETH01 v1.5.0 -Ethernet_Manager v1.8.0 -ESP_DoubleResetDetector v1.3.1 +Ethernet_Manager v1.8.1 +ESP_DoubleResetDetector v1.3.2 [ETM] Set CustomsStyle to : [ETM] Set CustomsHeadElement to : [ETM] Set CORS Header to : Your Access-Control-Allow-Origin @@ -2436,7 +2436,7 @@ This is the terminal output of Teensy 4.1 board with built-in Ethernet, using QN ``` Starting QNEthernet_Teensy on TEENSY 4.1 using QNEthernet -Ethernet_Manager v1.8.0 +Ethernet_Manager v1.8.1 DoubleResetDetector_Generic v1.8.1 [EWS] =========== USE_QN_ETHERNET =========== QNEthernet using static IP @@ -2559,6 +2559,8 @@ Default Credentials and dynamic parameters 37. Fix `macAddress` bug. Check [Unable so set MAC Address #2](https://github.com/khoih-prog/Ethernet_Manager/issues/2) 38. Permit setting `macAddress` for supporting Ethernet shields W5x00 and ENC28J60 39. Add functions relating to `macAddress` +40. Fix chipID and add getChipID(), getChipOUI() for `ESP32` and `WT32_ETH01` + --- --- diff --git a/changelog.md b/changelog.md index 5685a999..38cf804a 100644 --- a/changelog.md +++ b/changelog.md @@ -13,6 +13,7 @@ * [Changelog](#changelog) + * [Releases v1.8.1](#releases-v181) * [Releases v1.8.0](#releases-v180) * [Releases v1.7.2](#releases-v172) * [Releases v1.7.1](#releases-v171) @@ -33,6 +34,10 @@ ## Changelog +### Releases v1.8.1 + +1. Fix chipID and add getChipID(), getChipOUI() for `ESP32` and `WT32_ETH01` + ### Releases v1.8.0 1. Fix `macAddress` bug. Check [Unable so set MAC Address #2](https://github.com/khoih-prog/Ethernet_Manager/issues/2) diff --git a/keywords.txt b/keywords.txt index 008caab9..ccdd9e86 100644 --- a/keywords.txt +++ b/keywords.txt @@ -26,6 +26,14 @@ setCORSHeader KEYWORD2 getCORSHeader KEYWORD2 link_status KEYWORD2 +####################################### + +getChipID KEYWORD2 +getChipOUI KEYWORD2 + +ESP_getChipId KEYWORD2 +ESP_getChipOUI KEYWORD2 + ####################################### # Literals (LITERAL1) ####################################### diff --git a/library.json b/library.json index e1e5c9e9..f866944f 100644 --- a/library.json +++ b/library.json @@ -1,6 +1,6 @@ { "name": "Ethernet_Manager", - "version": "1.8.0", + "version": "1.8.1", "keywords": "communication, ethernet, esp8266, esp32, esp32-s2, esp32-c3, QNEthernet, rp2040, nano-rp2040-connect, W5x00, lan8720, SAM-DUE, SAMD, STM32, nRF52, Credentials, config-portal, WT32-ETH01, Double-Reset, MQTT, rpi-pico, ENC28J60, SAMD51, DynamicParameters, dynamic-params, customs-header, Manager", "description": "Simple Ethernet Manager for Teensy, SAM DUE, SAMD, nRF52, ESP32 (including ESP32-S2/C3), ESP8266, RP2040-based Nano_RP2040_Connect, RASPBERRY_PI_PICO, etc. boards. Config data saved in ESP LittleFS, SPIFFS or EEPROM, nRF52 LittleFS, EEPROM, DueFlashStorage or SAMD FlashStorage. For configuring/auto(re)connecting Ethernet W5x00, ENC28J60 and NativeEthernet/QNEthernet at runtime. Use much less memory compared to full-fledge WiFiManager. Config Portal (CP) will be auto-adjusted to match the number of dynamic custom parameters. Optional default Credentials to be autoloaded into CP to use or change instead of manually input. Credentials are saved in LittleFS, (emulated-)EEPROM, FlashStorage_SAMD or DueFlashStorage. New powerful-yet-simple-to-use feature to enable adding dynamic parameters from sketch and input using the same CP. DoubleDetectDetector as well as Virtual Switches feature permits entering CP as requested. Configurable HTML Headers, Customs Style, Head Elements, CORS Header", "authors": @@ -33,7 +33,7 @@ { "owner": "khoih-prog", "name": "ESP_DoubleResetDetector", - "version": ">=1.3.1", + "version": ">=1.3.2", "platforms": ["espressif8266", "espressif32"] }, { diff --git a/library.properties b/library.properties index e1fdb265..b61144e9 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=Ethernet_Manager -version=1.8.0 +version=1.8.1 author=Khoi Hoang license=MIT maintainer=Khoi Hoang diff --git a/platformio/platformio.ini b/platformio/platformio.ini index d185589f..5c535c0d 100644 --- a/platformio/platformio.ini +++ b/platformio/platformio.ini @@ -47,7 +47,7 @@ lib_deps = ; PlatformIO 4.x ; EthernetWebServer@>=2.2.2 ; Ethernet_Generic>=2.5.2 -; ESP_DoubleResetDetector@>=1.3.1 +; ESP_DoubleResetDetector@>=1.3.2 ; DoubleResetDetector_Generic@>=1.8.1 ; Functional-Vlpp@>=1.0.2 ; FlashStorage_SAMD@>=1.3.2 @@ -56,7 +56,7 @@ lib_deps = ; PlatformIO 5.x khoih-prog/EthernetWebServer@>=2.2.2 khoih-prog/Ethernet_Generic@~2.5.2 - khoih-prog/ESP_DoubleResetDetector@>=1.3.1 + khoih-prog/ESP_DoubleResetDetector@>=1.3.2 khoih-prog/DoubleResetDetector_Generic@>=1.8.1 khoih-prog/Functional-Vlpp@>=1.0.2 khoih-prog/FlashStorage_SAMD@>=1.3.2 diff --git a/src/Adapters/Ethernet_DUE_Manager.h b/src/Adapters/Ethernet_DUE_Manager.h index 404b9316..816270fc 100644 --- a/src/Adapters/Ethernet_DUE_Manager.h +++ b/src/Adapters/Ethernet_DUE_Manager.h @@ -9,7 +9,7 @@ Built by Khoi Hoang https://github.com/khoih-prog/Ethernet_Manager Licensed under MIT license - Version: 1.8.0 + Version: 1.8.1 Version Modified By Date Comments ------- ----------- ---------- ----------- @@ -27,6 +27,7 @@ 1.7.1 K Hoang 26/01/2022 Update to be compatible with new FlashStorage libraries. 1.7.2 K Hoang 10/04/2022 Use Ethernet_Generic library as default. Support SPI1/SPI2 for RP2040/ESP32 1.8.0 K Hoang 07/09/2022 Fix macAddress bug. Add functions relating to macAddress + 1.8.1 K Hoang 09/09/2022 Fix chipID and add getChipOUI() for ESP32 *****************************************************************************************************************************/ #pragma once diff --git a/src/Adapters/Ethernet_ESP32_Manager.h b/src/Adapters/Ethernet_ESP32_Manager.h index 2aff8a2c..0113f7ac 100644 --- a/src/Adapters/Ethernet_ESP32_Manager.h +++ b/src/Adapters/Ethernet_ESP32_Manager.h @@ -6,11 +6,10 @@ to enable easy configuration/reconfiguration of Credentials and autoconnect/autoreconnect of Ethernet. AVR Mega is not supported. - Built by Khoi Hoang https://github.com/khoih-prog/Ether -net_Manager + Built by Khoi Hoang https://github.com/khoih-prog/Ethernet_Manager Licensed under MIT license - Version: 1.8.0 + Version: 1.8.1 Version Modified By Date Comments ------- ----------- ---------- ----------- @@ -28,6 +27,7 @@ net_Manager 1.7.1 K Hoang 26/01/2022 Update to be compatible with new FlashStorage libraries. 1.7.2 K Hoang 10/04/2022 Use Ethernet_Generic library as default. Support SPI1/SPI2 for RP2040/ESP32 1.8.0 K Hoang 07/09/2022 Fix macAddress bug. Add functions relating to macAddress + 1.8.1 K Hoang 09/09/2022 Fix chipID and add getChipOUI() for ESP32 *****************************************************************************************************************************/ #pragma once @@ -135,7 +135,16 @@ DoubleResetDetector* drd; ///////// NEW for DRD ///////////// #include -#define ESP_getChipId() ((uint32_t)ESP.getEfuseMac()) + +static uint32_t getChipID(); +static uint32_t getChipOUI(); + +#if defined(ESP_getChipId) + #undef ESP_getChipId +#endif + +#define ESP_getChipId() getChipID() +#define ESP_getChipOUI() getChipOUI() //NEW @@ -224,6 +233,34 @@ const char WM_HTTP_CORS_ALLOW_ALL[] PROGMEM = "*"; ////////////////////////////////////////// +static uint32_t getChipID() +{ + uint64_t chipId64 = 0; + + for (int i = 0; i < 6; i++) + { + chipId64 |= ( ( (uint64_t) ESP.getEfuseMac() >> (40 - (i * 8)) ) & 0xff ) << (i * 8); + } + + return (uint32_t) (chipId64 & 0xFFFFFF); +} + +////////////////////////////////////////// + +static uint32_t getChipOUI() +{ + uint64_t chipId64 = 0; + + for (int i = 0; i < 6; i++) + { + chipId64 |= ( ( (uint64_t) ESP.getEfuseMac() >> (40 - (i * 8)) ) & 0xff ) << (i * 8); + } + + return (uint32_t) (chipId64 >> 24); +} + +////////////////////////////////////////// + class Ethernet_Manager { diff --git a/src/Adapters/Ethernet_ESP8266_Manager.h b/src/Adapters/Ethernet_ESP8266_Manager.h index 02ffb7ba..fc458758 100644 --- a/src/Adapters/Ethernet_ESP8266_Manager.h +++ b/src/Adapters/Ethernet_ESP8266_Manager.h @@ -9,7 +9,7 @@ Built by Khoi Hoang https://github.com/khoih-prog/Ethernet_Manager Licensed under MIT license - Version: 1.8.0 + Version: 1.8.1 Version Modified By Date Comments ------- ----------- ---------- ----------- @@ -27,6 +27,7 @@ 1.7.1 K Hoang 26/01/2022 Update to be compatible with new FlashStorage libraries. 1.7.2 K Hoang 10/04/2022 Use Ethernet_Generic library as default. Support SPI1/SPI2 for RP2040/ESP32 1.8.0 K Hoang 07/09/2022 Fix macAddress bug. Add functions relating to macAddress + 1.8.1 K Hoang 09/09/2022 Fix chipID and add getChipOUI() for ESP32 *****************************************************************************************************************************/ #pragma once diff --git a/src/Adapters/Ethernet_MBED_RP2040_Manager.h b/src/Adapters/Ethernet_MBED_RP2040_Manager.h index c858ced4..99247cee 100644 --- a/src/Adapters/Ethernet_MBED_RP2040_Manager.h +++ b/src/Adapters/Ethernet_MBED_RP2040_Manager.h @@ -9,7 +9,7 @@ Built by Khoi Hoang https://github.com/khoih-prog/Ethernet_Manager Licensed under MIT license - Version: 1.8.0 + Version: 1.8.1 Version Modified By Date Comments ------- ----------- ---------- ----------- @@ -27,6 +27,7 @@ 1.7.1 K Hoang 26/01/2022 Update to be compatible with new FlashStorage libraries. 1.7.2 K Hoang 10/04/2022 Use Ethernet_Generic library as default. Support SPI1/SPI2 for RP2040/ESP32 1.8.0 K Hoang 07/09/2022 Fix macAddress bug. Add functions relating to macAddress + 1.8.1 K Hoang 09/09/2022 Fix chipID and add getChipOUI() for ESP32 *****************************************************************************************************************************/ #pragma once diff --git a/src/Adapters/Ethernet_NRF52_Manager.h b/src/Adapters/Ethernet_NRF52_Manager.h index ba92ea76..ced4a7df 100644 --- a/src/Adapters/Ethernet_NRF52_Manager.h +++ b/src/Adapters/Ethernet_NRF52_Manager.h @@ -9,7 +9,7 @@ Built by Khoi Hoang https://github.com/khoih-prog/Ethernet_Manager Licensed under MIT license - Version: 1.8.0 + Version: 1.8.1 Version Modified By Date Comments ------- ----------- ---------- ----------- @@ -27,6 +27,7 @@ 1.7.1 K Hoang 26/01/2022 Update to be compatible with new FlashStorage libraries. 1.7.2 K Hoang 10/04/2022 Use Ethernet_Generic library as default. Support SPI1/SPI2 for RP2040/ESP32 1.8.0 K Hoang 07/09/2022 Fix macAddress bug. Add functions relating to macAddress + 1.8.1 K Hoang 09/09/2022 Fix chipID and add getChipOUI() for ESP32 *****************************************************************************************************************************/ #pragma once diff --git a/src/Adapters/Ethernet_RP2040_Manager.h b/src/Adapters/Ethernet_RP2040_Manager.h index eb340890..79ab87d9 100644 --- a/src/Adapters/Ethernet_RP2040_Manager.h +++ b/src/Adapters/Ethernet_RP2040_Manager.h @@ -9,7 +9,7 @@ Built by Khoi Hoang https://github.com/khoih-prog/Ethernet_Manager Licensed under MIT license - Version: 1.8.0 + Version: 1.8.1 Version Modified By Date Comments ------- ----------- ---------- ----------- @@ -27,6 +27,7 @@ 1.7.1 K Hoang 26/01/2022 Update to be compatible with new FlashStorage libraries. 1.7.2 K Hoang 10/04/2022 Use Ethernet_Generic library as default. Support SPI1/SPI2 for RP2040/ESP32 1.8.0 K Hoang 07/09/2022 Fix macAddress bug. Add functions relating to macAddress + 1.8.1 K Hoang 09/09/2022 Fix chipID and add getChipOUI() for ESP32 *****************************************************************************************************************************/ #pragma once diff --git a/src/Adapters/Ethernet_SAMD_Manager.h b/src/Adapters/Ethernet_SAMD_Manager.h index 8506fcca..a1204a0d 100644 --- a/src/Adapters/Ethernet_SAMD_Manager.h +++ b/src/Adapters/Ethernet_SAMD_Manager.h @@ -9,7 +9,7 @@ Built by Khoi Hoang https://github.com/khoih-prog/Ethernet_Manager Licensed under MIT license - Version: 1.8.0 + Version: 1.8.1 Version Modified By Date Comments ------- ----------- ---------- ----------- @@ -27,6 +27,7 @@ 1.7.1 K Hoang 26/01/2022 Update to be compatible with new FlashStorage libraries. 1.7.2 K Hoang 10/04/2022 Use Ethernet_Generic library as default. Support SPI1/SPI2 for RP2040/ESP32 1.8.0 K Hoang 07/09/2022 Fix macAddress bug. Add functions relating to macAddress + 1.8.1 K Hoang 09/09/2022 Fix chipID and add getChipOUI() for ESP32 *****************************************************************************************************************************/ #pragma once diff --git a/src/Adapters/Ethernet_Teensy_Manager.h b/src/Adapters/Ethernet_Teensy_Manager.h index 74c7a2b7..81f1166a 100644 --- a/src/Adapters/Ethernet_Teensy_Manager.h +++ b/src/Adapters/Ethernet_Teensy_Manager.h @@ -9,7 +9,7 @@ Built by Khoi Hoang https://github.com/khoih-prog/Ethernet_Manager Licensed under MIT license - Version: 1.8.0 + Version: 1.8.1 Version Modified By Date Comments ------- ----------- ---------- ----------- @@ -27,6 +27,7 @@ 1.7.1 K Hoang 26/01/2022 Update to be compatible with new FlashStorage libraries. 1.7.2 K Hoang 10/04/2022 Use Ethernet_Generic library as default. Support SPI1/SPI2 for RP2040/ESP32 1.8.0 K Hoang 07/09/2022 Fix macAddress bug. Add functions relating to macAddress + 1.8.1 K Hoang 09/09/2022 Fix chipID and add getChipOUI() for ESP32 *****************************************************************************************************************************/ #pragma once diff --git a/src/Adapters/Ethernet_WT32_ETH01_Manager.h b/src/Adapters/Ethernet_WT32_ETH01_Manager.h index 898770df..ca57f263 100644 --- a/src/Adapters/Ethernet_WT32_ETH01_Manager.h +++ b/src/Adapters/Ethernet_WT32_ETH01_Manager.h @@ -9,7 +9,7 @@ Built by Khoi Hoang https://github.com/khoih-prog/Ethernet_Manager Licensed under MIT license - Version: 1.8.0 + Version: 1.8.1 Version Modified By Date Comments ------- ----------- ---------- ----------- @@ -27,6 +27,7 @@ 1.7.1 K Hoang 26/01/2022 Update to be compatible with new FlashStorage libraries. 1.7.2 K Hoang 10/04/2022 Use Ethernet_Generic library as default. Support SPI1/SPI2 for RP2040/ESP32 1.8.0 K Hoang 07/09/2022 Fix macAddress bug. Add functions relating to macAddress + 1.8.1 K Hoang 09/09/2022 Fix chipID and add getChipOUI() for ESP32 *****************************************************************************************************************************/ #pragma once @@ -136,7 +137,16 @@ DoubleResetDetector* drd; ///////// NEW for DRD ///////////// #include -#define ESP_getChipId() ((uint32_t)ESP.getEfuseMac()) + +static uint32_t getChipID(); +static uint32_t getChipOUI(); + +#if defined(ESP_getChipId) + #undef ESP_getChipId +#endif + +#define ESP_getChipId() getChipID() +#define ESP_getChipOUI() getChipOUI() //NEW @@ -225,6 +235,34 @@ const char WM_HTTP_CORS_ALLOW_ALL[] PROGMEM = "*"; ////////////////////////////////////////// +static uint32_t getChipID() +{ + uint64_t chipId64 = 0; + + for (int i = 0; i < 6; i++) + { + chipId64 |= ( ( (uint64_t) ESP.getEfuseMac() >> (40 - (i * 8)) ) & 0xff ) << (i * 8); + } + + return (uint32_t) (chipId64 & 0xFFFFFF); +} + +////////////////////////////////////////// + +static uint32_t getChipOUI() +{ + uint64_t chipId64 = 0; + + for (int i = 0; i < 6; i++) + { + chipId64 |= ( ( (uint64_t) ESP.getEfuseMac() >> (40 - (i * 8)) ) & 0xff ) << (i * 8); + } + + return (uint32_t) (chipId64 >> 24); +} + +////////////////////////////////////////// + class Ethernet_Manager { diff --git a/src/Adapters/QNEthernet_Teensy_Manager.h b/src/Adapters/QNEthernet_Teensy_Manager.h index b9288abc..4d7021c5 100644 --- a/src/Adapters/QNEthernet_Teensy_Manager.h +++ b/src/Adapters/QNEthernet_Teensy_Manager.h @@ -9,7 +9,7 @@ Built by Khoi Hoang https://github.com/khoih-prog/Ethernet_Manager Licensed under MIT license - Version: 1.8.0 + Version: 1.8.1 Version Modified By Date Comments ------- ----------- ---------- ----------- @@ -27,6 +27,7 @@ 1.7.1 K Hoang 26/01/2022 Update to be compatible with new FlashStorage libraries. 1.7.2 K Hoang 10/04/2022 Use Ethernet_Generic library as default. Support SPI1/SPI2 for RP2040/ESP32 1.8.0 K Hoang 07/09/2022 Fix macAddress bug. Add functions relating to macAddress + 1.8.1 K Hoang 09/09/2022 Fix chipID and add getChipOUI() for ESP32 *****************************************************************************************************************************/ #pragma once diff --git a/src/Ethernet_Manager.h b/src/Ethernet_Manager.h index a28323ef..6c559f4a 100644 --- a/src/Ethernet_Manager.h +++ b/src/Ethernet_Manager.h @@ -9,7 +9,7 @@ Built by Khoi Hoang https://github.com/khoih-prog/Ethernet_Manager Licensed under MIT license - Version: 1.8.0 + Version: 1.8.1 Version Modified By Date Comments ------- ----------- ---------- ----------- @@ -27,6 +27,7 @@ 1.7.1 K Hoang 26/01/2022 Update to be compatible with new FlashStorage libraries. 1.7.2 K Hoang 10/04/2022 Use Ethernet_Generic library as default. Support SPI1/SPI2 for RP2040/ESP32 1.8.0 K Hoang 07/09/2022 Fix macAddress bug. Add functions relating to macAddress + 1.8.1 K Hoang 09/09/2022 Fix chipID and add getChipOUI() for ESP32 *****************************************************************************************************************************/ #pragma once @@ -37,13 +38,13 @@ /////////////////////////////////////////////////////////////// #ifndef ETHERNET_MANAGER_VERSION - #define ETHERNET_MANAGER_VERSION "Ethernet_Manager v1.8.0" + #define ETHERNET_MANAGER_VERSION "Ethernet_Manager v1.8.1" #define ETHERNET_MANAGER_VERSION_MAJOR 1 #define ETHERNET_MANAGER_VERSION_MINOR 8 - #define ETHERNET_MANAGER_VERSION_PATCH 0 + #define ETHERNET_MANAGER_VERSION_PATCH 1 - #define ETHERNET_MANAGER_VERSION_INT 1008000 + #define ETHERNET_MANAGER_VERSION_INT 1008001 #endif diff --git a/src/Ethernet_Manager_Debug.h b/src/Ethernet_Manager_Debug.h index 2a4224fe..a7e801e8 100644 --- a/src/Ethernet_Manager_Debug.h +++ b/src/Ethernet_Manager_Debug.h @@ -9,7 +9,7 @@ Built by Khoi Hoang https://github.com/khoih-prog/Ethernet_Manager Licensed under MIT license - Version: 1.8.0 + Version: 1.8.1 Version Modified By Date Comments ------- ----------- ---------- ----------- @@ -27,6 +27,7 @@ 1.7.1 K Hoang 26/01/2022 Update to be compatible with new FlashStorage libraries. 1.7.2 K Hoang 10/04/2022 Use Ethernet_Generic library as default. Support SPI1/SPI2 for RP2040/ESP32 1.8.0 K Hoang 07/09/2022 Fix macAddress bug. Add functions relating to macAddress + 1.8.1 K Hoang 09/09/2022 Fix chipID and add getChipOUI() for ESP32 *****************************************************************************************************************************/ #pragma once