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

          Line data    Source code
       1             : #pragma once
       2             : 
       3             : #include "AP_RangeFinder_config.h"
       4             : 
       5             : #if AP_RANGEFINDER_HC_SR04_ENABLED
       6             : 
       7             : #include "AP_RangeFinder.h"
       8             : #include "AP_RangeFinder_Backend.h"
       9             : 
      10             : #include "AP_RangeFinder_Params.h"
      11             : 
      12             : class AP_RangeFinder_HC_SR04 : public AP_RangeFinder_Backend
      13             : {
      14             : public:
      15             :     // constructor
      16             :     AP_RangeFinder_HC_SR04(RangeFinder::RangeFinder_State &_state, AP_RangeFinder_Params &_params);
      17             : 
      18             :     // static detection function
      19             :     static bool detect(AP_RangeFinder_Params &_params);
      20             : 
      21             :     // update state
      22             :     void update(void) override;
      23             : 
      24             : protected:
      25             : 
      26           0 :     MAV_DISTANCE_SENSOR _get_mav_distance_sensor_type() const override {
      27           0 :         return MAV_DISTANCE_SENSOR_ULTRASOUND;
      28             :     }
      29             : 
      30             : private:
      31             : 
      32             :     bool check_pins();
      33             :     bool check_echo_pin();
      34             :     void check_trigger_pin();
      35             : 
      36             :     int8_t trigger_pin;
      37             :     float last_distance_m;         // last distance reported (used to prevent glitches in measurement)
      38             :     uint8_t glitch_count;          // glitch counter
      39             : 
      40             :     AP_HAL::PWMSource pwm_source;
      41             : 
      42             :     uint32_t last_ping_ms;
      43             : };
      44             : 
      45             : #endif  // AP_RANGEFINDER_HC_SR04_ENABLED

Generated by: LCOV version 1.14