Add check_params(true) call to the LandDetector start() method. Break out _update_total_flight_time() method in the LandDetector class.

This commit is contained in:
mcsauder 2019-06-25 15:41:53 -06:00 committed by Beat Küng
parent f783982edb
commit d7cfebe0a3
2 changed files with 10 additions and 2 deletions

View File

@ -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(&param_update) || force) {
_update_params();
_total_flight_time = static_cast<uint64_t>(_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<uint64_t>(_param_total_flight_time_high.get()) << 32;
_total_flight_time |= _param_total_flight_time_low.get();
}
} // namespace land_detector

View File

@ -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