From 99df8edc2dee3b311c5744852d3f9c5b725b4f04 Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Wed, 4 Oct 2023 12:47:58 +0200 Subject: [PATCH] Fix ESP32 chip version number --- tasmota/tasmota.ino | 2 +- tasmota/tasmota_support/support_esp.ino | 19 +++++++++---------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/tasmota/tasmota.ino b/tasmota/tasmota.ino index fe07ff400774..f648bda3bf08 100644 --- a/tasmota/tasmota.ino +++ b/tasmota/tasmota.ino @@ -507,7 +507,7 @@ void setup(void) { // AddLog(LOG_LEVEL_INFO, PSTR("ADR: Settings %p, Log %p"), Settings, TasmotaGlobal.log_buffer); #ifdef ESP32 - AddLog(LOG_LEVEL_INFO, PSTR("HDW: %s %s"), GetDeviceHardware().c_str(), + AddLog(LOG_LEVEL_INFO, PSTR("HDW: %s %s"), GetDeviceHardwareRevision().c_str(), FoundPSRAM() ? (CanUsePSRAM() ? "(PSRAM)" : "(PSRAM disabled)") : "" ); // AddLog(LOG_LEVEL_DEBUG, PSTR("HDW: FoundPSRAM=%i CanUsePSRAM=%i"), FoundPSRAM(), CanUsePSRAM()); #if !defined(HAS_PSRAM_FIX) diff --git a/tasmota/tasmota_support/support_esp.ino b/tasmota/tasmota_support/support_esp.ino index 6f3a8415dbdb..92346ab32e2a 100644 --- a/tasmota/tasmota_support/support_esp.ino +++ b/tasmota/tasmota_support/support_esp.ino @@ -1083,21 +1083,20 @@ typedef struct { String GetDeviceHardwareRevision(void) { // ESP32-S2 // ESP32-D0WDQ6 v1.0 - // ESP32-C3 v2.0 - // ESP32-C3 v3.0 + // ESP32-C3 v0.3 // ESP32-C6FH4 v0.0 String result = GetDeviceHardware(); // ESP32-C3 esp_chip_info_t chip_info; esp_chip_info(&chip_info); -// if (chip_info.revision) { // Only show >rev 0.0 - // idf5 efuse_hal_chip_revision(void) - uint32_t chip_revision = chip_info.revision; - if (chip_revision < 100) { chip_revision *= 100; } // Make = 5 + uint32_t chip_revision = chip_info.revision; // 16-bit chip revision number (in format MXX; where M - wafer major version, XX - wafer minor version) +#else + uint32_t chip_revision = chip_info.full_revision; // 16-bit chip revision number (in format MXX; where M - wafer major version, XX - wafer minor version) +#endif + char revision[16]; + snprintf_P(revision, sizeof(revision), PSTR(" v%d.%d"), chip_revision / 100, chip_revision % 100); + result += revision; // ESP32-C3 v0.3 return result; }