1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-23 16:25:31 +03:00

Merge pull request #10490 from etracer65/msp_serial_push_fix

Fix mspSerialPush() selected serial port logic
This commit is contained in:
Michael Keller 2021-02-14 15:31:31 +13:00
parent 889fcb5d77
commit 54a1104e6e
3 changed files with 5 additions and 3 deletions

View file

@ -91,7 +91,8 @@ typedef enum {
SERIAL_PORT_USB_VCP = 20,
SERIAL_PORT_SOFTSERIAL1 = 30,
SERIAL_PORT_SOFTSERIAL2,
SERIAL_PORT_IDENTIFIER_MAX = SERIAL_PORT_SOFTSERIAL2
SERIAL_PORT_IDENTIFIER_MAX = SERIAL_PORT_SOFTSERIAL2,
SERIAL_PORT_ALL = 255,
} serialPortIdentifier_e;
extern const serialPortIdentifier_e serialPortIdentifiers[SERIAL_PORT_COUNT];

View file

@ -562,7 +562,8 @@ int mspSerialPush(serialPortIdentifier_e port, uint8_t cmd, uint8_t *data, int d
mspPort_t * const mspPort = &mspPorts[portIndex];
// XXX Kludge!!! Avoid zombie VCP port (avoid VCP entirely for now)
if (!mspPort->port || mspPort->port->identifier == SERIAL_PORT_USB_VCP || (port != SERIAL_PORT_NONE && mspPort->port->identifier != port)) {
if (!mspPort->port || mspPort->port->identifier == SERIAL_PORT_USB_VCP
|| (port != SERIAL_PORT_ALL && mspPort->port->identifier != port)) {
continue;
}

View file

@ -279,7 +279,7 @@ void currentMeterMSPRefresh(timeUs_t currentTimeUs)
if (cmp32(currentTimeUs, streamRequestAt) > 0) {
streamRequestAt = currentTimeUs + ((1000 * 1000) / 10); // 10hz
mspSerialPush(SERIAL_PORT_NONE, MSP_ANALOG, NULL, 0, MSP_DIRECTION_REQUEST);
mspSerialPush(SERIAL_PORT_ALL, MSP_ANALOG, NULL, 0, MSP_DIRECTION_REQUEST);
}
}