From 5d686b9cb1cca949037f995f7305a2327c806d06 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Fri, 5 Feb 2021 13:28:07 +1100 Subject: [PATCH] AP_AdvancedFailsafe: move handling of last-seen-SYSID_MYGCS up to GCS base class --- libraries/AP_AdvancedFailsafe/AP_AdvancedFailsafe.cpp | 3 ++- libraries/AP_AdvancedFailsafe/AP_AdvancedFailsafe.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/libraries/AP_AdvancedFailsafe/AP_AdvancedFailsafe.cpp b/libraries/AP_AdvancedFailsafe/AP_AdvancedFailsafe.cpp index 6eba34e127..9ca764dada 100644 --- a/libraries/AP_AdvancedFailsafe/AP_AdvancedFailsafe.cpp +++ b/libraries/AP_AdvancedFailsafe/AP_AdvancedFailsafe.cpp @@ -164,7 +164,7 @@ const AP_Param::GroupInfo AP_AdvancedFailsafe::var_info[] = { // check for Failsafe conditions. This is called at 10Hz by the main // ArduPlane code void -AP_AdvancedFailsafe::check(uint32_t last_heartbeat_ms, bool geofence_breached, uint32_t last_valid_rc_ms) +AP_AdvancedFailsafe::check(bool geofence_breached, uint32_t last_valid_rc_ms) { if (!_enable) { return; @@ -203,6 +203,7 @@ AP_AdvancedFailsafe::check(uint32_t last_heartbeat_ms, bool geofence_breached, u hal.gpio->write(_manual_pin, mode==AFS_MANUAL); } + const uint32_t last_heartbeat_ms = gcs().sysid_myggcs_last_seen_time_ms(); uint32_t now = AP_HAL::millis(); bool gcs_link_ok = ((now - last_heartbeat_ms) < 10000); bool gps_lock_ok = ((now - AP::gps().last_fix_time_ms()) < 3000); diff --git a/libraries/AP_AdvancedFailsafe/AP_AdvancedFailsafe.h b/libraries/AP_AdvancedFailsafe/AP_AdvancedFailsafe.h index 282c1e2bd4..499b2edb74 100644 --- a/libraries/AP_AdvancedFailsafe/AP_AdvancedFailsafe.h +++ b/libraries/AP_AdvancedFailsafe/AP_AdvancedFailsafe.h @@ -75,7 +75,7 @@ public: bool enabled() { return _enable; } // check that everything is OK - void check(uint32_t last_heartbeat_ms, bool geofence_breached, uint32_t last_valid_rc_ms); + void check(bool geofence_breached, uint32_t last_valid_rc_ms); // generate heartbeat msgs, so external failsafe boards are happy // during sensor calibration