1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-24 16:55:36 +03:00

Limit MSP ports to 2 for normal usage scenarios.

This commit is contained in:
Dominic Clifton 2014-08-14 00:50:17 +01:00
parent 7453e98b3b
commit 0b353341f8
3 changed files with 13 additions and 4 deletions

View file

@ -449,12 +449,18 @@ bool isSerialConfigValid(serialConfig_t *serialConfigToCheck)
uint8_t functionIndex;
uint8_t cliPortCount = 0;
uint8_t mspPortCount = 0;
for (functionIndex = 0; functionIndex < SERIAL_PORT_COUNT; functionIndex++) {
if (serialPortFunctions[functionIndex].scenario & FUNCTION_CLI) {
if (++cliPortCount > 1) {
return false;
}
}
if (serialPortFunctions[functionIndex].scenario & FUNCTION_MSP) {
if (++mspPortCount > MAX_MSP_PORT_COUNT) {
return false;
}
}
}
return true;
}