33#include " const.h"
44#ifdef ESP8266
55#include " user_interface.h" // for bootloop detection
6- #elif ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 4, 0)
7- #include " esp32/rtc.h" // for bootloop detection
6+ #else
87#include < Update.h>
8+ #if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 4, 0)
9+ #include " esp32/rtc.h" // for bootloop detection
10+ #elif ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(3, 3, 0)
11+ #include " soc/rtc.h"
12+ #endif
913#endif
1014
1115
@@ -739,7 +743,12 @@ void bootloopCheckOTA() { bl_actiontracker = BOOTLOOP_ACTION_OTA; } // swap boot
739743static bool detectBootLoop () {
740744#if !defined(ESP8266)
741745 #if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 4, 0)
742- uint32_t rtctime = esp_rtc_get_time_us () / 1000 ; // convert to milliseconds
746+ uint32_t rtctime = esp_rtc_get_time_us () / 1000 ; // convert to milliseconds
747+ #elif ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(3, 3, 0)
748+ uint64_t rtc_ticks = rtc_time_get ();
749+ uint32_t rtctime = rtc_time_slowclk_to_us (rtc_ticks, rtc_clk_slow_freq_get_hz ()) / 1000 ; // convert to milliseconds
750+ #endif
751+
743752 esp_reset_reason_t reason = esp_reset_reason ();
744753
745754 if (!(reason == ESP_RST_PANIC || reason == ESP_RST_WDT || reason == ESP_RST_INT_WDT || reason == ESP_RST_TASK_WDT)) {
@@ -765,7 +774,6 @@ static bool detectBootLoop() {
765774 }
766775 }
767776 }
768- #endif
769777#else // ESP8266
770778 rst_info* resetreason = system_get_rst_info ();
771779 uint32_t bl_last_boottime;
0 commit comments