Page 1 of 1

Compile error: 'ESP_RST_REASON_SW_CPU_RESET' was not declared in this scope

Posted: Sun Nov 24, 2024 5:22 am
by EdtheWino
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

Re: Compile error: 'ESP_RST_REASON_SW_CPU_RESET' was not declared in this scope

Posted: Sun Nov 24, 2024 4:59 pm
by lbernstone

Re: Compile error: 'ESP_RST_REASON_SW_CPU_RESET' was not declared in this scope

Posted: Sun Nov 24, 2024 6:28 pm
by EdtheWino
Is there anything else I need to address beyond adding the additional library calls? Or is some sort of update to my existing ESP library in the Arduino 2. IDE needed?
I added the additional #includes but the same compiler message persists.

thanks...

Code: Select all

 
```cpp
#include <esp_system.h>
#include <esp_idf_version.h>
#include <esp_task_wdt.h>

#include "esp_err.h"
#include "esp_attr.h"
#include "esp_bit_defs.h"

```