@@ -2644,9 +2644,34 @@ void Wippersnapper::publish(const char *topic, uint8_t *payload, uint16_t bLen,
2644
2644
}
2645
2645
}
2646
2646
2647
+ #ifdef ARDUINO_ARCH_ESP32
2648
+
2649
+ #if CONFIG_IDF_TARGET_ESP32 // ESP32/PICO-D4
2650
+ #include " esp32/rom/rtc.h"
2651
+ #elif CONFIG_IDF_TARGET_ESP32S2
2652
+ #include " esp32s2/rom/rtc.h"
2653
+ #elif CONFIG_IDF_TARGET_ESP32C2
2654
+ #include " esp32c2/rom/rtc.h"
2655
+ #elif CONFIG_IDF_TARGET_ESP32C3
2656
+ #include " esp32c3/rom/rtc.h"
2657
+ #elif CONFIG_IDF_TARGET_ESP32S3
2658
+ #include " esp32s3/rom/rtc.h"
2659
+ #elif CONFIG_IDF_TARGET_ESP32C6
2660
+ #include " esp32c6/rom/rtc.h"
2661
+ #elif CONFIG_IDF_TARGET_ESP32H2
2662
+ #include " esp32h2/rom/rtc.h"
2663
+ #else
2664
+ #error Target CONFIG_IDF_TARGET is not supported
2665
+ #endif
2666
+
2667
+ void get_and_print_reset_reason_for_cpu (int cpuCore) {
2668
+ print_reset_reason (rtc_get_reset_reason (cpuCore));
2669
+ }
2670
+
2671
+
2647
2672
/* *************************************************************/
2648
2673
/* !
2649
- @brief Prints last reset reason of ESP32
2674
+ @brief Prints string reset reason of ESP32
2650
2675
@param reason
2651
2676
The return code of rtc_get_reset_reason(coreNum)
2652
2677
*/
@@ -2704,6 +2729,7 @@ void print_reset_reason(int reason) {
2704
2729
WS_DEBUG_PRINTLN (" NO_MEAN" );
2705
2730
}
2706
2731
}
2732
+ #endif
2707
2733
2708
2734
/* *************************************************************************/
2709
2735
/* !
@@ -2731,9 +2757,9 @@ void printDeviceInfo() {
2731
2757
// (ESP32-Only) Print reason why device was reset
2732
2758
#ifdef ARDUINO_ARCH_ESP32
2733
2759
WS_DEBUG_PRINT (" ESP32 CPU0 RESET REASON: " );
2734
- print_reset_reason (0 );
2760
+ get_and_print_reset_reason_for_cpu (0 );
2735
2761
WS_DEBUG_PRINT (" ESP32 CPU1 RESET REASON: " );
2736
- print_reset_reason (1 );
2762
+ get_and_print_reset_reason_for_cpu (1 );
2737
2763
#endif
2738
2764
}
2739
2765
0 commit comments