mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-12-11 19:24:10 +01:00
Change how the updated settings in attitude are changed to make it easier to
initialize them all
This commit is contained in:
parent
3f4706ad4c
commit
02dfa7bd82
@ -203,10 +203,7 @@ static void AttitudeTask(void *parameters)
|
|||||||
AlarmsClear(SYSTEMALARMS_ALARM_ATTITUDE);
|
AlarmsClear(SYSTEMALARMS_ALARM_ATTITUDE);
|
||||||
|
|
||||||
// Force settings update to make sure rotation loaded
|
// Force settings update to make sure rotation loaded
|
||||||
settingsUpdatedCb(AttitudeSettingsHandle());
|
settingsUpdatedCb(NULL);
|
||||||
settingsUpdatedCb(RevoSettingsHandle());
|
|
||||||
settingsUpdatedCb(RevoCalibrationHandle());
|
|
||||||
settingsUpdatedCb(HomeLocationHandle());
|
|
||||||
|
|
||||||
// Wait for all the sensors be to read
|
// Wait for all the sensors be to read
|
||||||
vTaskDelay(100);
|
vTaskDelay(100);
|
||||||
@ -857,16 +854,15 @@ static int32_t getNED(GPSPositionData * gpsPosition, float * NED)
|
|||||||
|
|
||||||
static void settingsUpdatedCb(UAVObjEvent * ev)
|
static void settingsUpdatedCb(UAVObjEvent * ev)
|
||||||
{
|
{
|
||||||
// If the object updated was the ObjectPersistence execute requested action
|
if (ev == NULL || ev->obj == RevoCalibrationHandle()) {
|
||||||
if (ev->obj == RevoCalibrationHandle()) {
|
|
||||||
RevoCalibrationGet(&revoCalibration);
|
RevoCalibrationGet(&revoCalibration);
|
||||||
|
|
||||||
/* When the revo calibration is updated, update the GyroBias object */
|
/* When the revo calibration is updated, update the GyroBias object */
|
||||||
GyrosBiasData gyrosBias;
|
GyrosBiasData gyrosBias;
|
||||||
GyrosBiasGet(&gyrosBias);
|
GyrosBiasGet(&gyrosBias);
|
||||||
gyrosBias.x = revoCalibration.gyro_bias[REVOCALIBRATION_GYRO_BIAS_X];
|
gyrosBias.x = revoCalibration.gyro_bias[REVOCALIBRATION_GYRO_BIAS_X];
|
||||||
gyrosBias.y = revoCalibration.gyro_bias[REVOCALIBRATION_GYRO_BIAS_X];
|
gyrosBias.y = revoCalibration.gyro_bias[REVOCALIBRATION_GYRO_BIAS_Y];
|
||||||
gyrosBias.z = revoCalibration.gyro_bias[REVOCALIBRATION_GYRO_BIAS_X];
|
gyrosBias.z = revoCalibration.gyro_bias[REVOCALIBRATION_GYRO_BIAS_Z];
|
||||||
GyrosBiasSet(&gyrosBias);
|
GyrosBiasSet(&gyrosBias);
|
||||||
|
|
||||||
gyroBiasSettingsUpdated = true;
|
gyroBiasSettingsUpdated = true;
|
||||||
@ -876,9 +872,9 @@ static void settingsUpdatedCb(UAVObjEvent * ev)
|
|||||||
INSSetAccelVar(revoCalibration.accel_var);
|
INSSetAccelVar(revoCalibration.accel_var);
|
||||||
INSSetGyroVar(revoCalibration.gyro_var);
|
INSSetGyroVar(revoCalibration.gyro_var);
|
||||||
INSSetBaroVar(revoCalibration.baro_var);
|
INSSetBaroVar(revoCalibration.baro_var);
|
||||||
} else if (ev->obj == HomeLocationHandle()) {
|
}
|
||||||
|
if(ev == NULL || ev->obj == HomeLocationHandle()) {
|
||||||
HomeLocationGet(&homeLocation);
|
HomeLocationGet(&homeLocation);
|
||||||
|
|
||||||
// Compute matrix to convert deltaLLA to NED
|
// Compute matrix to convert deltaLLA to NED
|
||||||
float lat, alt;
|
float lat, alt;
|
||||||
lat = homeLocation.Latitude / 10.0e6f * DEG2RAD;
|
lat = homeLocation.Latitude / 10.0e6f * DEG2RAD;
|
||||||
@ -887,11 +883,11 @@ static void settingsUpdatedCb(UAVObjEvent * ev)
|
|||||||
T[0] = alt+6.378137E6f;
|
T[0] = alt+6.378137E6f;
|
||||||
T[1] = cosf(lat)*(alt+6.378137E6f);
|
T[1] = cosf(lat)*(alt+6.378137E6f);
|
||||||
T[2] = -1.0f;
|
T[2] = -1.0f;
|
||||||
} else if (ev->obj == AttitudeSettingsHandle()) {
|
|
||||||
AttitudeSettingsGet(&attitudeSettings);
|
|
||||||
} else if (ev->obj == RevoSettingsHandle()) {
|
|
||||||
RevoSettingsGet(&revoSettings);
|
|
||||||
}
|
}
|
||||||
|
if (ev == NULL || ev->obj == AttitudeSettingsHandle())
|
||||||
|
AttitudeSettingsGet(&attitudeSettings);
|
||||||
|
if (ev == NULL || ev->obj == RevoSettingsHandle())
|
||||||
|
RevoSettingsGet(&revoSettings);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
|
Loading…
Reference in New Issue
Block a user