diff --git a/flight/Modules/Airspeed/revolution/airspeed.c b/flight/Modules/Airspeed/revolution/airspeed.c index d500e449e..9273fc871 100644 --- a/flight/Modules/Airspeed/revolution/airspeed.c +++ b/flight/Modules/Airspeed/revolution/airspeed.c @@ -50,7 +50,7 @@ #define SAMPLING_DELAY_MS 50 #define CALIBRATION_IDLE 40 #define CALIBRATION_COUNT 40 -#define ETS_AIRSPEED_SCALE 1.8f +#define ETS_AIRSPEED_SCALE 1.0f // Private types @@ -116,8 +116,6 @@ static void airspeedTask(void *parameters) uint8_t calibrationCount = 0; uint32_t calibrationSum = 0; - uint16_t calibrationMin = 0; - uint16_t calibrationMax = 0; // Main task loop while (1) @@ -135,19 +133,12 @@ static void airspeedTask(void *parameters) } if (calibrationCountcalibrationMax) - calibrationMax = data.SensorValue; calibrationCount++; calibrationSum += data.SensorValue; if (calibrationCount==CALIBRATION_IDLE+CALIBRATION_COUNT) { data.ZeroPoint = calibrationSum / CALIBRATION_COUNT; - data.ZeroZone = (calibrationMax - calibrationMin) / 2; } else { continue; } @@ -155,13 +146,7 @@ static void airspeedTask(void *parameters) data.Connected = BAROAIRSPEED_CONNECTED_TRUE; - int16_t tmp = abs(data.SensorValue - data.ZeroPoint) - data.ZeroZone; - - if (tmp>0) { - data.Airspeed = ETS_AIRSPEED_SCALE * sqrtf((float)tmp); - } else { - data.Airspeed = 0; - } + data.Airspeed = ETS_AIRSPEED_SCALE * sqrtf((float)abs(data.SensorValue - data.ZeroPoint)); // Update the AirspeedActual UAVObject BaroAirspeedSet(&data); diff --git a/shared/uavobjectdefinition/baroairspeed.xml b/shared/uavobjectdefinition/baroairspeed.xml index ea6ecfda8..1566b89ce 100644 --- a/shared/uavobjectdefinition/baroairspeed.xml +++ b/shared/uavobjectdefinition/baroairspeed.xml @@ -4,7 +4,6 @@ -