Skip to content

Commit

Permalink
AP_ExternalAHRS: Check backend pre-arm before origin
Browse files Browse the repository at this point in the history
* This allows the backend to report more detailed errors
* Before this, many pre-arm errors were hidden by origin failure
* If pre-arm could report multiple errors, that would be ideal

Signed-off-by: Ryan Friedman <[email protected]>
  • Loading branch information
Ryanf55 committed Mar 25, 2024
1 parent 17d3010 commit df6ee02
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions libraries/AP_ExternalAHRS/AP_ExternalAHRS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,11 +235,13 @@ bool AP_ExternalAHRS::pre_arm_check(char *failure_msg, uint8_t failure_msg_len)
hal.util->snprintf(failure_msg, failure_msg_len, "ExternalAHRS: Invalid backend");
return false;
}

if (!backend->pre_arm_check(failure_msg, failure_msg_len) {
return false;
if (!state.have_origin) {
hal.util->snprintf(failure_msg, failure_msg_len, "ExternalAHRS: No origin");
return false;
}
return backend->pre_arm_check(failure_msg, failure_msg_len);
return true;
}

/*
Expand Down

0 comments on commit df6ee02

Please sign in to comment.