mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-27 16:54:15 +01:00
AeroSimRC: do not update sensor and/or attitude data if read-only flag is set
This commit is contained in:
parent
a3906aa7ea
commit
910b465ac6
@ -234,17 +234,21 @@ static void AttitudeTask(void *parameters)
|
||||
|
||||
AccelsData accels;
|
||||
GyrosData gyros;
|
||||
int32_t retval;
|
||||
if(cc3d)
|
||||
int32_t retval = 0;
|
||||
|
||||
if (cc3d)
|
||||
retval = updateSensorsCC3D(&accels, &gyros);
|
||||
else
|
||||
retval = updateSensors(&accels, &gyros);
|
||||
|
||||
if(retval != 0)
|
||||
// Only update attitude when sensor data is good
|
||||
if (retval != 0)
|
||||
AlarmsSet(SYSTEMALARMS_ALARM_ATTITUDE, SYSTEMALARMS_ALARM_ERROR);
|
||||
else {
|
||||
// Only update attitude when sensor data is good
|
||||
updateAttitude(&accels, &gyros);
|
||||
// Do not update attitude data in simulation mode
|
||||
if (!AttitudeActualReadOnly())
|
||||
updateAttitude(&accels, &gyros);
|
||||
|
||||
AlarmsClear(SYSTEMALARMS_ALARM_ATTITUDE);
|
||||
}
|
||||
}
|
||||
@ -268,8 +272,8 @@ static int32_t updateSensors(AccelsData * accels, GyrosData * gyros)
|
||||
return -1;
|
||||
}
|
||||
|
||||
// for simulation
|
||||
if (AttitudeRawReadOnly() == ACCESS_READONLY)
|
||||
// Do not read raw sensor data in simulation mode
|
||||
if (GyrosReadOnly() || AccelsReadOnly())
|
||||
return 0;
|
||||
|
||||
// No accel data available
|
||||
@ -420,10 +424,6 @@ static int32_t updateSensorsCC3D(AccelsData * accelsData, GyrosData * gyrosData)
|
||||
|
||||
static void updateAttitude(AccelsData * accelsData, GyrosData * gyrosData)
|
||||
{
|
||||
// for simulation
|
||||
if (AttitudeActualReadOnly() == ACCESS_READONLY)
|
||||
return;
|
||||
|
||||
float dT;
|
||||
portTickType thisSysTime = xTaskGetTickCount();
|
||||
static portTickType lastSysTime = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user