Line data Source code
1 : #include "Copter.h" 2 : 3 : // update terrain data 4 759507 : void Copter::terrain_update() 5 : { 6 : #if AP_TERRAIN_AVAILABLE 7 759507 : terrain.update(); 8 : 9 : // tell the rangefinder our height, so it can go into power saving 10 : // mode if available 11 : #if AP_RANGEFINDER_ENABLED 12 : float height; 13 759507 : if (terrain.height_above_terrain(height, true)) { 14 626419 : rangefinder.set_estimated_terrain_height(height); 15 : } 16 : #endif 17 : #endif 18 759507 : } 19 : 20 : #if HAL_LOGGING_ENABLED 21 : // log terrain data - should be called at 1hz 22 75225 : void Copter::terrain_logging() 23 : { 24 : #if AP_TERRAIN_AVAILABLE 25 75225 : if (should_log(MASK_LOG_GPS)) { 26 72241 : terrain.log_terrain_data(); 27 : } 28 : #endif 29 75225 : } 30 : #endif