1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-17 13:25:30 +03:00

Change airmode activation to be throttle percent based to fix 3D mode

The previous logic used an absolute throttle value of 1350us which won't work in 3D mode and resulted in airmode being activated on arming.  Renamed the parameter to airmode_start_throttle_percent and set the default to 32 (equivalent to what the previous setting of 1350 when min_check is taken into account).

To preserve MSP functionality the value is transformed to/from microsecond values (32 becomes 1320) when interfaced.
This commit is contained in:
Bruce Luckcuck 2018-01-31 22:28:47 -05:00
parent f45c503738
commit 003979a2eb
5 changed files with 10 additions and 10 deletions

View file

@ -1013,7 +1013,7 @@ static bool mspProcessOutCommand(uint8_t cmdMSP, sbuf_t *dst)
sbufWriteU16(dst, rxConfig()->rx_max_usec);
sbufWriteU8(dst, rxConfig()->rcInterpolation);
sbufWriteU8(dst, rxConfig()->rcInterpolationInterval);
sbufWriteU16(dst, rxConfig()->airModeActivateThreshold);
sbufWriteU16(dst, (rxConfig()->airModeActivateThreshold * 10) + 1000);
sbufWriteU8(dst, rxConfig()->rx_spi_protocol);
sbufWriteU32(dst, rxConfig()->rx_spi_id);
sbufWriteU8(dst, rxConfig()->rx_spi_rf_channel_count);
@ -1872,7 +1872,7 @@ static mspResult_e mspProcessInCommand(uint8_t cmdMSP, sbuf_t *src)
if (sbufBytesRemaining(src) >= 4) {
rxConfigMutable()->rcInterpolation = sbufReadU8(src);
rxConfigMutable()->rcInterpolationInterval = sbufReadU8(src);
rxConfigMutable()->airModeActivateThreshold = sbufReadU16(src);
rxConfigMutable()->airModeActivateThreshold = ((sbufReadU16(src) - 1000) / 10);
}
if (sbufBytesRemaining(src) >= 6) {
rxConfigMutable()->rx_spi_protocol = sbufReadU8(src);