1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-02-20 10:54:14 +01:00

LP-56 - Allows a single txpid instance to handle Roll&Pitch

Also populate combos with current txpid values
This commit is contained in:
Alessio Morale 2015-07-27 22:45:33 +02:00
parent 383a4731c7
commit 7b3aed3de9
3 changed files with 19 additions and 5 deletions

View File

@ -389,7 +389,10 @@ static void updatePIDs(UAVObjEvent *ev)
case TXPIDSETTINGS_PIDS_ACROPLUSFACTORPITCH:
needsUpdateBank |= update(&bank.AcroInsanityFactor.Pitch, value);
break;
case TXPIDSETTINGS_PIDS_ACROPLUSFACTORROLLPITCH:
needsUpdateBank |= update(&bank.AcroInsanityFactor.Roll, value);
needsUpdateBank |= update(&bank.AcroInsanityFactor.Pitch, value);
break;
case TXPIDSETTINGS_PIDS_ACCELTAU:
needsUpdateAtt |= update(&att.AccelTau, value);
break;

View File

@ -163,8 +163,15 @@ static bool isExpoOption(int pidOption)
static bool isAcroPlusFactorOption(int pidOption)
{
return pidOption == TxPIDSettings::PIDS_ACROPLUSFACTORPITCH
|| pidOption == TxPIDSettings::PIDS_ACROPLUSFACTORROLL;
switch (pidOption) {
case TxPIDSettings::PIDS_ACROPLUSFACTORPITCH:
case TxPIDSettings::PIDS_ACROPLUSFACTORROLL:
case TxPIDSettings::PIDS_ACROPLUSFACTORROLLPITCH:
return true;
default:
return false;
}
}
template <class StabilizationSettingsBankX>
@ -293,7 +300,11 @@ static float defaultValueForPidOption(const StabilizationSettingsBankX *bank, in
case TxPIDSettings::PIDS_YAWEXPO:
return bank->getStickExpo_Yaw();
case TxPIDSettings::PIDS_ACROPLUSFACTORROLL:
case TxPIDSettings::PIDS_ACROPLUSFACTORROLLPITCH:
return bank->getAcroInsanityFactor_Roll();
case TxPIDSettings::PIDS_ACROPLUSFACTORPITCH:
return bank->getAcroInsanityFactor_Pitch();
case -1: // The PID Option field was uninitialized.
return 0.0f;

View File

@ -20,7 +20,7 @@
Roll+Pitch Attitude.Kp, Roll+Pitch Attitude.Ki, Roll+Pitch Attitude.ILimit, Roll+Pitch Attitude.Resp,
Yaw Attitude.Kp, Yaw Attitude.Ki, Yaw Attitude.ILimit, Yaw Attitude.Resp,
Roll.Expo, Pitch.Expo, Roll+Pitch.Expo, Yaw.Expo,
GyroTau,AcroPlusFactorRoll,AcroPlusFactorPitch,Altitude Pos.Kp,Altitude Velocity.Kp,Altitude Velocity.Ki,Altitude Velocity.Kd,Altitude Velocity.Beta,
GyroTau,AcroPlusFactorRollPitch,AcroPlusFactorRoll,AcroPlusFactorPitch,Altitude Pos.Kp,Altitude Velocity.Kp,Altitude Velocity.Ki,Altitude Velocity.Kd,Altitude Velocity.Beta,
AccelTau, AccelKp, AccelKi"
defaultvalue="Disabled"/>
<field name="MinPID" units="" type="float" elementnames="Instance1,Instance2,Instance3" defaultvalue="0"/>