1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-11-29 07:24:13 +01:00

OP-984 txpid can now select which bank it operates on, rather than using the flight mode selected bank.

This commit is contained in:
Les Newell 2013-12-11 16:29:20 +00:00
parent 68b8586c6b
commit 63ecf6ad73
2 changed files with 39 additions and 3 deletions

View File

@ -57,6 +57,9 @@
#include "manualcontrolcommand.h"
#include "stabilizationsettings.h"
#include "stabilizationbank.h"
#include "stabilizationsettingsbank1.h"
#include "stabilizationsettingsbank2.h"
#include "stabilizationsettingsbank3.h"
#include "flightstatus.h"
#include "hwsettings.h"
@ -165,7 +168,23 @@ static void updatePIDs(UAVObjEvent *ev)
}
StabilizationBankData bank;
StabilizationBankGet(&bank);
switch(inst.UpdateMode)
{
case 0:
StabilizationSettingsBank1Get((StabilizationSettingsBank1Data *) &bank);
break;
case 1:
StabilizationSettingsBank2Get((StabilizationSettingsBank2Data *) &bank);
break;
case 2:
StabilizationSettingsBank2Get((StabilizationSettingsBank2Data *) &bank);
break;
default:
return;
}
StabilizationSettingsData stab;
StabilizationSettingsGet(&stab);
AccessoryDesiredData accessory;
@ -298,7 +317,23 @@ static void updatePIDs(UAVObjEvent *ev)
StabilizationSettingsSet(&stab);
}
if (needsUpdateBank) {
StabilizationBankSet(&bank);
switch(inst.UpdateMode)
{
case 0:
StabilizationSettingsBank1Set((StabilizationSettingsBank1Data *) &bank);
break;
case 1:
StabilizationSettingsBank2Set((StabilizationSettingsBank2Data *) &bank);
break;
case 2:
StabilizationSettingsBank2Set((StabilizationSettingsBank2Data *) &bank);
break;
default:
return;
}
}
}

View File

@ -2,6 +2,7 @@
<object name="TxPIDSettings" singleinstance="true" settings="true" category="Control">
<description>Settings used by @ref TxPID optional module to tune PID settings using R/C transmitter</description>
<field name="UpdateMode" units="option" type="enum" elements="1" options="Never,When Armed,Always" defaultvalue="When Armed"/>
<field name="BankNumber" units="" type="uint8" elements="1" defaultvalue="0" limits="%BE:0:3"/>
<field name="Inputs" units="channel" type="enum"
elementnames="Instance1,Instance2,Instance3"
options="Throttle,Accessory0,Accessory1,Accessory2,Accessory3,Accessory4,Accessory5"
@ -10,7 +11,7 @@
<field name="PIDs" units="option" type="enum"
elementnames="Instance1,Instance2,Instance3"
options="Disabled,
Roll Rate.Kp, Pitch Rate.Kp, Roll+Pitch Rate.Kp, Yaw Rate.Kp,
Roll Rate.Kp, Pitch Rate.Kp, Roll+Pitch Rate.Kp, Yaw Rate.Kp,
Roll Rate.Ki, Pitch Rate.Ki, Roll+Pitch Rate.Ki, Yaw Rate.Ki,
Roll Rate.Kd, Pitch Rate.Kd, Roll+Pitch Rate.Kd, Yaw Rate.Kd,
Roll Rate.ILimit, Pitch Rate.ILimit, Roll+Pitch Rate.ILimit, Yaw Rate.ILimit,