From cc46ab3092063a708d13c1229a7ad8132ce687b3 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Mon, 25 Jun 2018 15:26:41 +1000 Subject: [PATCH] Sub: use singletons in AP_Arming --- ArduSub/AP_Arming_Sub.cpp | 6 +++--- ArduSub/AP_Arming_Sub.h | 7 ++----- ArduSub/Sub.h | 2 +- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/ArduSub/AP_Arming_Sub.cpp b/ArduSub/AP_Arming_Sub.cpp index a48501e5df..e6ae6f07b0 100644 --- a/ArduSub/AP_Arming_Sub.cpp +++ b/ArduSub/AP_Arming_Sub.cpp @@ -28,11 +28,11 @@ bool AP_Arming_Sub::ins_checks(bool display_failure) return false; } - // additional plane specific checks + // additional sub-specific checks if ((checks_to_perform & ARMING_CHECK_ALL) || (checks_to_perform & ARMING_CHECK_INS)) { - if (!ahrs.healthy()) { - const char *reason = ahrs.prearm_failure_reason(); + if (!AP::ahrs().healthy()) { + const char *reason = AP::ahrs().prearm_failure_reason(); if (reason == nullptr) { reason = "AHRS not healthy"; } diff --git a/ArduSub/AP_Arming_Sub.h b/ArduSub/AP_Arming_Sub.h index ba7053ee3e..f2d17fc2fb 100644 --- a/ArduSub/AP_Arming_Sub.h +++ b/ArduSub/AP_Arming_Sub.h @@ -4,11 +4,8 @@ class AP_Arming_Sub : public AP_Arming { public: - AP_Arming_Sub(const AP_AHRS &ahrs_ref, Compass &compass, - const AP_BattMonitor &battery) - : AP_Arming(ahrs_ref, compass, battery) - { - } + + AP_Arming_Sub() : AP_Arming() { } /* Do not allow copies */ AP_Arming_Sub(const AP_Arming_Sub &other) = delete; diff --git a/ArduSub/Sub.h b/ArduSub/Sub.h index 961e19d8ce..622d9c749b 100644 --- a/ArduSub/Sub.h +++ b/ArduSub/Sub.h @@ -333,7 +333,7 @@ private: FUNCTOR_BIND_MEMBER(&Sub::handle_battery_failsafe, void, const char*, const int8_t), _failsafe_priorities}; - AP_Arming_Sub arming{ahrs, compass, battery}; + AP_Arming_Sub arming; // Altitude // The cm/s we are moving up or down based on filtered data - Positive = UP