Added USB VCP detect and debugging. (#5689)
This commit is contained in:
parent
49139f2d6d
commit
b2c247d34a
|
@ -63,4 +63,5 @@ const char * const debugModeNames[DEBUG_COUNT] = {
|
|||
"RUNAWAY_TAKEOFF",
|
||||
"SDIO",
|
||||
"CURRENT_SENSOR",
|
||||
"USB",
|
||||
};
|
||||
|
|
|
@ -81,6 +81,7 @@ typedef enum {
|
|||
DEBUG_RUNAWAY_TAKEOFF,
|
||||
DEBUG_SDIO,
|
||||
DEBUG_CURRENT,
|
||||
DEBUG_USB,
|
||||
DEBUG_COUNT
|
||||
} debugType_e;
|
||||
|
||||
|
|
|
@ -273,4 +273,9 @@ uint32_t usbVcpGetBaudRate(serialPort_t *instance)
|
|||
|
||||
return CDC_BaudRate();
|
||||
}
|
||||
|
||||
uint8_t usbVcpIsConnected(void)
|
||||
{
|
||||
return usbIsConnected();
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "drivers/serial.h"
|
||||
|
||||
typedef struct {
|
||||
serialPort_t port;
|
||||
|
||||
|
@ -30,3 +32,4 @@ typedef struct {
|
|||
serialPort_t *usbVcpOpen(void);
|
||||
struct serialPort_s;
|
||||
uint32_t usbVcpGetBaudRate(struct serialPort_s *instance);
|
||||
uint8_t usbVcpIsConnected(void);
|
||||
|
|
|
@ -36,10 +36,12 @@
|
|||
#include "pg/pg_ids.h"
|
||||
|
||||
#include "drivers/light_led.h"
|
||||
#include "drivers/serial_usb_vcp.h"
|
||||
#include "drivers/sound_beeper.h"
|
||||
#include "drivers/system.h"
|
||||
#include "drivers/time.h"
|
||||
#include "drivers/transponder_ir.h"
|
||||
#include "drivers/usb_io.h"
|
||||
|
||||
#include "sensors/acceleration.h"
|
||||
#include "sensors/barometer.h"
|
||||
|
@ -847,7 +849,9 @@ static void subTaskPidController(timeUs_t currentTimeUs)
|
|||
static void subTaskMainSubprocesses(timeUs_t currentTimeUs)
|
||||
{
|
||||
uint32_t startTime = 0;
|
||||
if (debugMode == DEBUG_PIDLOOP) {startTime = micros();}
|
||||
if (debugMode == DEBUG_PIDLOOP) {
|
||||
startTime = micros();
|
||||
}
|
||||
|
||||
// Read out gyro temperature if used for telemmetry
|
||||
if (feature(FEATURE_TELEMETRY)) {
|
||||
|
@ -904,6 +908,11 @@ static void subTaskMainSubprocesses(timeUs_t currentTimeUs)
|
|||
afatfs_poll();
|
||||
#endif
|
||||
|
||||
#if defined(USE_VCP)
|
||||
DEBUG_SET(DEBUG_USB, 0, usbCableIsInserted());
|
||||
DEBUG_SET(DEBUG_USB, 1, usbVcpIsConnected());
|
||||
#endif
|
||||
|
||||
#ifdef USE_BLACKBOX
|
||||
if (!cliMode && blackboxConfig()->device) {
|
||||
blackboxUpdate(currentTimeUs);
|
||||
|
|
|
@ -670,4 +670,6 @@ extern "C" {
|
|||
void dashboardDisablePageCycling(void) {}
|
||||
bool imuQuaternionHeadfreeOffsetSet(void) { return true; }
|
||||
void rescheduleTask(cfTaskId_e, uint32_t) {}
|
||||
bool usbCableIsInserted(void) { return false; }
|
||||
bool usbVcpIsConnected(void) { return false; }
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue