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:
Beat Küng
2017-01-25 14:57:00 +01:00
committed by Lorenz Meier
parent fdb75dbba2
commit 75be1abc4c
2 changed files with 11 additions and 0 deletions
@@ -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];
};