2016-05-03 22:57:47 -03:00
|
|
|
#include "Sub.h"
|
|
|
|
|
|
|
|
// update terrain data
|
|
|
|
void Sub::terrain_update()
|
|
|
|
{
|
2021-02-12 23:40:10 -04:00
|
|
|
#if AP_TERRAIN_AVAILABLE
|
2016-05-03 22:57:47 -03:00
|
|
|
terrain.update();
|
|
|
|
|
|
|
|
// tell the rangefinder our height, so it can go into power saving
|
|
|
|
// mode if available
|
2023-11-07 18:23:41 -04:00
|
|
|
#if AP_RANGEFINDER_ENABLED
|
2016-05-03 22:57:47 -03:00
|
|
|
float height;
|
|
|
|
if (terrain.height_above_terrain(height, true)) {
|
2016-05-22 21:50:44 -03:00
|
|
|
rangefinder.set_estimated_terrain_height(height);
|
2016-05-03 22:57:47 -03:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2024-01-10 00:34:30 -04:00
|
|
|
#if HAL_LOGGING_ENABLED
|
2016-05-03 22:57:47 -03:00
|
|
|
// log terrain data - should be called at 1hz
|
|
|
|
void Sub::terrain_logging()
|
|
|
|
{
|
2021-02-12 23:40:10 -04:00
|
|
|
#if AP_TERRAIN_AVAILABLE
|
2016-05-03 22:57:47 -03:00
|
|
|
if (should_log(MASK_LOG_GPS)) {
|
2019-01-17 19:20:15 -04:00
|
|
|
terrain.log_terrain_data();
|
2016-05-03 22:57:47 -03:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
2024-01-10 00:34:30 -04:00
|
|
|
#endif // HAL_LOGGING_ENABLED
|
2016-05-03 22:57:47 -03:00
|
|
|
|