1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-02-27 16:54:15 +01:00

CC-3 Setting up monolithic task template to keep code size down. Importantly

switch to heap_1.c which saves a lot of money.

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2561 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
peabody124 2011-01-24 07:51:22 +00:00 committed by peabody124
parent 95e7017674
commit c55d40bdbc
3 changed files with 31 additions and 10 deletions

View File

@ -179,9 +179,9 @@ SRC += $(OPUAVOBJ)/i2cstats.c
SRC += $(OPUAVOBJ)/watchdogstatus.c
SRC += $(OPUAVOBJ)/telemetrysettings.c
SRC += $(OPUAVOBJ)/ratedesired.c
SRC += $(OPUAVOBJ)/ahrssettings.c
SRC += $(OPUAVOBJ)/manualcontrolsettings.c
SRC += $(OPUAVOBJ)/mixersettings.c
SRC += $(OPUAVOBJ)/mixerstatus.c
#${wildcard ${OBJ}/$(shell echo $(VAR) | tr A-Z a-z)/*.c}
#SRC += ${foreach OBJ, ${UAVOBJECTS}, $(UAVOBJECTS)/$(OBJ).c}
# Cant use until i can automatically generate list of UAVObjects
@ -264,7 +264,7 @@ SRC += $(RTOSSRCDIR)/tasks.c
## RTOS Portable
SRC += $(RTOSSRCDIR)/portable/GCC/ARM_CM3/port.c
SRC += $(RTOSSRCDIR)/portable/MemMang/heap_2.c
SRC += $(RTOSSRCDIR)/portable/MemMang/heap_1.c
## Dosfs file system
#SRC += $(DOSFSDIR)/dosfs.c

View File

@ -52,10 +52,15 @@
#include "ccattitude.h"
#include "attituderaw.h"
#include "attitudeactual.h"
#include "attitudedesired.h"
#include "actuatordesired.h"
#include "actuatorcommand.h"
#include "manualcontrolcommand.h"
#include "CoordinateConversions.h"
// Private constants
#define STACK_SIZE_BYTES 740
#define STACK_SIZE_BYTES 540
#define TASK_PRIORITY (tskIDLE_PRIORITY+4)
#define UPDATE_RATE 10 /* ms */
@ -70,8 +75,12 @@ static xTaskHandle taskHandle;
// Private functions
static void CCAttitudeTask(void *parameters);
void updateInput();
void updateSensors();
void updateAttitude();
void updateStabilization();
void updateActuator();
/**
* Initialise the module, called on startup
@ -105,9 +114,11 @@ static void CCAttitudeTask(void *parameters)
// TODO: register the adc callback, push the data onto a queue (safe for thread)
// with the queue ISR version
updateInput();
updateSensors();
updateAttitude();
updateStabilization();
updateActuator();
/* Wait for the next update interval */
vTaskDelayUntil(&lastSysTime, UPDATE_RATE / portTICK_RATE_MS);
@ -115,6 +126,13 @@ static void CCAttitudeTask(void *parameters)
}
}
void updateInput()
{
ManualControlCommandData manual;
ManualControlCommandGet(&manual);
ManualControlCommandSet(&manual);
}
void updateSensors()
{
AttitudeRawData attitudeRaw;
@ -156,7 +174,7 @@ void updateAttitude()
static portTickType thisSysTime;
float accel_pitch, accel_roll;
float dT;
static float dT = 0;
thisSysTime = xTaskGetTickCount();
if(thisSysTime > lastSysTime) // reuse dt in case of wraparound
@ -205,7 +223,7 @@ void updateStabilization()
}
void updateActuator()
{
{
ActuatorDesiredData actuatorDesired;
ActuatorDesiredGet(&actuatorDesired);
@ -214,6 +232,7 @@ void updateActuator()
ActuatorCommandSet(&actuatorCommand);
}
/**
* @}
* @}

View File

@ -83,10 +83,8 @@ void UAVObjectsInitializeAll()
SystemStatsInitialize();
SystemAlarmsInitialize();
SystemSettingsInitialize();
StabilizationSettingsInitialize();
ActuatorCommandInitialize();
ActuatorDesiredInitialize();
ActuatorSettingsInitialize();
AttitudeRawInitialize();
AttitudeActualInitialize();
AttitudeDesiredInitialize();
@ -95,7 +93,11 @@ void UAVObjectsInitializeAll()
I2CStatsInitialize();
WatchdogStatusInitialize();
TelemetrySettingsInitialize();
//StabilizationSettingsInitialize();
//ActuatorSettingsInitialize();
RateDesiredInitialize();
AHRSSettingsInitialize();
ManualControlSettingsInitialize();
//AHRSSettingsInitialize();
//ManualControlSettingsInitialize();
//MixerSettingsInitialize();
//MixerStatusInitialize();
}