diff --git a/flight/modules/TxPID/txpid.c b/flight/modules/TxPID/txpid.c index b91bea02a..8452727c2 100644 --- a/flight/modules/TxPID/txpid.c +++ b/flight/modules/TxPID/txpid.c @@ -256,17 +256,17 @@ static void updatePIDs(UAVObjEvent *ev) case TXPIDSETTINGS_PIDS_ROLLRATEKP: needsUpdateBank |= update(&bank.RollRatePID.Kp, value); break; - case TXPIDSETTINGS_PIDS_ROLLRATEPID: + case TXPIDSETTINGS_PIDS_EASYTUNERATEROLL: easyTuneEnabled = true; needsUpdateBank |= update(&bank.RollRatePID.Kp, value); - needsUpdateBank |= update(&bank.RollRatePID.Ki, value * inst.PitchRollRateFactors.I); - needsUpdateBank |= update(&bank.RollRatePID.Kd, value * inst.PitchRollRateFactors.D); + needsUpdateBank |= update(&bank.RollRatePID.Ki, value * inst.EasyTunePitchRollRateFactors.I); + needsUpdateBank |= update(&bank.RollRatePID.Kd, value * inst.EasyTunePitchRollRateFactors.D); break; - case TXPIDSETTINGS_PIDS_PITCHRATEPID: + case TXPIDSETTINGS_PIDS_EASYTUNERATEPITCH: easyTuneEnabled = true; needsUpdateBank |= update(&bank.PitchRatePID.Kp, value); - needsUpdateBank |= update(&bank.PitchRatePID.Ki, value * inst.PitchRollRateFactors.I); - needsUpdateBank |= update(&bank.PitchRatePID.Kd, value * inst.PitchRollRateFactors.D); + needsUpdateBank |= update(&bank.PitchRatePID.Ki, value * inst.EasyTunePitchRollRateFactors.I); + needsUpdateBank |= update(&bank.PitchRatePID.Kd, value * inst.EasyTunePitchRollRateFactors.D); break; case TXPIDSETTINGS_PIDS_ROLLRATEKI: needsUpdateBank |= update(&bank.RollRatePID.Ki, value); @@ -451,11 +451,11 @@ static void updatePIDs(UAVObjEvent *ev) AltitudeHoldSettingsSet(&altitude); } #endif - if (easyTuneEnabled && (inst.RatePIDRecalculateYaw != TXPIDSETTINGS_RATEPIDRECALCULATEYAW_FALSE)) { - float newKp = (bank.RollRatePID.Kp + bank.PitchRatePID.Kp) * .5f * inst.YawRateFactors.P; + if (easyTuneEnabled && (inst.EasyTuneRatePIDRecalculateYaw != TXPIDSETTINGS_EASYTUNERATEPIDRECALCULATEYAW_FALSE)) { + float newKp = (bank.RollRatePID.Kp + bank.PitchRatePID.Kp) * .5f * inst.EasyTuneYawRateFactors.P; needsUpdateBank |= update(&bank.YawRatePID.Kp, newKp); - needsUpdateBank |= update(&bank.YawRatePID.Ki, newKp * inst.YawRateFactors.I); - needsUpdateBank |= update(&bank.YawRatePID.Kd, newKp * inst.YawRateFactors.D); + needsUpdateBank |= update(&bank.YawRatePID.Ki, newKp * inst.EasyTuneYawRateFactors.I); + needsUpdateBank |= update(&bank.YawRatePID.Kd, newKp * inst.EasyTuneYawRateFactors.D); } if (needsUpdateBank) { switch (inst.BankNumber) { diff --git a/ground/gcs/src/plugins/config/configtxpidwidget.cpp b/ground/gcs/src/plugins/config/configtxpidwidget.cpp index 4ab3e657b..59acb17a6 100644 --- a/ground/gcs/src/plugins/config/configtxpidwidget.cpp +++ b/ground/gcs/src/plugins/config/configtxpidwidget.cpp @@ -167,8 +167,8 @@ static bool isExpoOption(int pidOption) static bool isFullPIDOption(int pidOption) { switch (pidOption) { - case TxPIDSettings::PIDS_ROLLRATEPID: - case TxPIDSettings::PIDS_PITCHRATEPID: + case TxPIDSettings::PIDS_EASYTUNERATEPITCH: + case TxPIDSettings::PIDS_EASYTUNERATEROLL: return true; default: @@ -197,11 +197,11 @@ static float defaultValueForPidOption(const StabilizationSettingsBankX *bank, in return 0.0f; case TxPIDSettings::PIDS_ROLLRATEKP: - case TxPIDSettings::PIDS_ROLLRATEPID: + case TxPIDSettings::PIDS_EASYTUNERATEROLL: return bank->getRollRatePID_Kp(); case TxPIDSettings::PIDS_PITCHRATEKP: - case TxPIDSettings::PIDS_PITCHRATEPID: + case TxPIDSettings::PIDS_EASYTUNERATEPITCH: return bank->getPitchRatePID_Kp(); case TxPIDSettings::PIDS_ROLLPITCHRATEKP: diff --git a/ground/gcs/src/plugins/config/txpid.ui b/ground/gcs/src/plugins/config/txpid.ui index 2f4a78637..b4829de7f 100644 --- a/ground/gcs/src/plugins/config/txpid.ui +++ b/ground/gcs/src/plugins/config/txpid.ui @@ -883,7 +883,7 @@ font:bold; objname:TxPIDSettings - fieldname:PitchRollRateFactors + fieldname:EasyTunePitchRollRateFactors scale:0.1 element:I buttongroup:10 @@ -948,7 +948,7 @@ font:bold; objname:TxPIDSettings - fieldname:PitchRollRateFactors + fieldname:EasyTunePitchRollRateFactors scale:1 element:D buttongroup:10 @@ -973,7 +973,7 @@ font:bold; objname:TxPIDSettings - fieldname:RatePIDRecalculateYaw + fieldname:EasyTuneRatePIDRecalculateYaw buttongroup:11 @@ -1039,7 +1039,7 @@ font:bold; objname:TxPIDSettings - fieldname:YawRateFactors + fieldname:EasyTuneYawRateFactors scale:0.1 element:P buttongroup:11 @@ -1101,7 +1101,7 @@ font:bold; objname:TxPIDSettings - fieldname:YawRateFactors + fieldname:EasyTuneYawRateFactors scale:1 element:I buttongroup:11 @@ -1166,7 +1166,7 @@ font:bold; objname:TxPIDSettings - fieldname:YawRateFactors + fieldname:EasyTuneYawRateFactors scale:1 element:D buttongroup:11 @@ -1284,7 +1284,7 @@ font:bold; objname:TxPIDSettings - fieldname:YawRateFactors + fieldname:EasyTuneYawRateFactors scale:1 element:P buttongroup:11 @@ -1324,7 +1324,7 @@ font:bold; objname:TxPIDSettings - fieldname:PitchRollRateFactors + fieldname:EasyTunePitchRollRateFactors scale:1 element:I buttongroup:10 diff --git a/shared/uavobjectdefinition/txpidsettings.xml b/shared/uavobjectdefinition/txpidsettings.xml index 43adc6574..3bcc81067 100644 --- a/shared/uavobjectdefinition/txpidsettings.xml +++ b/shared/uavobjectdefinition/txpidsettings.xml @@ -11,7 +11,7 @@ - - - + + +