Skip to content

Commit

Permalink
AP_Arming: add reset_all_aux_auths
Browse files Browse the repository at this point in the history
  • Loading branch information
robertlong13 authored and tridge committed Feb 25, 2025
1 parent 71be119 commit 7b3a643
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
21 changes: 21 additions & 0 deletions libraries/AP_Arming/AP_Arming.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1464,6 +1464,27 @@ void AP_Arming::set_aux_auth_failed(uint8_t auth_id, const char* fail_msg)
}
}

void AP_Arming::reset_all_aux_auths()
{
WITH_SEMAPHORE(aux_auth_sem);

// clear all auxiliary authorisation ids
aux_auth_count = 0;
// clear any previous allocation errors
aux_auth_error = false;

// reset states for all auxiliary authorisation ids
for (uint8_t i = 0; i < aux_auth_count_max; i++) {
aux_auth_state[i] = AuxAuthStates::NO_RESPONSE;
}

// free up the failure message buffer
if (aux_auth_fail_msg != nullptr) {
free(aux_auth_fail_msg);
aux_auth_fail_msg = nullptr;
}
}

bool AP_Arming::aux_auth_checks(bool display_failure)
{
// handle error cases
Expand Down
1 change: 1 addition & 0 deletions libraries/AP_Arming/AP_Arming.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ class AP_Arming {
bool get_aux_auth_id(uint8_t& auth_id);
void set_aux_auth_passed(uint8_t auth_id);
void set_aux_auth_failed(uint8_t auth_id, const char* fail_msg);
void reset_all_aux_auths();
#endif

static const struct AP_Param::GroupInfo var_info[];
Expand Down

0 comments on commit 7b3a643

Please sign in to comment.