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:
Daniel Agar
2020-01-20 21:42:42 -05:00
committed by GitHub
parent dedb4e8267
commit dc05ceaad2
87 changed files with 978 additions and 739 deletions
+4 -3
View File
@@ -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;
}