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

EdtheWino
Posts: 15
Joined: Sun Jan 09, 2022 7:03 pm

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

Postby EdtheWino » 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


EdtheWino
Posts: 15
Joined: Sun Jan 09, 2022 7:03 pm

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

Postby EdtheWino » Sun Nov 24, 2024 6:28 pm

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"

```

Who is online

Users browsing this forum: No registered users and 38 guests