From 68ecefa0fd78ae0e0270bf8c7eee7dd6722158ab Mon Sep 17 00:00:00 2001 From: a*morale Date: Sat, 19 Sep 2015 15:03:17 +0200 Subject: [PATCH 1/2] LP-124 - Rename Pitch/RollRatePid to EasyTuneRatePitch/Roll, UAVO and firmware fixes --- flight/modules/TxPID/txpid.c | 20 ++++++++++---------- shared/uavobjectdefinition/txpidsettings.xml | 8 ++++---- 2 files changed, 14 insertions(+), 14 deletions(-) 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/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 @@ - - - + + + From abf40a47ebc65fbdbff2491b0a30e5ebede3777f Mon Sep 17 00:00:00 2001 From: Alessio Morale Date: Sat, 19 Sep 2015 15:31:08 +0200 Subject: [PATCH 2/2] LP-124 - Fix renamed fields/options in GCS --- .../gcs/src/plugins/config/configtxpidwidget.cpp | 8 ++++---- ground/gcs/src/plugins/config/txpid.ui | 16 ++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) 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