From 21527544f9e8e7c1b293de9dc2fc14fdf5776bff Mon Sep 17 00:00:00 2001 From: Kenz Dale Date: Mon, 23 Jul 2012 14:06:44 +0200 Subject: [PATCH] Fixed compile-time bugs in the case where airspeed module is compiled, but no drivers are present in pios_config. --- flight/Modules/Airspeed/revolution/airspeed.c | 12 +++++++++--- flight/Modules/Airspeed/revolution/baro_airspeed.c | 2 ++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/flight/Modules/Airspeed/revolution/airspeed.c b/flight/Modules/Airspeed/revolution/airspeed.c index 0f41e54df..f478bba12 100644 --- a/flight/Modules/Airspeed/revolution/airspeed.c +++ b/flight/Modules/Airspeed/revolution/airspeed.c @@ -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); diff --git a/flight/Modules/Airspeed/revolution/baro_airspeed.c b/flight/Modules/Airspeed/revolution/baro_airspeed.c index 187008a95..0631833e5 100644 --- a/flight/Modules/Airspeed/revolution/baro_airspeed.c +++ b/flight/Modules/Airspeed/revolution/baro_airspeed.c @@ -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){