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:
parent
0280e96a9a
commit
2cf686b36b
1 changed files with 10 additions and 1 deletions
11
src/mw.c
11
src/mw.c
|
@ -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(¤tProfile.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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue