1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-23 08:15:30 +03:00

Allow serial port to share all MSP functions at once (#11950)

Fixes: https://github.com/betaflight/betaflight/issues/11948

Previously the MSP functionality could only be shared with one of the
functions defined in `ALL_FUNCTIONS_SHARABLE_WITH_MSP`. This PR allows
it to be shared with all of them.
This commit is contained in:
J Blackman 2022-11-04 17:05:40 +11:00 committed by GitHub
commit e664577849
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 5 deletions

View file

@ -586,7 +586,7 @@ static void validateAndFixConfig(void)
if (portConfig &&
(portConfig->identifier != SERIAL_PORT_USB_VCP) &&
((portConfig->functionMask & FUNCTION_MSP_DISPLAYPORT) == FUNCTION_MSP_DISPLAYPORT)) {
((portConfig->functionMask & (FUNCTION_VTX_MSP | FUNCTION_MSP)) == (FUNCTION_VTX_MSP | FUNCTION_MSP))) {
displayPortMspSetSerial(portConfig->identifier);
break;
}

View file

@ -272,9 +272,9 @@ serialPort_t *findSharedSerialPort(uint16_t functionMask, serialPortFunction_e s
}
#ifdef USE_TELEMETRY
#define ALL_FUNCTIONS_SHARABLE_WITH_MSP (FUNCTION_BLACKBOX | TELEMETRY_PORT_FUNCTIONS_MASK | FUNCTION_VTX_MSP | FUNCTION_MSP_DISPLAYPORT)
#define ALL_FUNCTIONS_SHARABLE_WITH_MSP (FUNCTION_BLACKBOX | TELEMETRY_PORT_FUNCTIONS_MASK | FUNCTION_VTX_MSP)
#else
#define ALL_FUNCTIONS_SHARABLE_WITH_MSP (FUNCTION_BLACKBOX | FUNCTION_VTX_MSP | FUNCTION_MSP_DISPLAYPORT)
#define ALL_FUNCTIONS_SHARABLE_WITH_MSP (FUNCTION_BLACKBOX | FUNCTION_VTX_MSP)
#endif
bool isSerialConfigValid(const serialConfig_t *serialConfigToCheck)
@ -311,7 +311,7 @@ bool isSerialConfigValid(const serialConfig_t *serialConfigToCheck)
if (bitCount > 1) {
// shared
if (bitCount > 2) {
if (bitCount > (BITCOUNT(FUNCTION_MSP | ALL_FUNCTIONS_SHARABLE_WITH_MSP))) {
return false;
}

View file

@ -51,7 +51,6 @@ typedef enum {
FUNCTION_LIDAR_TF = (1 << 15), // 32768
FUNCTION_FRSKY_OSD = (1 << 16), // 65536
FUNCTION_VTX_MSP = (1 << 17), // 131072
FUNCTION_MSP_DISPLAYPORT = (1 << 18) | FUNCTION_MSP, // 262145
} serialPortFunction_e;
#define TELEMETRY_SHAREABLE_PORT_FUNCTIONS_MASK (FUNCTION_TELEMETRY_FRSKY_HUB | FUNCTION_TELEMETRY_LTM | FUNCTION_TELEMETRY_MAVLINK)