mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-16 21:05:35 +03:00
Motor output reordering for CLI and MSP
Fixed some code formatting +fixReorderingArray() for EEPROM load/save and renamings fix brace new line moving MOTOR_OUTPUT_REORDERING to MSP2 betaflight specific validateAndfixConfig now resets reordering motor array to default in case it is invalid
This commit is contained in:
parent
1d78f97846
commit
464919c416
17 changed files with 185 additions and 21 deletions
|
@ -1190,6 +1190,16 @@ static bool mspProcessOutCommand(int16_t cmdMSP, sbuf_t *dst)
|
|||
}
|
||||
break;
|
||||
|
||||
case MSP2_MOTOR_OUTPUT_REORDERING:
|
||||
{
|
||||
sbufWriteU8(dst, MAX_SUPPORTED_MOTORS);
|
||||
|
||||
for (unsigned i = 0; i < MAX_SUPPORTED_MOTORS; i++) {
|
||||
sbufWriteU8(dst, motorConfig()->dev.motorOutputReordering[i]);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case MSP_RC:
|
||||
for (int i = 0; i < rxRuntimeState.channelCount; i++) {
|
||||
sbufWriteU16(dst, rcData[i]);
|
||||
|
@ -2964,6 +2974,22 @@ static mspResult_e mspProcessInCommand(mspDescriptor_t srcDesc, int16_t cmdMSP,
|
|||
break;
|
||||
#endif
|
||||
|
||||
case MSP2_SET_MOTOR_OUTPUT_REORDERING:
|
||||
{
|
||||
const uint8_t arraySize = sbufReadU8(src);
|
||||
|
||||
for (unsigned i = 0; i < MAX_SUPPORTED_MOTORS; i++) {
|
||||
uint8_t value = i;
|
||||
|
||||
if (i < arraySize) {
|
||||
value = sbufReadU8(src);
|
||||
}
|
||||
|
||||
motorConfigMutable()->dev.motorOutputReordering[i] = value;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
#ifdef USE_CAMERA_CONTROL
|
||||
case MSP_CAMERA_CONTROL:
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue