Skip to content

Commit 01ed893

Browse files
committed
Inline USB start/stop callback tasks
1 parent d860377 commit 01ed893

File tree

1 file changed

+4
-15
lines changed

1 file changed

+4
-15
lines changed

lib/storage/storage.cpp

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -99,19 +99,6 @@ static void switchToUSBMode()
9999
MSC.mediaPresent(true);
100100
}
101101

102-
static void usb_stopped_cb(void *const pvParameters)
103-
{
104-
switchToApplicationMode();
105-
listFiles("/");
106-
vTaskDelete(nullptr);
107-
}
108-
109-
static void usb_started_cb(void *const pvParameters)
110-
{
111-
switchToUSBMode();
112-
vTaskDelete(nullptr);
113-
}
114-
115102
static bool usbIsRunning = false;
116103
static void usbStoppedCallback(void *, esp_event_base_t, int32_t, void *)
117104
{
@@ -120,12 +107,14 @@ static void usbStoppedCallback(void *, esp_event_base_t, int32_t, void *)
120107
return;
121108
}
122109
usbIsRunning = false;
123-
xTaskCreate(usb_stopped_cb, "USB_Stopped_CB", 4096, nullptr, 5, nullptr);
110+
switchToApplicationMode();
111+
listFiles("/");
124112
}
113+
125114
static void usbStartedCallback(void *, esp_event_base_t, int32_t, void *)
126115
{
127116
usbIsRunning = true;
128-
xTaskCreate(usb_started_cb, "USB_Started_CB", 4096, nullptr, 5, nullptr);
117+
switchToUSBMode();
129118
}
130119

131120
const esp_partition_t *check_ffat_partition(const char *label); // defined in FFat.cpp

0 commit comments

Comments
 (0)