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

G-Tune port from Harakiri

Enabled for NAZE, ALIENWWIIF1 and ALIENWIIF3 targets
Implement G-Tune for all PID controllers
The G-Tune tuning results will be save if G-Tune mode will be disabled
during copter is disarmed.
Update PID controller and G-Tune documentation
This commit is contained in:
Michael Jakob 2015-02-27 07:38:51 +01:00
parent b20dc77a74
commit 43f5792a61
15 changed files with 371 additions and 4 deletions

View file

@ -71,6 +71,7 @@
#include "flight/altitudehold.h"
#include "flight/failsafe.h"
#include "flight/autotune.h"
#include "flight/gtune.h"
#include "flight/navigation.h"
#include "flight/filter.h"
@ -160,6 +161,30 @@ void updateAutotuneState(void)
}
#endif
#ifdef GTUNE
void updateGtuneState(void)
{
static bool GTuneWasUsed = false;
if (IS_RC_MODE_ACTIVE(BOXGTUNE)) {
if (!FLIGHT_MODE(GTUNE_MODE)) {
ENABLE_FLIGHT_MODE(GTUNE_MODE);
init_Gtune(&currentProfile->pidProfile);
GTuneWasUsed = true;
}
} else {
if (FLIGHT_MODE(GTUNE_MODE)) {
DISABLE_FLIGHT_MODE(GTUNE_MODE);
if (!ARMING_FLAG(ARMED) && GTuneWasUsed) {
saveConfigAndNotify();
GTuneWasUsed = false;
}
}
}
}
#endif
bool isCalibrating()
{
#ifdef BARO
@ -806,6 +831,10 @@ void loop(void)
}
#endif
#ifdef GTUNE
updateGtuneState();
#endif
#if defined(BARO) || defined(SONAR)
if (sensors(SENSOR_BARO) || sensors(SENSOR_SONAR)) {
if (FLIGHT_MODE(BARO_MODE) || FLIGHT_MODE(SONAR_MODE)) {