diff --git a/src/modules/land_detector/LandDetector.cpp b/src/modules/land_detector/LandDetector.cpp index 1680589da7..6e2d107e92 100644 --- a/src/modules/land_detector/LandDetector.cpp +++ b/src/modules/land_detector/LandDetector.cpp @@ -71,6 +71,7 @@ LandDetector::~LandDetector() void LandDetector::start() { + _check_params(true); ScheduleOnInterval(LAND_DETECTOR_UPDATE_INTERVAL); } @@ -154,8 +155,7 @@ void LandDetector::_check_params(const bool force) if (_param_update_sub.update(¶m_update) || force) { _update_params(); - _total_flight_time = static_cast(_param_total_flight_time_high.get()) << 32; - _total_flight_time |= _param_total_flight_time_low.get(); + _update_total_flight_time(); } } @@ -187,4 +187,10 @@ void LandDetector::_update_state() } } +void LandDetector::_update_total_flight_time() +{ + _total_flight_time = static_cast(_param_total_flight_time_high.get()) << 32; + _total_flight_time |= _param_total_flight_time_low.get(); +} + } // namespace land_detector diff --git a/src/modules/land_detector/LandDetector.h b/src/modules/land_detector/LandDetector.h index 5d9c648a8c..9278307c75 100644 --- a/src/modules/land_detector/LandDetector.h +++ b/src/modules/land_detector/LandDetector.h @@ -163,6 +163,8 @@ private: void _update_state(); + void _update_total_flight_time(); + bool _previous_armed_state{false}; ///< stores the previous actuator_armed.armed state uint64_t _total_flight_time{0}; ///< in microseconds