32ESPecial Version 1.00 #9

Merged
Joe merged 8 commits from Cleanup_Nov_2025 into main 2025-11-30 21:46:46 +00:00
Showing only changes of commit 1c2f281579 - Show all commits

View file

@ -55,6 +55,8 @@ static const char *TAG = "USB";
static const char *OTA_FILE = "/usb/esp/OTA_URL.txt";
const char *CONFIG_FILE = "/usb/esp/config.txt";
__NOINIT_ATTR uint_fast8_t Restarts;
typedef enum
{
USB_STATE_UNINITIALIZED,
@ -281,6 +283,8 @@ static void app_usb_task(void *args)
static uint8_t device_address = 1;
usb_message_t msg;
esp_reset_reason() == ESP_RST_POWERON ? Restarts = 0 : Restarts++;
while (true)
{
switch (Current_State)
@ -313,9 +317,16 @@ static void app_usb_task(void *args)
}
else
{
KLOG_ERROR(TAG, "No flash drive detected--rebooting.");
vTaskDelay(pdMS_TO_TICKS(100));
esp_restart();
if (Restarts <= 3)
{
KLOG_ERROR(TAG, "No flash drive detected--rebooting.");

Three might be too many. Just sayin'.

Three might be too many. Just sayin'.
vTaskDelay(pdMS_TO_TICKS(100));
esp_restart();
}
else
{
KLOG_WARN(TAG, "No flash drive detected after multiple attempts.");
}
}
}
break;