mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-16 12:55:19 +03:00
Add MSP_SET_ADJUSTMENT_RANGE and MSP_ADJUSTMENT_RANGES commands.
This commit is contained in:
parent
ec92a8e6ba
commit
0ba2933611
2 changed files with 154 additions and 61 deletions
|
@ -197,6 +197,9 @@ const char *boardIdentifier = TARGET_BOARD_IDENTIFIER;
|
|||
#define MSP_RSSI_CONFIG 50
|
||||
#define MSP_SET_RSSI_CONFIG 51
|
||||
|
||||
#define MSP_ADJUSTMENT_RANGES 52
|
||||
#define MSP_SET_ADJUSTMENT_RANGE 53
|
||||
|
||||
//
|
||||
// Baseflight MSP commands (if enabled they exist in Cleanflight)
|
||||
//
|
||||
|
@ -849,8 +852,26 @@ static bool processOutCommand(uint8_t cmdMSP)
|
|||
serialize8(mac->range.endStep);
|
||||
}
|
||||
break;
|
||||
case MSP_ADJUSTMENT_RANGES:
|
||||
headSerialReply(MAX_ADJUSTMENT_RANGE_COUNT * (
|
||||
1 + // adjustment index/slot
|
||||
1 + // aux channel index
|
||||
1 + // start step
|
||||
1 + // end step
|
||||
1 + // adjustment function
|
||||
1 // aux switch channel index
|
||||
));
|
||||
for (i = 0; i < MAX_ADJUSTMENT_RANGE_COUNT; i++) {
|
||||
adjustmentRange_t *adjRange = ¤tProfile->adjustmentRanges[i];
|
||||
serialize8(adjRange->adjustmentIndex);
|
||||
serialize8(adjRange->auxChannelIndex);
|
||||
serialize8(adjRange->range.startStep);
|
||||
serialize8(adjRange->range.endStep);
|
||||
serialize8(adjRange->adjustmentFunction);
|
||||
serialize8(adjRange->auxSwitchChannelIndex);
|
||||
}
|
||||
break;
|
||||
case MSP_BOXNAMES:
|
||||
// headSerialReply(sizeof(boxnames) - 1);
|
||||
serializeBoxNamesReply();
|
||||
break;
|
||||
case MSP_BOXIDS:
|
||||
|
@ -1097,6 +1118,26 @@ static bool processInCommand(void)
|
|||
headSerialError(0);
|
||||
}
|
||||
break;
|
||||
case MSP_SET_ADJUSTMENT_RANGE:
|
||||
i = read8();
|
||||
if (i < MAX_ADJUSTMENT_RANGE_COUNT) {
|
||||
adjustmentRange_t *adjRange = ¤tProfile->adjustmentRanges[i];
|
||||
i = read8();
|
||||
if (i < MAX_SIMULTANEOUS_ADJUSTMENT_COUNT) {
|
||||
adjRange->adjustmentIndex = i;
|
||||
adjRange->auxChannelIndex = read8();
|
||||
adjRange->range.startStep = read8();
|
||||
adjRange->range.endStep = read8();
|
||||
adjRange->adjustmentFunction = read8();
|
||||
adjRange->auxSwitchChannelIndex = read8();
|
||||
} else {
|
||||
headSerialError(0);
|
||||
}
|
||||
} else {
|
||||
headSerialError(0);
|
||||
}
|
||||
break;
|
||||
|
||||
case MSP_SET_RC_TUNING:
|
||||
currentControlRateProfile->rcRate8 = read8();
|
||||
currentControlRateProfile->rcExpo8 = read8();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue