atune: initialize filter if not already initialized

This commit is contained in:
bresch 2023-11-16 17:31:33 +01:00 committed by Mathieu Bresciani
parent c3ed50488f
commit 9ab8970206
2 changed files with 2 additions and 2 deletions

View File

@ -225,7 +225,7 @@ void FwAutotuneAttitudeControl::checkFilters()
reset_filters = true;
}
if (reset_filters) {
if (reset_filters || !_are_filters_initialized) {
_are_filters_initialized = true;
_filter_sample_rate = update_rate_hz;
_sys_id.setLpfCutoffFrequency(_filter_sample_rate, _param_imu_gyro_cutoff.get());

View File

@ -236,7 +236,7 @@ void McAutotuneAttitudeControl::checkFilters()
reset_filters = true;
}
if (reset_filters && !_are_filters_initialized) {
if (reset_filters || !_are_filters_initialized) {
_filter_dt = _sample_interval_avg;
const float filter_rate_hz = 1.f / _filter_dt;