32ESPecial Version 1.00 #9
1 changed files with 14 additions and 3 deletions
|
|
@ -55,6 +55,8 @@ static const char *TAG = "USB";
|
||||||
static const char *OTA_FILE = "/usb/esp/OTA_URL.txt";
|
static const char *OTA_FILE = "/usb/esp/OTA_URL.txt";
|
||||||
const char *CONFIG_FILE = "/usb/esp/config.txt";
|
const char *CONFIG_FILE = "/usb/esp/config.txt";
|
||||||
|
|
||||||
|
__NOINIT_ATTR uint_fast8_t Restarts;
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
USB_STATE_UNINITIALIZED,
|
USB_STATE_UNINITIALIZED,
|
||||||
|
|
@ -281,6 +283,8 @@ static void app_usb_task(void *args)
|
||||||
static uint8_t device_address = 1;
|
static uint8_t device_address = 1;
|
||||||
usb_message_t msg;
|
usb_message_t msg;
|
||||||
|
|
||||||
|
esp_reset_reason() == ESP_RST_POWERON ? Restarts = 0 : Restarts++;
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
switch (Current_State)
|
switch (Current_State)
|
||||||
|
|
@ -313,9 +317,16 @@ static void app_usb_task(void *args)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
KLOG_ERROR(TAG, "No flash drive detected--rebooting.");
|
if (Restarts <= 3)
|
||||||
vTaskDelay(pdMS_TO_TICKS(100));
|
{
|
||||||
esp_restart();
|
KLOG_ERROR(TAG, "No flash drive detected--rebooting.");
|
||||||
|
|
|||||||
|
vTaskDelay(pdMS_TO_TICKS(100));
|
||||||
|
esp_restart();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
KLOG_WARN(TAG, "No flash drive detected after multiple attempts.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue
Three might be too many. Just sayin'.