1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-24 08:45:36 +03:00

If auto tune was used, and the user landed the aircraft, then before it

is used again it must be reset.

Otherwise the first flip of the switch would start the next phase which
could mean that PID settings were restored.
This commit is contained in:
Dominic Clifton 2014-05-27 18:00:42 +01:00
parent 0280e96a9a
commit 2cf686b36b

View file

@ -81,14 +81,19 @@ uint16_t InflightcalibratingA = 0;
void updateAutotuneState(void)
{
static bool landedAfterAutoTuning = false;
static bool autoTuneWasUsed = false;
if (rcOptions[BOXAUTOTUNE]) {
if (!f.AUTOTUNE_MODE) {
if (f.ARMED) {
if (isAutotuneIdle()) {
if (isAutotuneIdle() || landedAfterAutoTuning) {
autotuneReset();
landedAfterAutoTuning = false;
}
autotuneBeginNextPhase(&currentProfile.pidProfile, currentProfile.pidController);
f.AUTOTUNE_MODE = 1;
autoTuneWasUsed = true;
} else {
if (havePidsBeenUpdatedByAutotune()) {
//writeEEPROM();
@ -104,6 +109,10 @@ void updateAutotuneState(void)
autotuneEndPhase();
f.AUTOTUNE_MODE = 0;
}
if (!f.ARMED && autoTuneWasUsed) {
landedAfterAutoTuning = true;
}
}
bool isCalibrating()