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

          Line data    Source code
       1             : #pragma once
       2             : 
       3             : #include "AP_RangeFinder_config.h"
       4             : 
       5             : #if AP_RANGEFINDER_TRI2C_ENABLED
       6             : 
       7             : #include "AP_RangeFinder.h"
       8             : #include "AP_RangeFinder_Backend_I2C.h"
       9             : 
      10             : class AP_RangeFinder_TeraRangerI2C : public AP_RangeFinder_Backend_I2C
      11             : {
      12             : public:
      13             :     // static detection function
      14           1 :     static AP_RangeFinder_Backend *detect(RangeFinder::RangeFinder_State &_state,
      15             :                                           AP_RangeFinder_Params &_params,
      16             :                                           class AP_HAL::I2CDevice &i2c_dev) {
      17             :         // this will free the object if configuration fails:
      18           1 :         return configure(NEW_NOTHROW AP_RangeFinder_TeraRangerI2C(_state, _params, i2c_dev));
      19             :     }
      20             : 
      21             :     // update state
      22             :     void update(void) override;
      23             : 
      24             : protected:
      25             : 
      26         335 :     virtual MAV_DISTANCE_SENSOR _get_mav_distance_sensor_type() const override {
      27         335 :         return MAV_DISTANCE_SENSOR_LASER;
      28             :     }
      29             : 
      30             : private:
      31             :     // constructor
      32             :     using AP_RangeFinder_Backend_I2C::AP_RangeFinder_Backend_I2C;
      33             : 
      34             :     bool measure(void);
      35             :     bool collect_raw(uint16_t &raw_distance);
      36             :     bool process_raw_measure(uint16_t raw_distance, uint16_t &distance_cm);
      37             : 
      38             :     bool init(void) override;
      39             :     void timer(void);
      40             : 
      41             :     struct {
      42             :         uint32_t sum;
      43             :         uint32_t count;
      44             :     } accum;
      45             : };
      46             : 
      47             : #endif  // AP_RANGEFINDER_TRI2C_ENABLED

Generated by: LCOV version 1.14