Compile error: 'ESP_RST_REASON_SW_CPU_RESET' was not declared in this scope
Posted: Sun Nov 24, 2024 5:22 am
Attempting to retreive restart reason on ESP32 WROOM after a software restart command. Arduino IDE 2. platform
Code: Select all
#include <esp_system.h>
#include <esp_idf_version.h>
void checkForRestart() {
esp_reset_reason_t resetReason = esp_reset_reason();
if (resetReason == ESP_RST_REASON_SW_CPU_RESET) { // ESP_RST_REASON_SW_CPU_RESET
Serial.println("Software reset detected!");
strcpy(restartFlag,"Yes");
} else {
Serial.printf("Reset reason: %d\n", resetReason);
strcpy(restartFlag,"???");
}
}
Compiler error messaging:
C:\Users\Ed\IDE 2.0 Sketches-Libraries\Energy Monitor\Energy_Monitor_2M\Energy_Monitor_2M.ino: In function 'void checkForRestart()':
C:\Users\Ed\IDE 2.0 Sketches-Libraries\Energy Monitor\Energy_Monitor_2M\Energy_Monitor_2M.ino:869:22: error: 'ESP_RST_REASON_SW_CPU_RESET' was not declared in this scope
exit status 1
Compilation error: 'ESP_RST_REASON_SW_CPU_RESET' was not declared in this scope