AP_DAL: add and use compass.available()

Covers both being enabled and initialised
This commit is contained in:
Peter Barker 2021-07-27 15:54:28 +10:00 committed by Peter Barker
parent 658c978c9d
commit 74859095a9
3 changed files with 7 additions and 1 deletions

View File

@ -17,6 +17,7 @@ void AP_DAL_Compass::start_frame()
const auto &compass = AP::compass();
const log_RMGH old = _RMGH;
_RMGH.available = compass.available();
_RMGH.count = compass.get_count();
_RMGH.auto_declination_enabled = compass.auto_declination_enabled();
_RMGH.declination = compass.get_declination();

View File

@ -38,6 +38,10 @@ public:
return _RMGH.declination;
}
bool available() const {
return _RMGH.available;
}
// return the number of enabled sensors
uint8_t get_num_enabled(void) const { return _RMGH.num_enabled; }

View File

@ -240,6 +240,7 @@ struct log_RASI {
// @Description: Replay Data Magnetometer Header
struct log_RMGH {
float declination;
bool available;
uint8_t count;
bool auto_declination_enabled;
uint8_t num_enabled;
@ -402,7 +403,7 @@ struct log_RBOH {
{ LOG_RGPJ_MSG, RLOG_SIZE(RGPJ), \
"RGPJ", "IffffffIiiiffHB", "TS,VX,VY,VZ,SA,Y,YA,YT,Lat,Lon,Alt,HA,VA,HD,I", "--------------#", "---------------" }, \
{ LOG_RMGH_MSG, RLOG_SIZE(RMGH), \
"RMGH", "BBfBBBB", "Dec,NumInst,AutoDec,NumEna,LOE,C,FUsable", "-------", "-------" }, \
"RMGH", "BBBfBBBB", "Dec,Avail,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), \