LCOV - code coverage report
Current view: top level - AP_Airspeed - AP_Airspeed_NMEA.h (source / functions) Hit Total Coverage
Test: lcov.info Lines: 0 1 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_Airspeed_config.h"
       4             : 
       5             : #if AP_AIRSPEED_NMEA_ENABLED
       6             : 
       7             : #include "AP_Airspeed_Backend.h"
       8             : #include <AP_HAL/AP_HAL.h>
       9             : 
      10             : class AP_Airspeed_NMEA : public AP_Airspeed_Backend
      11             : {
      12             : public:
      13             : 
      14             :     using AP_Airspeed_Backend::AP_Airspeed_Backend;
      15             : 
      16             :     // probe and initialise the sensor
      17             :     bool init(void) override;
      18             : 
      19             :     // this reads airspeed directly
      20           0 :     bool has_airspeed() override {return true;}
      21             : 
      22             :     // read the from the sensor
      23             :     bool get_airspeed(float &airspeed) override;
      24             : 
      25             :     // return the current temperature in degrees C
      26             :     bool get_temperature(float &temperature) override;
      27             : 
      28             : 
      29             : private:
      30             :     // pointer to serial uart
      31             :     AP_HAL::UARTDriver *_uart = nullptr; 
      32             : 
      33             :     // add a single character to the buffer and attempt to decode
      34             :     // returns true if a complete sentence was successfully decoded
      35             :     // distance should be pulled directly from _distance_m member
      36             :     bool decode(char c);
      37             : 
      38             :     // decode the just-completed term
      39             :     // returns true if new sentence has just passed checksum test and is validated
      40             :     bool decode_latest_term();
      41             : 
      42             :     // enum for handled messages
      43             :     enum sentence_types : uint8_t {
      44             :         TPYE_MTW = 0,
      45             :         TYPE_VHW,
      46             :     };
      47             : 
      48             : 
      49             :     // message decoding related members
      50             :     char _term[15];                         // buffer for the current term within the current sentence
      51             :     uint8_t _term_offset;                   // offset within the _term buffer where the next character should be placed
      52             :     uint8_t _term_number;                   // term index within the current sentence
      53             :     float _speed;                           // speed in m/s
      54             :     float _temp;                            // temp in deg c
      55             :     uint8_t _checksum;                      // checksum accumulator
      56             :     bool _term_is_checksum;                 // current term is the checksum
      57             :     bool _sentence_done;                    // has the current term already been decoded
      58             :     bool _sentence_valid;                   // is the decodeing valid so far
      59             :     sentence_types _sentence_type;          // the sentence type currently being processed
      60             : 
      61             :     // Store the temp ready for a temp request
      62             :     float _temp_sum;
      63             :     uint16_t _temp_count;
      64             : 
      65             :     // store last sent speed and temp as update rate is slow
      66             :     float _last_temp;
      67             :     float _last_speed;
      68             : 
      69             :     // time last message was received
      70             :     uint32_t _last_update_ms;
      71             : };
      72             : 
      73             : #endif  // AP_AIRSPEED_NMEA_ENABLED

Generated by: LCOV version 1.14