From a52f04dddec4547aa6a5235368592ec28f5ed4eb Mon Sep 17 00:00:00 2001 From: Siddharth Purohit Date: Thu, 20 May 2021 21:37:51 +0530 Subject: [PATCH] AP_DAL: add interface for first usable compass --- libraries/AP_DAL/AP_DAL_Compass.cpp | 1 + libraries/AP_DAL/AP_DAL_Compass.h | 3 +++ libraries/AP_DAL/LogStructure.h | 3 ++- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/libraries/AP_DAL/AP_DAL_Compass.cpp b/libraries/AP_DAL/AP_DAL_Compass.cpp index fd809cbceb..3dfa6a0b6f 100644 --- a/libraries/AP_DAL/AP_DAL_Compass.cpp +++ b/libraries/AP_DAL/AP_DAL_Compass.cpp @@ -22,6 +22,7 @@ void AP_DAL_Compass::start_frame() _RMGH.declination = compass.get_declination(); _RMGH.num_enabled = compass.get_num_enabled(); _RMGH.consistent = compass.consistent(); + _RMGH.first_usable = compass.get_first_usable(); WRITE_REPLAY_BLOCK_IFCHANGED(RMGH, _RMGH, old); diff --git a/libraries/AP_DAL/AP_DAL_Compass.h b/libraries/AP_DAL/AP_DAL_Compass.h index ffd2830c78..b7ee867c95 100644 --- a/libraries/AP_DAL/AP_DAL_Compass.h +++ b/libraries/AP_DAL/AP_DAL_Compass.h @@ -53,6 +53,9 @@ public: // check if the compasses are pointing in the same direction bool consistent() const { return _RMGH.consistent; } + // returns first usable compass + uint8_t get_first_usable() const { return _RMGH.first_usable; } + // AP_DAL methods: AP_DAL_Compass(); diff --git a/libraries/AP_DAL/LogStructure.h b/libraries/AP_DAL/LogStructure.h index fe57c25ef4..360881c845 100644 --- a/libraries/AP_DAL/LogStructure.h +++ b/libraries/AP_DAL/LogStructure.h @@ -244,6 +244,7 @@ struct log_RMGH { uint8_t num_enabled; bool learn_offsets_enabled; bool consistent; + uint8_t first_usable; uint8_t _end; }; @@ -400,7 +401,7 @@ struct log_RBOH { { LOG_RGPJ_MSG, RLOG_SIZE(RGPJ), \ "RGPJ", "IffffffiiiffHB", "TS,VX,VY,VZ,SA,Y,YA,Lat,Lon,Alt,HA,VA,HD,I", "-------------#", "--------------" }, \ { LOG_RMGH_MSG, RLOG_SIZE(RMGH), \ - "RMGH", "BBfBBB", "Dec,NumInst,AutoDec,NumEna,LOE,C", "------", "------" }, \ + "RMGH", "BBfBBBB", "Dec,NumInst,AutoDec,NumEna,LOE,C,FUsable", "-------", "-------" }, \ { LOG_RMGI_MSG, RLOG_SIZE(RMGI), \ "RMGI", "IffffffBBBB", "LU,OX,OY,OZ,FX,FY,FZ,UFY,H,HSF,I", "----------#", "-----------" }, \ { LOG_RBCH_MSG, RLOG_SIZE(RBCH), \