LCOV - code coverage report
Current view: top level - home/pbarker/rc/ardupilot/ArduCopter - landing_gear.cpp (source / functions) Hit Total Coverage
Test: lcov.info Lines: 14 14 100.0 %
Date: 2026-09-09 11:02:08 Functions: 1 1 100.0 %

          Line data    Source code
       1             : #include "Copter.h"
       2             : 
       3             : #if AP_LANDINGGEAR_ENABLED
       4             : 
       5             : // Run landing gear controller at 10Hz
       6      759512 : void Copter::landinggear_update()
       7             : {
       8             :     // exit immediately if no landing gear output has been enabled
       9      759512 :     if (!SRV_Channels::function_assigned(SRV_Channel::k_landing_gear_control)) {
      10      759265 :         return;
      11             :     }
      12             : 
      13             :     // support height based triggering using rangefinder or altitude above ground
      14         247 :     float height_m = flightmode->get_alt_above_ground_m();
      15             : 
      16             :     // use rangefinder if available
      17             : #if AP_RANGEFINDER_ENABLED
      18         247 :     switch (rangefinder.status_orient(ROTATION_PITCH_270)) {
      19         223 :     case RangeFinder::Status::NotConnected:
      20             :     case RangeFinder::Status::NoData:
      21             :     case RangeFinder::Status::PoweredDown:
      22             :         // use altitude above home for non-functioning rangefinder
      23         223 :         break;
      24             : 
      25          10 :     case RangeFinder::Status::OutOfRangeLow:
      26             :         // altitude is close to zero (gear should deploy)
      27          10 :         height_m = 0;
      28          10 :         break;
      29             : 
      30          14 :     case RangeFinder::Status::OutOfRangeHigh:
      31             :     case RangeFinder::Status::Good:
      32             :         // use last good reading
      33          14 :         height_m = rangefinder_state.alt_m_filt.get();
      34          14 :         break;
      35             :     }
      36             : #endif  // AP_RANGEFINDER_ENABLED
      37             : 
      38         247 :     landinggear.update(height_m);
      39             : }
      40             : 
      41             : #endif // AP_LANDINGGEAR_ENABLED

Generated by: LCOV version 1.14