Browse Source

AP_InertialSensor: save only gyro calibration

When we are initializing the gyro and then saving the calibration we are
also saving the calibration values for the accelerometers. Right now
this is non-problematic, but we want to check that the ID of the
accelerometer corresponds to the ID of the sensor detected. If we also
save accel calibrations we would actually override the ID of the
accelerometer.

Rename the method to _save_gyro_calibration() and save only on gyro
values.
master
Lucas De Marchi 9 years ago committed by Andrew Tridgell
parent
commit
bbb9bfa95e
  1. 6
      libraries/AP_InertialSensor/AP_InertialSensor.cpp
  2. 4
      libraries/AP_InertialSensor/AP_InertialSensor.h

6
libraries/AP_InertialSensor/AP_InertialSensor.cpp

@ -683,7 +683,7 @@ AP_InertialSensor::init_gyro() @@ -683,7 +683,7 @@ AP_InertialSensor::init_gyro()
_init_gyro();
// save calibration
_save_parameters();
_save_gyro_calibration();
}
// accelerometer clipping reporting
@ -986,11 +986,9 @@ AP_InertialSensor::_init_gyro() @@ -986,11 +986,9 @@ AP_InertialSensor::_init_gyro()
}
// save parameters to eeprom
void AP_InertialSensor::_save_parameters()
void AP_InertialSensor::_save_gyro_calibration()
{
for (uint8_t i=0; i<INS_MAX_INSTANCES; i++) {
_accel_scale[i].save();
_accel_offset[i].save();
_gyro_offset[i].save();
}
}

4
libraries/AP_InertialSensor/AP_InertialSensor.h

@ -272,8 +272,8 @@ private: @@ -272,8 +272,8 @@ private:
bool _calculate_trim(const Vector3f &accel_sample, float& trim_roll, float& trim_pitch);
// save parameters to eeprom
void _save_parameters();
// save gyro calibration values to eeprom
void _save_gyro_calibration();
// backend objects
AP_InertialSensor_Backend *_backends[INS_MAX_BACKENDS];

Loading…
Cancel
Save