Bump MSP api version. Ensure the the number of LEDs in the

MSP_SET_LED_STRIP_CONFIG packet is validated.
This commit is contained in:
Dominic Clifton 2015-01-08 23:19:57 +00:00
parent 9729c59cb0
commit ce49dcee31
1 changed files with 21 additions and 14 deletions

View File

@ -121,7 +121,7 @@ void useRcControlsConfig(modeActivationCondition_t *modeActivationConditions, es
#define MSP_PROTOCOL_VERSION 0
#define API_VERSION_MAJOR 1 // increment when major changes are made
#define API_VERSION_MINOR 1 // increment when any change is made, reset to zero when major changes are released after changing API_VERSION_MAJOR
#define API_VERSION_MINOR 2 // increment when any change is made, reset to zero when major changes are released after changing API_VERSION_MAJOR
#define API_VERSION_LENGTH 2
@ -1441,6 +1441,12 @@ static bool processInCommand(void)
break;
case MSP_SET_LED_STRIP_CONFIG:
{
uint8_t ledCount = currentPort->dataSize / 6;
if (ledCount != MAX_LED_STRIP_LENGTH) {
headSerialError(0);
break;
}
for (i = 0; i < MAX_LED_STRIP_LENGTH; i++) {
ledConfig_t *ledConfig = &masterConfig.ledConfigs[i];
uint16_t mask;
@ -1458,6 +1464,7 @@ static bool processInCommand(void)
mask = read8();
ledConfig->xy |= CALCULATE_LED_Y(mask);
}
}
break;
#endif
case MSP_REBOOT: