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

          Line data    Source code
       1             : #pragma once
       2             : 
       3             : #include "AP_RangeFinder_config.h"
       4             : 
       5             : #if AP_RANGEFINDER_LANBAO_ENABLED
       6             : 
       7             : #include "AP_RangeFinder.h"
       8             : #include "AP_RangeFinder_Backend_Serial.h"
       9             : 
      10             : class AP_RangeFinder_Lanbao : public AP_RangeFinder_Backend_Serial
      11             : {
      12             : 
      13             : public:
      14             : 
      15           1 :     static AP_RangeFinder_Backend_Serial *create(
      16             :         RangeFinder::RangeFinder_State &_state,
      17             :         AP_RangeFinder_Params &_params) {
      18           1 :         return NEW_NOTHROW AP_RangeFinder_Lanbao(_state, _params);
      19             :     }
      20             : 
      21             :     // Lanbao is always 115200:
      22           1 :     uint32_t initial_baudrate(uint8_t serial_instance) const override {
      23           1 :         return 115200;
      24             :     }
      25             : 
      26             : protected:
      27             : 
      28         335 :     MAV_DISTANCE_SENSOR _get_mav_distance_sensor_type() const override {
      29         335 :         return MAV_DISTANCE_SENSOR_LASER;
      30             :     }
      31             : 
      32             : private:
      33             : 
      34             :     using AP_RangeFinder_Backend_Serial::AP_RangeFinder_Backend_Serial;
      35             : 
      36             :     // get a reading
      37             :     bool get_reading(float &reading_m) override;
      38             : 
      39             :     uint8_t buf[6];
      40             :     uint8_t buf_len = 0;
      41             : };
      42             : 
      43             : #endif  // AP_RANGEFINDER_LANBAO_ENABLED

Generated by: LCOV version 1.14