From 63ecf6ad7321f6ad4173587b97b124d40a318949 Mon Sep 17 00:00:00 2001 From: Les Newell Date: Wed, 11 Dec 2013 16:29:20 +0000 Subject: [PATCH] OP-984 txpid can now select which bank it operates on, rather than using the flight mode selected bank. --- flight/modules/TxPID/txpid.c | 39 +++++++++++++++++++- shared/uavobjectdefinition/txpidsettings.xml | 3 +- 2 files changed, 39 insertions(+), 3 deletions(-) diff --git a/flight/modules/TxPID/txpid.c b/flight/modules/TxPID/txpid.c index c5865b61e..5a53565cc 100644 --- a/flight/modules/TxPID/txpid.c +++ b/flight/modules/TxPID/txpid.c @@ -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; + } } } diff --git a/shared/uavobjectdefinition/txpidsettings.xml b/shared/uavobjectdefinition/txpidsettings.xml index 41c7d06ca..3276635e0 100644 --- a/shared/uavobjectdefinition/txpidsettings.xml +++ b/shared/uavobjectdefinition/txpidsettings.xml @@ -2,6 +2,7 @@ Settings used by @ref TxPID optional module to tune PID settings using R/C transmitter +