LCOV - code coverage report
Current view: top level - AP_DAL - AP_DAL_Compass.h (source / functions) Hit Total Coverage
Test: lcov.info Lines: 22 22 100.0 %
Date: 2026-09-09 11:02:08 Functions: 14 14 100.0 %

          Line data    Source code
       1             : #pragma once
       2             : 
       3             : #include <AP_Logger/LogStructure.h>
       4             : 
       5             : #include <AP_Compass/AP_Compass.h>
       6             : 
       7             : class AP_DAL_Compass {
       8             : public:
       9             : 
      10             :     // Compass-like methods:
      11   273301056 :     bool use_for_yaw(uint8_t i) const {
      12   273301056 :         return _RMGI[i].use_for_yaw;
      13             :     }
      14             : 
      15    47855729 :     bool healthy(uint8_t i) const {
      16    47855729 :         return _RMGI[i].healthy;
      17             :     }
      18             : 
      19     3404380 :     const Vector3f &get_offsets(uint8_t i) const {
      20     3404380 :         return _RMGI[i].offsets;
      21             :     }
      22             : 
      23        2292 :     bool have_scale_factor(uint8_t i) const {
      24        2292 :         return _RMGI[i].have_scale_factor;
      25             :     }
      26             : 
      27        2120 :     bool auto_declination_enabled() const {
      28        2120 :         return _RMGH.auto_declination_enabled;
      29             :     }
      30             : 
      31    24778926 :     uint8_t get_count() const {
      32    24778926 :         return _RMGH.count;
      33             :     }
      34             : 
      35      294962 :     float get_declination() const {
      36      294962 :         return _RMGH.declination;
      37             :     }
      38             : 
      39    24013418 :     bool available() const {
      40    24013418 :         return _RMGH.available;
      41             :     }
      42             : 
      43             :     // return the number of enabled sensors
      44    78076532 :     uint8_t get_num_enabled(void) const { return _RMGH.num_enabled; }
      45             : 
      46             :     // learn offsets accessor
      47    24012792 :     bool learn_offsets_enabled() const { return _RMGH.learn_offsets_enabled; }
      48             : 
      49             :     // return last update time in microseconds
      50    26472283 :     uint32_t last_update_usec(uint8_t i) const { return _RMGI[i].last_update_usec; }
      51             : 
      52             :     /// Return the current field as a Vector3f in milligauss
      53     3404360 :     const Vector3f &get_field(uint8_t i) const { return _RMGI[i].field; }
      54             : 
      55             :     // check if the compasses are pointing in the same direction
      56     3404360 :     bool consistent() const { return _RMGH.consistent; }
      57             : 
      58             :     // returns first usable compass
      59    79038447 :     uint8_t get_first_usable() const { return _RMGH.first_usable; }
      60             : 
      61             :     // AP_DAL methods:
      62             :     AP_DAL_Compass();
      63             : 
      64             :     void start_frame();
      65             : 
      66             :     void handle_message(const log_RMGH &msg) {
      67             :         _RMGH = msg;
      68             :     }
      69             :     void handle_message(const log_RMGI &msg) {
      70             :         _RMGI[msg.instance] = msg;
      71             :     }
      72             : 
      73             : private:
      74             : 
      75             :     struct log_RMGH _RMGH;
      76             :     struct log_RMGI _RMGI[COMPASS_MAX_INSTANCES];
      77             : };

Generated by: LCOV version 1.14