1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-29 14:52:12 +01:00

OP-1329 set SensorConnected to false when sensorType is changed to none.

This commit is contained in:
Alessio Morale 2014-05-08 19:48:30 +02:00
parent 516f359645
commit 08dcdefc1f

View File

@ -157,13 +157,11 @@ static void airspeedTask(__attribute__((unused)) void *parameters)
if (airspeedSettings.AirspeedSensorType != lastAirspeedSensorType) { if (airspeedSettings.AirspeedSensorType != lastAirspeedSensorType) {
AlarmsSet(SYSTEMALARMS_ALARM_AIRSPEED, SYSTEMALARMS_ALARM_DEFAULT); AlarmsSet(SYSTEMALARMS_ALARM_AIRSPEED, SYSTEMALARMS_ALARM_DEFAULT);
lastAirspeedSensorType = airspeedSettings.AirspeedSensorType; lastAirspeedSensorType = airspeedSettings.AirspeedSensorType;
if (airspeedSettings.AirspeedSensorType == AIRSPEEDSETTINGS_AIRSPEEDSENSORTYPE_NONE) {
airspeedData.SensorConnected = AIRSPEEDSENSOR_SENSORCONNECTED_FALSE;
AirspeedSensorSet(&airspeedData);
}
} }
if(airspeedSettings.AirspeedSensorType == AIRSPEEDSETTINGS_AIRSPEEDSENSORTYPE_NONE){
// no need to check so often until a sensor is enabled
AlarmsSet(SYSTEMALARMS_ALARM_AIRSPEED, SYSTEMALARMS_ALARM_DEFAULT);
vTaskDelay(5000/ portTICK_RATE_MS);
continue;
}
switch (airspeedSettings.AirspeedSensorType) { switch (airspeedSettings.AirspeedSensorType) {
#if defined(PIOS_INCLUDE_MPXV) #if defined(PIOS_INCLUDE_MPXV)
case AIRSPEEDSETTINGS_AIRSPEEDSENSORTYPE_DIYDRONESMPXV7002: case AIRSPEEDSETTINGS_AIRSPEEDSENSORTYPE_DIYDRONESMPXV7002:
@ -185,13 +183,17 @@ static void airspeedTask(__attribute__((unused)) void *parameters)
break; break;
#endif #endif
case AIRSPEEDSETTINGS_AIRSPEEDSENSORTYPE_GROUNDSPEEDBASEDWINDESTIMATION: case AIRSPEEDSETTINGS_AIRSPEEDSENSORTYPE_GROUNDSPEEDBASEDWINDESTIMATION:
if(!gpsAirspeedInitialized){ if (!gpsAirspeedInitialized) {
gpsAirspeedInitialized = true; gpsAirspeedInitialized = true;
gps_airspeedInitialize(); gps_airspeedInitialize();
} }
gps_airspeedGet(&airspeedData, &airspeedSettings); gps_airspeedGet(&airspeedData, &airspeedSettings);
break; break;
case AIRSPEEDSETTINGS_AIRSPEEDSENSORTYPE_NONE: case AIRSPEEDSETTINGS_AIRSPEEDSENSORTYPE_NONE:
// no need to check so often until a sensor is enabled
AlarmsSet(SYSTEMALARMS_ALARM_AIRSPEED, SYSTEMALARMS_ALARM_DEFAULT);
vTaskDelay(2000 / portTICK_RATE_MS);
continue;
default: default:
airspeedData.SensorConnected = AIRSPEEDSENSOR_SENSORCONNECTED_FALSE; airspeedData.SensorConnected = AIRSPEEDSENSOR_SENSORCONNECTED_FALSE;
break; break;