Skip to content

Commit

Permalink
Fix ESP32 chip version number
Browse files Browse the repository at this point in the history
  • Loading branch information
arendst committed Oct 4, 2023
1 parent 473a8ee commit 99df8ed
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion tasmota/tasmota.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
19 changes: 9 additions & 10 deletions tasmota/tasmota_support/support_esp.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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 <idf5 idf5
char revision[16];
snprintf_P(revision, sizeof(revision), PSTR(" v%d.%d"), chip_revision / 100, chip_revision % 100);
result += revision; // ESP32-C3 v3.0
// }
#if ESP_IDF_VERSION_MAJOR >= 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;
}
Expand Down

0 comments on commit 99df8ed

Please sign in to comment.