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

Fixed compile-time bugs in the case where airspeed module is compiled, but no drivers are present in pios_config.

This commit is contained in:
Kenz Dale 2012-07-23 14:06:44 +02:00
parent f5db83bd20
commit 21527544f9
2 changed files with 11 additions and 3 deletions

View File

@ -62,6 +62,9 @@
#define STACK_SIZE_BYTES 600
#elif defined (BARO_AIRSPEED_PRESENT)
#define STACK_SIZE_BYTES 550
#else
#define STACK_SIZE_BYTES 0
#define NO_AIRSPEED_SENSOR_PRESENT
#endif
@ -107,6 +110,10 @@ static void GPSVelocityUpdatedCb(UAVObjEvent * ev);
*/
int32_t AirspeedStart()
{
#if defined (NO_AIRSPEED_SENSOR_PRESENT)
return -1;
#endif
//Check if module is enabled or not
if (airspeedEnabled == false) {
return -1;
@ -115,7 +122,6 @@ int32_t AirspeedStart()
// Start main task
xTaskCreate(airspeedTask, (signed char *)"Airspeed", STACK_SIZE_BYTES/4, NULL, TASK_PRIORITY, &taskHandle);
TaskMonitorAdd(TASKINFO_RUNNING_AIRSPEED, taskHandle);
return 0;
}
@ -194,12 +200,12 @@ static void airspeedTask(void *parameters)
portTickType lastSysTime = xTaskGetTickCount();
while (1)
{
float airspeed_tas_baro=0;
// Update the airspeed object
BaroAirspeedGet(&airspeedData);
#ifdef BARO_AIRSPEED_PRESENT
float airspeed_tas_baro=0;
if(airspeedSensorType!=AIRSPEEDSETTINGS_AIRSPEEDSENSORTYPE_GPSONLY){
//Fetch calibrated airspeed from sensors
baro_airspeedGet(&airspeedData, &lastSysTime, airspeedSensorType, airspeedADCPin);

View File

@ -58,7 +58,9 @@
// Private functions
#if defined(PIOS_INCLUDE_ETASV3) || defined(PIOS_INCLUDE_MPXV7002) || defined (PIOS_INCLUDE_MPXV5004)
static uint16_t calibrationCount=0;
#endif
void baro_airspeedGet(BaroAirspeedData *baroAirspeedData, portTickType *lastSysTime, uint8_t airspeedSensorType, int8_t airspeedADCPin){