Fix CRC errors in msp responses caused by double calling of

headSerialReply().  Ensure system is not reset while MSP response is
being transmitted.
This commit is contained in:
Dominic Clifton 2014-12-19 23:47:58 +00:00
parent 5b2659c92c
commit a48a848890
1 changed files with 6 additions and 14 deletions

View File

@ -1302,31 +1302,26 @@ static bool processInCommand(void)
break;
#endif
case MSP_SET_FEATURE:
headSerialReply(0);
featureClearAll();
featureSet(read32()); // features bitmap
break;
case MSP_SET_BOARD_ALIGNMENT:
headSerialReply(0);
masterConfig.boardAlignment.rollDegrees = read16();
masterConfig.boardAlignment.pitchDegrees = read16();
masterConfig.boardAlignment.yawDegrees = read16();
break;
case MSP_SET_CURRENT_METER_CONFIG:
headSerialReply(0);
masterConfig.batteryConfig.currentMeterScale = read16();
masterConfig.batteryConfig.currentMeterOffset = read16();
break;
case MSP_SET_MIXER:
headSerialReply(0);
masterConfig.mixerConfiguration = read8();
break;
case MSP_SET_RX_CONFIG:
headSerialReply(0);
masterConfig.rxConfig.serialrx_provider = read8();
masterConfig.rxConfig.maxcheck = read16();
masterConfig.rxConfig.midrc = read16();
@ -1335,20 +1330,16 @@ static bool processInCommand(void)
break;
case MSP_SET_RSSI_CONFIG:
headSerialReply(0);
masterConfig.rxConfig.rssi_channel = read8();
break;
case MSP_SET_RX_MAP:
headSerialReply(0);
for (i = 0; i < MAX_MAPPABLE_RX_INPUTS; i++) {
masterConfig.rxConfig.rcmap[i] = read8();
}
break;
case MSP_SET_CONFIG:
headSerialReply(0);
masterConfig.mixerConfiguration = read8(); // multitype
@ -1367,7 +1358,6 @@ static bool processInCommand(void)
#ifdef LED_STRIP
case MSP_SET_LED_COLORS:
headSerialReply(0);
for (i = 0; i < CONFIGURABLE_COLOR_COUNT; i++) {
hsvColor_t *color = &masterConfig.colors[i];
color->h = read16();
@ -1377,7 +1367,6 @@ static bool processInCommand(void)
break;
case MSP_SET_LED_STRIP_CONFIG:
headSerialReply(MAX_LED_STRIP_LENGTH * 6);
for (i = 0; i < MAX_LED_STRIP_LENGTH; i++) {
ledConfig_t *ledConfig = &masterConfig.ledConfigs[i];
uint16_t mask;
@ -1398,7 +1387,6 @@ static bool processInCommand(void)
break;
#endif
case MSP_REBOOT:
headSerialReply(0);
isRebootScheduled = true;
break;
@ -1477,6 +1465,10 @@ void mspProcess(void)
mspProcessPort();
if (isRebootScheduled) {
// pause a little while to allow response to be sent
while (!isSerialTransmitBufferEmpty(candidatePort->port)) {
delay(50);
}
systemReset();
}
}