mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-06-05 15:30:08 +08:00
[usb] prevent start of log when usb storage is running
This commit is contained in:
@@ -92,7 +92,10 @@ static __attribute__((noreturn)) msg_t thd_heartbeat(void *arg)
|
||||
chRegSetThreadName("pprz heartbeat");
|
||||
|
||||
chThdSleepSeconds (SDLOG_START_DELAY);
|
||||
sdOk = chibios_logInit(true);
|
||||
if (usbStorageIsItRunning ())
|
||||
chThdSleepSeconds (20000); // stuck here for hours
|
||||
else
|
||||
sdOk = chibios_logInit(true);
|
||||
|
||||
while (TRUE) {
|
||||
palTogglePad (GPIOC, GPIOC_LED3);
|
||||
|
||||
@@ -37,6 +37,7 @@ static msg_t thdUsbStorage(void *arg);
|
||||
static Thread* usbStorageThreadPtr=NULL;
|
||||
/* USB mass storage driver */
|
||||
static USBMassStorageDriver UMSD1;
|
||||
static bool_t isRunning = false;
|
||||
|
||||
/* endpoint index */
|
||||
#define USB_MS_DATA_EP 1
|
||||
@@ -297,7 +298,7 @@ static msg_t thdUsbStorage(void *arg)
|
||||
|
||||
chThdSleepMilliseconds(20);
|
||||
}
|
||||
|
||||
isRunning = true;
|
||||
chRegSetThreadName("UsbStorage:connected");
|
||||
|
||||
chibios_logFinish ();
|
||||
@@ -331,3 +332,8 @@ static msg_t thdUsbStorage(void *arg)
|
||||
MCU_RESTART();
|
||||
return RDY_OK;
|
||||
}
|
||||
|
||||
bool_t usbStorageIsItRunning (void)
|
||||
{
|
||||
return isRunning;
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
void usbStorageStartPolling (void);
|
||||
void usbStorageStop (void);
|
||||
void usbStorageWaitForDeconnexion (void);
|
||||
void usbStorageStartPolling (void);
|
||||
void usbStorageStop (void);
|
||||
void usbStorageWaitForDeconnexion (void);
|
||||
bool_t usbStorageIsItRunning (void);
|
||||
|
||||
Reference in New Issue
Block a user