Refactor ESP32 revision

This commit is contained in:
Theo Arends 2022-04-24 11:24:01 +02:00
parent 0d2b603bc4
commit ffaa9efbde
3 changed files with 14 additions and 6 deletions

View File

@ -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);
}

View File

@ -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;
}
/*

View File

@ -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