mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-22 09:17:34 +08:00
temperature_compensation: make sure to reset temperature when params change
Makes sure that the offsets & scales are updated and published later on.
This commit is contained in:
@@ -239,6 +239,13 @@ int TemperatureCompensation::parameters_update()
|
||||
}
|
||||
}
|
||||
|
||||
/* the offsets & scales might have changed, so make sure to report that change later when applying the
|
||||
* next corrections
|
||||
*/
|
||||
_gyro_data.reset_temperature();
|
||||
_accel_data.reset_temperature();
|
||||
_baro_data.reset_temperature();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -254,6 +254,10 @@ private:
|
||||
{
|
||||
for (int i = 0; i < SENSOR_COUNT_MAX; ++i) { device_mapping[i] = 255; last_temperature[i] = -100.0f; }
|
||||
}
|
||||
void reset_temperature()
|
||||
{
|
||||
for (int i = 0; i < SENSOR_COUNT_MAX; ++i) { last_temperature[i] = -100.0f; }
|
||||
}
|
||||
uint8_t device_mapping[SENSOR_COUNT_MAX]; /// map a topic instance to the parameters index
|
||||
float last_temperature[SENSOR_COUNT_MAX];
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user