mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-13 05:57:34 +08:00
create temperature_compensation module
- this is a new module for temperature compensation that consolidates the functionality previously handled in the sensors module (calculating runtime thermal corrections) and the events module (online thermal calibration) - by collecting this functionality into a single module we can optionally disable it on systems where it's not used and save some flash (if disabled at build time) or memory (disabled at run time)
This commit is contained in:
@@ -100,7 +100,7 @@ WorkItem::average_rate() const
|
||||
{
|
||||
const float rate = _run_count / elapsed_time();
|
||||
|
||||
if (PX4_ISFINITE(rate)) {
|
||||
if ((_run_count > 0) && PX4_ISFINITE(rate)) {
|
||||
return rate;
|
||||
}
|
||||
|
||||
@@ -110,9 +110,10 @@ WorkItem::average_rate() const
|
||||
float
|
||||
WorkItem::average_interval() const
|
||||
{
|
||||
const float interval = 1000000.0f / average_rate();
|
||||
const float rate = average_rate();
|
||||
const float interval = 1000000.0f / rate;
|
||||
|
||||
if (PX4_ISFINITE(interval)) {
|
||||
if ((rate > 0.0f) && PX4_ISFINITE(interval)) {
|
||||
return interval;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user