mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-12-01 05:32:58 +08:00
refactor(AlphaFilter): revert back to allowing configuration using seconds (#28884)
* refactor(AlphaFilter): revert back to allowing configuration using seconds I agree having setParameters(uint64_t sample_interval_us, uint64_t time_constant_us) is useful for multiple call sights but the refactor to only allow 64-Bit microseconds timestamps went too far and made the library more error prone and consume more resources. The original mistake of float dt = get_timestamp() - last_timestamp; cannot easily be prevented this way and mixed uint64_t, float use anyways leads to a compile error with the overloaded functions. * [AUTO COMMIT] update EKF change indication See .github/workflows/checks.yml for more details * fix(AlphaFilter): explicitly delete mixing float and unit64_t parameters to improve the compiler error * fix(dt-calculations): consistent static_cast<float>(now) * 1e-6f conversion pattern
This commit is contained in:
1 parent
358d9df81b
commit
9c24803b3f
31 files changed
+151
-159
No files matched your search
@@ -725,7 +725,7 @@ ControlAllocator::get_ice_shedding_output(hrt_abstime now)
|
||||
|
||||
} else {
|
||||
// Square wave output
|
||||
const float elapsed_in_period = fmodf(static_cast<float>(now) / 1_s, period_sec);
|
||||
const float elapsed_in_period = fmodf(static_cast<float>(now) * 1e-6f, period_sec);
|
||||
const float ice_shedding_output = elapsed_in_period < ICE_SHEDDING_ON_SEC ? ICE_SHEDDING_OUTPUT : 0.0f;
|
||||
|
||||
return ice_shedding_output;
|
||||
|
||||
Reference in new issue
Block a user