1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-23 00:05:33 +03:00

Merge pull request #7516 from mikeller/add_automatic_pid_profile_switching

Added battery cell count based automatic PID profile switching.
This commit is contained in:
Michael Keller 2019-02-08 09:28:07 +13:00 committed by GitHub
commit 59ea4becb3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
23 changed files with 124 additions and 73 deletions

View file

@ -833,7 +833,7 @@ static bool mspProcessOutCommand(uint8_t cmdMSP, sbuf_t *dst)
sbufWriteU8(dst, getCurrentPidProfileIndex());
sbufWriteU16(dst, constrain(averageSystemLoadPercent, 0, 100));
if (cmdMSP == MSP_STATUS_EX) {
sbufWriteU8(dst, MAX_PROFILE_COUNT);
sbufWriteU8(dst, PID_PROFILE_COUNT);
sbufWriteU8(dst, getCurrentControlRateProfileIndex());
} else { // MSP_STATUS
sbufWriteU16(dst, 0); // gyro cycle time
@ -1625,7 +1625,7 @@ static mspResult_e mspProcessInCommand(uint8_t cmdMSP, sbuf_t *src)
value = sbufReadU8(src);
if ((value & RATEPROFILE_MASK) == 0) {
if (!ARMING_FLAG(ARMED)) {
if (value >= MAX_PROFILE_COUNT) {
if (value >= PID_PROFILE_COUNT) {
value = 0;
}
changePidProfile(value);