AP_NavEKF2: Make setter loop through all instances

For setters where a success boolean is returned, return false if any instance fails.
This commit is contained in:
Paul Riseborough 2016-06-09 09:06:39 +10:00 committed by Andrew Tridgell
parent 8baf064317
commit 262c5fe56d

View File

@ -704,7 +704,9 @@ void NavEKF2::getTiltError(int8_t instance, float &ang)
void NavEKF2::resetGyroBias(void) void NavEKF2::resetGyroBias(void)
{ {
if (core) { if (core) {
core[primary].resetGyroBias(); for (uint8_t i=0; i<num_cores; i++) {
core[i].resetGyroBias();
}
} }
} }
@ -715,10 +717,17 @@ void NavEKF2::resetGyroBias(void)
// If using a range finder for height no reset is performed and it returns false // If using a range finder for height no reset is performed and it returns false
bool NavEKF2::resetHeightDatum(void) bool NavEKF2::resetHeightDatum(void)
{ {
if (!core) { bool status = true;
return false; if (core) {
for (uint8_t i=0; i<num_cores; i++) {
if (!core[i].resetHeightDatum()) {
status = false;
}
}
} else {
status = false;
} }
return core[primary].resetHeightDatum(); return status;
} }
// Commands the EKF to not use GPS. // Commands the EKF to not use GPS.