mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-18 03:52:11 +01:00
Merge branch 'amorale/OP-1188_stabilization_stack_optimization' into rel-14.01
This commit is contained in:
commit
99e9009c14
@ -194,7 +194,6 @@ MODULE_INITCALL(StabilizationInitialize, StabilizationStart);
|
|||||||
static void stabilizationTask(__attribute__((unused)) void *parameters)
|
static void stabilizationTask(__attribute__((unused)) void *parameters)
|
||||||
{
|
{
|
||||||
UAVObjEvent ev;
|
UAVObjEvent ev;
|
||||||
|
|
||||||
uint32_t timeval = PIOS_DELAY_GetRaw();
|
uint32_t timeval = PIOS_DELAY_GetRaw();
|
||||||
|
|
||||||
ActuatorDesiredData actuatorDesired;
|
ActuatorDesiredData actuatorDesired;
|
||||||
@ -757,13 +756,17 @@ static float stab_powf(float x, uint8_t p)
|
|||||||
|
|
||||||
static void SettingsBankUpdatedCb(__attribute__((unused)) UAVObjEvent *ev)
|
static void SettingsBankUpdatedCb(__attribute__((unused)) UAVObjEvent *ev)
|
||||||
{
|
{
|
||||||
StabilizationBankData bank, oldBank;
|
|
||||||
|
|
||||||
StabilizationBankGet(&oldBank);
|
|
||||||
|
|
||||||
if (cur_flight_mode < 0 || cur_flight_mode >= NUM_FMS_POSITIONS) {
|
if (cur_flight_mode < 0 || cur_flight_mode >= NUM_FMS_POSITIONS) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if ((ev) && ((settings.FlightModeMap[cur_flight_mode] == 0 && ev->obj != StabilizationSettingsBank1Handle()) ||
|
||||||
|
(settings.FlightModeMap[cur_flight_mode] == 1 && ev->obj != StabilizationSettingsBank2Handle()) ||
|
||||||
|
(settings.FlightModeMap[cur_flight_mode] == 2 && ev->obj != StabilizationSettingsBank3Handle()) ||
|
||||||
|
settings.FlightModeMap[cur_flight_mode] > 2)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
StabilizationBankData bank;
|
||||||
|
|
||||||
switch (settings.FlightModeMap[cur_flight_mode]) {
|
switch (settings.FlightModeMap[cur_flight_mode]) {
|
||||||
case 0:
|
case 0:
|
||||||
@ -777,16 +780,8 @@ static void SettingsBankUpdatedCb(__attribute__((unused)) UAVObjEvent *ev)
|
|||||||
case 2:
|
case 2:
|
||||||
StabilizationSettingsBank3Get((StabilizationSettingsBank3Data *)&bank);
|
StabilizationSettingsBank3Get((StabilizationSettingsBank3Data *)&bank);
|
||||||
break;
|
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);
|
|
||||||
}
|
}
|
||||||
|
StabilizationBankSet(&bank);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void BankUpdatedCb(__attribute__((unused)) UAVObjEvent *ev)
|
static void BankUpdatedCb(__attribute__((unused)) UAVObjEvent *ev)
|
||||||
|
@ -162,7 +162,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#define PIOS_STABILIZATION_STACK_SIZE 790
|
#define PIOS_STABILIZATION_STACK_SIZE 790
|
||||||
#define PIOS_TELEM_STACK_SIZE 540
|
#define PIOS_TELEM_STACK_SIZE 540
|
||||||
#define PIOS_EVENTDISPATCHER_STACK_SIZE 150
|
#define PIOS_EVENTDISPATCHER_STACK_SIZE 160
|
||||||
|
|
||||||
/* This can't be too high to stop eventdispatcher thread overflowing */
|
/* This can't be too high to stop eventdispatcher thread overflowing */
|
||||||
#define PIOS_EVENTDISAPTCHER_QUEUE 10
|
#define PIOS_EVENTDISAPTCHER_QUEUE 10
|
||||||
|
Loading…
x
Reference in New Issue
Block a user