1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-12-01 09:24:10 +01:00

OP-984 Fixed bad merge of stabilization.c

This commit is contained in:
Les Newell 2014-01-10 22:16:50 +00:00
parent 49cf33ee59
commit 2e030419ca

View File

@ -684,38 +684,6 @@ static float stab_powf(float x, uint8_t p)
} }
static void SettingsUpdatedCb(__attribute__((unused)) UAVObjEvent *ev)
{
StabilizationBankData bank, oldBank;
StabilizationBankGet(&oldBank);
if(flight_mode < 0) return;
switch(cast_struct_to_array(settings.FlightModeMap, settings.FlightModeMap.Stabilized1)[flight_mode])
{
case 0:
StabilizationSettingsBank1Get((StabilizationSettingsBank1Data *) &bank);
break;
case 1:
StabilizationSettingsBank2Get((StabilizationSettingsBank2Data *) &bank);
break;
case 2:
StabilizationSettingsBank3Get((StabilizationSettingsBank3Data *) &bank);
break;
default:
memset(&bank, 0, sizeof(StabilizationBankDataPacked));
// return; //bank number is invalid. All we can do is ignore it.
}
//Need to do this to prevent an infinite loop
if(memcmp(&oldBank, &bank, sizeof(StabilizationBankDataPacked)) != 0)
{
StabilizationBankSet(&bank);
}
}
static void SettingsBankUpdatedCb(__attribute__((unused)) UAVObjEvent *ev) static void SettingsBankUpdatedCb(__attribute__((unused)) UAVObjEvent *ev)
{ {
@ -743,7 +711,7 @@ static void SettingsBankUpdatedCb(__attribute__((unused)) UAVObjEvent *ev)
// return; //bank number is invalid. All we can do is ignore it. // return; //bank number is invalid. All we can do is ignore it.
} }
//Need to do this to prevent an infinite loop //Need to do this to prevent an infinite loop
if(memcmp(&oldBank, &bank, sizeof(StabilizationBankDataPacked)) != 0) if(memcmp(&oldBank, &bank, sizeof(StabilizationBankDataPacked)) != 0)
{ {
StabilizationBankSet(&bank); StabilizationBankSet(&bank);
@ -848,6 +816,12 @@ static void BankUpdatedCb(__attribute__((unused)) UAVObjEvent *ev)
bank.YawRatePID.Ki, bank.YawRatePID.Ki,
bank.YawRatePID.Kd, bank.YawRatePID.Kd,
bank.YawRatePID.ILimit); bank.YawRatePID.ILimit);
}
static void SettingsUpdatedCb(__attribute__((unused)) UAVObjEvent *ev)
{
StabilizationSettingsGet(&settings);
// Set up the derivative term // Set up the derivative term
pid_configure_derivative(settings.DerivativeCutoff, settings.DerivativeGamma); pid_configure_derivative(settings.DerivativeCutoff, settings.DerivativeGamma);
@ -882,13 +856,14 @@ static void BankUpdatedCb(__attribute__((unused)) UAVObjEvent *ev)
// Compute time constant for vbar decay term based on a tau // Compute time constant for vbar decay term based on a tau
vbar_decay = expf(-fakeDt / settings.VbarTau); vbar_decay = expf(-fakeDt / settings.VbarTau);
flight_mode = -1; //force flight mode update
//force flight mode update
flight_mode = -1;
// Rattitude flight mode anti-windup factor // Rattitude flight mode anti-windup factor
rattitude_anti_windup = settings.RattitudeAntiWindup; rattitude_anti_windup = settings.RattitudeAntiWindup;
} }
/** /**
* @} * @}
* @} * @}