Skip to content

Commit

Permalink
AP_Arming: Record arming time and add accessor for it
Browse files Browse the repository at this point in the history
  • Loading branch information
nexton-winjeel committed Aug 4, 2024
1 parent 9543eec commit b7e8c0d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions libraries/AP_Arming/AP_Arming.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1750,6 +1750,7 @@ bool AP_Arming::arm(AP_Arming::Method method, const bool do_arming_checks)

if ((!do_arming_checks && mandatory_checks(true)) || (pre_arm_checks(true) && arm_checks(method))) {
armed = true;
last_arm_time_us = AP_HAL::micros64();

_last_arm_method = method;

Expand Down
5 changes: 5 additions & 0 deletions libraries/AP_Arming/AP_Arming.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ class AP_Arming {
bool is_armed() const;
bool is_armed_and_safety_off() const;

// Returns the time since boot (in microseconds) that we armed. Returns 0 if disarmed.
uint64_t arm_time_us() const { return is_armed() ? last_arm_time_us : 0; }

// get bitmask of enabled checks
uint32_t get_enabled_checks() const;

Expand Down Expand Up @@ -309,6 +312,8 @@ class AP_Arming {
Method _last_disarm_method = Method::UNKNOWN;
Method _last_arm_method = Method::UNKNOWN;

uint64_t last_arm_time_us; // last time we successfully armed

uint32_t last_prearm_display_ms; // last time we send statustexts for prearm failures
bool running_arming_checks; // true if the arming checks currently being performed are being done because the vehicle is trying to arm the vehicle

Expand Down

0 comments on commit b7e8c0d

Please sign in to comment.