From ffaa9efbde9f62763edd537b373394fdfd128b0f Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Sun, 24 Apr 2022 11:24:01 +0200 Subject: [PATCH] Refactor ESP32 revision --- tasmota/support_command.ino | 4 ++-- tasmota/support_esp.ino | 14 +++++++++++--- tasmota/xdrv_01_webserver.ino | 2 +- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/tasmota/support_command.ino b/tasmota/support_command.ino index 52e4f58da..7a568e4a2 100644 --- a/tasmota/support_command.ino +++ b/tasmota/support_command.ino @@ -590,14 +590,14 @@ void CmndStatus(void) ",\"" D_JSON_BOOTVERSION "\":%d" #endif ",\"" D_JSON_COREVERSION "\":\"" ARDUINO_CORE_RELEASE "\",\"" D_JSON_SDKVERSION "\":\"%s\"," - "\"CpuFrequency\":%d,\"Hardware\":\"%s%s\"" + "\"CpuFrequency\":%d,\"Hardware\":\"%s\"" "%s}}"), TasmotaGlobal.version, TasmotaGlobal.image_name, GetBuildDateAndTime().c_str() #ifdef ESP8266 , ESP.getBootVersion() #endif , ESP.getSdkVersion(), - ESP.getCpuFreqMHz(), GetDeviceHardware().c_str(), GetDeviceHardwareRevision().c_str(), + ESP.getCpuFreqMHz(), GetDeviceHardwareRevision().c_str(), GetStatistics().c_str()); CmndStatusResponse(2); } diff --git a/tasmota/support_esp.ino b/tasmota/support_esp.ino index 8c347b56f..b671be30e 100644 --- a/tasmota/support_esp.ino +++ b/tasmota/support_esp.ino @@ -96,7 +96,8 @@ String GetDeviceHardware(void) { } String GetDeviceHardwareRevision(void) { - return ""; + // No known revisions for ESP8266/85 + return GetDeviceHardware(); } #endif @@ -773,14 +774,21 @@ typedef struct { } String GetDeviceHardwareRevision(void) { + // ESP32-S2 + // ESP32-D0WDQ6 rev.1 + // ESP32-C3 rev.2 + // ESP32-C3 rev.3 + String result = GetDeviceHardware(); // ESP32-C3 + esp_chip_info_t chip_info; esp_chip_info(&chip_info); - char revision[10] = { 0 }; if (chip_info.revision) { snprintf_P(revision, sizeof(revision), PSTR(" rev.%d"), chip_info.revision); } - return revision; + result += revision; // ESP32-C3 rev.3 + + return result; } /* diff --git a/tasmota/xdrv_01_webserver.ino b/tasmota/xdrv_01_webserver.ino index ae049761a..a977b5479 100644 --- a/tasmota/xdrv_01_webserver.ino +++ b/tasmota/xdrv_01_webserver.ino @@ -2420,7 +2420,7 @@ void HandleInformation(void) #endif // USE_DISCOVERY WSContentSend_P(PSTR("}1}2 ")); // Empty line - WSContentSend_P(PSTR("}1" D_ESP_CHIP_ID "}2%d (%s%s)"), ESP_getChipId(), GetDeviceHardware().c_str(), GetDeviceHardwareRevision().c_str()); + WSContentSend_P(PSTR("}1" D_ESP_CHIP_ID "}2%d (%s)"), ESP_getChipId(), GetDeviceHardwareRevision().c_str()); #ifdef ESP8266 WSContentSend_P(PSTR("}1" D_FLASH_CHIP_ID "}20x%06X"), ESP.getFlashChipId()); #endif