Skip to content

Commit

Permalink
rr compatiblity
Browse files Browse the repository at this point in the history
  • Loading branch information
markirb committed Jan 7, 2025
1 parent 733a97d commit 564f5b5
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions libreset/src/shelly_reset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@ extern "C" uint32_t rtc_get_reset_reason(void);
// so we can repurpose this location for failsafe flag.
#define RTC_SCRATCH_ADDR 0x600011fc
#elif CS_PLATFORM == CS_P_ESP32
#include "esp32/rom/rtc.h"

#define RTC_SCRATCH_ADDR 0x50001ffc
#include "esp_rom_sys.h"

#endif

#define FF_MODE_MAGIC 0x18365472
Expand Down Expand Up @@ -167,8 +169,8 @@ bool IsSoftReboot() {
const struct rst_info *ri = system_get_rst_info();
return (ri->reason == REASON_SOFT_RESTART);
#elif CS_PLATFORM == CS_P_ESP32
RESET_REASON rr = rtc_get_reset_reason(0 /* core */);
return (rr == SW_RESET || rr == SW_CPU_RESET);
esp_reset_reason_t rr = esp_rom_get_reset_reason(0 /* core */);
return (rr == RESET_REASON_CORE_SW || rr == RESET_REASON_CPU0_SW);
#else
return false;
#endif
Expand Down

0 comments on commit 564f5b5

Please sign in to comment.