sensor calibration: save temperature at calibration time for monitoring

This commit is contained in:
Daniel Agar
2021-04-01 11:24:53 -04:00
parent a76bcd3e01
commit ff39e27e2d
29 changed files with 295 additions and 41 deletions
@@ -47,6 +47,11 @@ TemperatureCompensationModule::TemperatureCompensationModule() :
ScheduledWorkItem(MODULE_NAME, px4::wq_configurations::lp_default),
_loop_perf(perf_alloc(PC_ELAPSED, "temperature_compensation"))
{
for (int i = 0; i < SENSOR_COUNT_MAX; i++) {
_corrections.accel_temperature[i] = NAN;
_corrections.gyro_temperature[i] = NAN;
_corrections.baro_temperature[i] = NAN;
}
}
TemperatureCompensationModule::~TemperatureCompensationModule()
@@ -128,6 +133,7 @@ void TemperatureCompensationModule::accelPoll()
if (_temperature_compensation.update_offsets_accel(uorb_index, report.temperature, offsets[uorb_index]) == 2) {
_corrections.accel_device_ids[uorb_index] = report.device_id;
_corrections.accel_temperature[uorb_index] = report.temperature;
_corrections_changed = true;
}
}
@@ -150,6 +156,7 @@ void TemperatureCompensationModule::gyroPoll()
if (_temperature_compensation.update_offsets_gyro(uorb_index, report.temperature, offsets[uorb_index]) == 2) {
_corrections.gyro_device_ids[uorb_index] = report.device_id;
_corrections.gyro_temperature[uorb_index] = report.temperature;
_corrections_changed = true;
}
}
@@ -172,6 +179,7 @@ void TemperatureCompensationModule::baroPoll()
if (_temperature_compensation.update_offsets_baro(uorb_index, report.temperature, offsets[uorb_index]) == 2) {
_corrections.baro_device_ids[uorb_index] = report.device_id;
_corrections.baro_temperature[uorb_index] = report.temperature;
_corrections_changed = true;
}
}