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

Airspeed: some more fixes

This commit is contained in:
Corvus Corax 2012-04-17 16:38:53 +02:00
parent c5a6ed7486
commit edf26d15e6
3 changed files with 8 additions and 19 deletions

View File

@ -37,6 +37,7 @@
*/
#include "openpilot.h"
#include "hwsettings.h"
#include "airspeed.h"
#include "baroairspeed.h" // object that will be updated by the module
#if defined(PIOS_INCLUDE_HCSR04)
@ -46,6 +47,7 @@
// Private constants
#define STACK_SIZE_BYTES 500
#define TASK_PRIORITY (tskIDLE_PRIORITY+1)
#define SENSITIVE_DELAY_MS 500
// Private types
@ -114,25 +116,13 @@ static void airspeedTask(void *parameters)
// Main task loop
while (1)
{
float temp, press;
float airspeed;
// Update the temperature data
PIOS_MS5611_StartADC(TemperatureConv);
vTaskDelay(PIOS_MS5611_GetDelay());
PIOS_MS5611_ReadADC();
// Update the airspeed
vTaskDelay(SENSITIVE_DELAY_MS);
airspeed = PIOS_ETASV3_ReadAirspeed();
// Update the pressure data
PIOS_MS5611_StartADC(PressureConv);
vTaskDelay(PIOS_MS5611_GetDelay());
PIOS_MS5611_ReadADC();
temp = PIOS_MS5611_GetTemperature();
press = PIOS_MS5611_GetPressure();
data.Temperature = temp;
data.Pressure = press;
data.Airspeed = 44330.0f * (1.0f - powf(data.Pressure / MS5611_P0, (1.0f / 5.255f)));
data.Airspeed = airspeed;
// Update the AirspeedActual UAVObject
BaroAirspeedSet(&data);

View File

@ -51,6 +51,7 @@ FLASH_TOOL = OPENOCD
# List of modules to include
MODULES = Sensors Attitude/revolution ManualControl Stabilization Altitude/revolution Actuator GPS FirmwareIAP
MODULES += AltitudeHold
MODULES += Airspeed/revolution
MODULES += CameraStab
MODULES += Telemetry
#MODULES += OveroSync

View File

@ -2,8 +2,6 @@
<object name="BaroAirspeed" singleinstance="true" settings="false">
<description>The raw data from the dynamic pressure sensor with pressure, temperature and airspeed.</description>
<field name="Airspeed" units="m/s" type="float" elements="1"/>
<field name="Temperature" units="C" type="float" elements="1"/>
<field name="Pressure" units="kPa" type="float" elements="1"/>
<access gcs="readwrite" flight="readwrite"/>
<telemetrygcs acked="false" updatemode="manual" period="0"/>
<telemetryflight acked="false" updatemode="periodic" period="1000"/>