AP_NavEKF_Source: optimise configured_in_storage

This small CPU optimisation takes advantage of the fact that once configured in storage is true it will always remain true
This commit is contained in:
Randy Mackay 2020-11-23 10:27:46 +09:00 committed by Andrew Tridgell
parent bce4fd43a3
commit 6c3948f417
2 changed files with 10 additions and 3 deletions

View File

@ -293,10 +293,16 @@ bool AP_NavEKF_Source::usingGPS() const
}
// true if some parameters have been configured (used during parameter conversion)
bool AP_NavEKF_Source::configured_in_storage() const
bool AP_NavEKF_Source::configured_in_storage()
{
if (config_in_storage) {
return true;
}
// first source parameter is used to determine if configured or not
return _source_set[0].posxy.configured_in_storage();
config_in_storage = _source_set[0].posxy.configured_in_storage();
return config_in_storage;
}
// mark parameters as configured in storage (used to ensure parameter conversion is only done once)

View File

@ -83,7 +83,7 @@ public:
bool usingGPS() const;
// true if source parameters have been configured (used for parameter conversion)
bool configured_in_storage() const;
bool configured_in_storage();
// mark parameters as configured in storage (used to ensure parameter conversion is only done once)
void mark_configured_in_storage();
@ -115,4 +115,5 @@ private:
SourceYaw yaw; // current yaw source
} _active_source_set;
bool initialised; // true once init has been run
bool config_in_storage; // true once configured in storage has returned true
};