mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-24 00:35:39 +03:00
Failsafe - Allow AUX channels to HOLD their last value or be SET to a
specific value when RX loss is detected. Tested with SBus, PWM & PPM.
This commit is contained in:
parent
3436b08575
commit
490268d2fc
5 changed files with 73 additions and 17 deletions
|
@ -1164,9 +1164,10 @@ static bool processOutCommand(uint8_t cmdMSP)
|
|||
break;
|
||||
|
||||
case MSP_RXFAIL_CONFIG:
|
||||
headSerialReply(2 * (rxRuntimeConfig.channelCount-4));
|
||||
for (i = 4; i < rxRuntimeConfig.channelCount; i++) {
|
||||
serialize16(RXFAIL_STEP_TO_CHANNEL_VALUE(masterConfig.rxConfig.rx_fail_usec_steps[i-4]));
|
||||
headSerialReply(3 * (rxRuntimeConfig.channelCount - NON_AUX_CHANNEL_COUNT));
|
||||
for (i = NON_AUX_CHANNEL_COUNT; i < rxRuntimeConfig.channelCount; i++) {
|
||||
serialize8(masterConfig.rxConfig.failsafe_aux_channel_configurations[i - NON_AUX_CHANNEL_COUNT].mode);
|
||||
serialize16(RXFAIL_STEP_TO_CHANNEL_VALUE(masterConfig.rxConfig.failsafe_aux_channel_configurations[i - NON_AUX_CHANNEL_COUNT].step));
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -1597,12 +1598,14 @@ static bool processInCommand(void)
|
|||
|
||||
case MSP_SET_RXFAIL_CONFIG:
|
||||
{
|
||||
uint8_t channelCount = currentPort->dataSize / sizeof(uint16_t);
|
||||
if (channelCount > MAX_SUPPORTED_RC_CHANNEL_COUNT-4) {
|
||||
uint8_t channelCount = currentPort->dataSize / 3;
|
||||
if (channelCount > MAX_AUX_CHANNEL_COUNT) {
|
||||
headSerialError(0);
|
||||
} else {
|
||||
for (i = 4; i < channelCount; i++)
|
||||
masterConfig.rxConfig.rx_fail_usec_steps[i-4] = CHANNEL_VALUE_TO_RXFAIL_STEP(read16());
|
||||
for (i = NON_AUX_CHANNEL_COUNT; i < channelCount; i++) {
|
||||
masterConfig.rxConfig.failsafe_aux_channel_configurations[i - NON_AUX_CHANNEL_COUNT].mode = read8();
|
||||
masterConfig.rxConfig.failsafe_aux_channel_configurations[i - NON_AUX_CHANNEL_COUNT].step = CHANNEL_VALUE_TO_RXFAIL_STEP(read16());
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue