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

          Line data    Source code
       1             : #pragma once
       2             : 
       3             : #include <AP_Param/AP_Param.h>
       4             : 
       5             : #define LEAKDETECTOR_MAX_INSTANCES 3
       6             : 
       7             : #define LEAKDETECTOR_COOLDOWN_MS 3000 // Status will return true for this long after last time leak was detected
       8             : 
       9             : class AP_LeakDetector_Backend;
      10             : 
      11             : class AP_LeakDetector {
      12             : 
      13             :     friend class AP_LeakDetector_Analog;
      14             :     friend class AP_LeakDetector_Digital;
      15             : 
      16             : public:
      17             :     AP_LeakDetector();
      18             : 
      19             :     /* Do not allow copies */
      20             :     CLASS_NO_COPY(AP_LeakDetector);
      21             : 
      22             :     struct LeakDetector_State {
      23             :         uint8_t instance;
      24             :         bool status; // leaking?
      25             :     };
      26             : 
      27             :     // Return current status
      28       16343 :     bool get_status(void) const { return _status; }
      29             : 
      30             :     // Set status externally, ie via mavlink message from subsystems
      31             :     void set_detect(void);
      32             : 
      33             :     // Initialize all drivers
      34             :     void init(void);
      35             : 
      36             :     // Update all drivers
      37             :     bool update(void);
      38             : 
      39             :     int8_t get_pin(uint8_t instance) const;
      40             : 
      41             :     static const struct AP_Param::GroupInfo var_info[];
      42             : 
      43             : private:
      44             :     AP_LeakDetector_Backend *_drivers[LEAKDETECTOR_MAX_INSTANCES];
      45             :     LeakDetector_State _state[LEAKDETECTOR_MAX_INSTANCES];
      46             : 
      47             :     bool _status; // Current status, true if leak detected, false if all sensors dry
      48             :     uint32_t _last_detect_ms;
      49             : 
      50             :     AP_Int8 _pin[LEAKDETECTOR_MAX_INSTANCES]; // Pin that detector is connected to
      51             :     AP_Int8 _default_reading[LEAKDETECTOR_MAX_INSTANCES]; // Default reading when leak detector is dry
      52             : };

Generated by: LCOV version 1.14