LCOV - code coverage report
Current view: top level - AP_Baro - AP_Baro_MSP.cpp (source / functions) Hit Total Coverage
Test: lcov.info Lines: 0 22 0.0 %
Date: 2026-09-09 11:02:08 Functions: 0 3 0.0 %

          Line data    Source code
       1             : #include "AP_Baro_MSP.h"
       2             : 
       3             : #if AP_BARO_MSP_ENABLED
       4             : 
       5           0 : AP_Baro_MSP::AP_Baro_MSP(AP_Baro &baro, uint8_t _msp_instance) :
       6           0 :     AP_Baro_Backend(baro)
       7             : {
       8           0 :     msp_instance = _msp_instance;
       9           0 :     instance = _frontend.register_sensor();
      10           0 :     set_bus_id(instance, AP_HAL::Device::make_bus_id(AP_HAL::Device::BUS_TYPE_MSP,0,msp_instance,0));
      11           0 : }
      12             : 
      13             : // Read the sensor
      14           0 : void AP_Baro_MSP::update(void)
      15             : {
      16           0 :     if (count) {
      17           0 :         WITH_SEMAPHORE(_sem);
      18           0 :         _copy_to_frontend(instance, sum_pressure/count, sum_temp/count);
      19           0 :         sum_pressure = sum_temp = 0;
      20           0 :         count = 0;
      21           0 :     }
      22           0 : }
      23             : 
      24           0 : void AP_Baro_MSP::handle_msp(const MSP::msp_baro_data_message_t &pkt)
      25             : {
      26           0 :     if (pkt.instance != msp_instance) {
      27             :         // not for us
      28           0 :         return;
      29             :     }
      30           0 :     WITH_SEMAPHORE(_sem);
      31           0 :     sum_pressure += pkt.pressure_pa;
      32           0 :     sum_temp += pkt.temp*0.01;
      33           0 :     count++;
      34           0 : }
      35             : 
      36             : #endif // AP_BARO_MSP_ENABLED

Generated by: LCOV version 1.14