mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-25 07:23:34 +08:00
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:
@@ -71,6 +71,7 @@ LandDetector::~LandDetector()
|
|||||||
|
|
||||||
void LandDetector::start()
|
void LandDetector::start()
|
||||||
{
|
{
|
||||||
|
_check_params(true);
|
||||||
ScheduleOnInterval(LAND_DETECTOR_UPDATE_INTERVAL);
|
ScheduleOnInterval(LAND_DETECTOR_UPDATE_INTERVAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -154,8 +155,7 @@ void LandDetector::_check_params(const bool force)
|
|||||||
|
|
||||||
if (_param_update_sub.update(¶m_update) || force) {
|
if (_param_update_sub.update(¶m_update) || force) {
|
||||||
_update_params();
|
_update_params();
|
||||||
_total_flight_time = static_cast<uint64_t>(_param_total_flight_time_high.get()) << 32;
|
_update_total_flight_time();
|
||||||
_total_flight_time |= _param_total_flight_time_low.get();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -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
|
} // namespace land_detector
|
||||||
|
|||||||
@@ -163,6 +163,8 @@ private:
|
|||||||
|
|
||||||
void _update_state();
|
void _update_state();
|
||||||
|
|
||||||
|
void _update_total_flight_time();
|
||||||
|
|
||||||
bool _previous_armed_state{false}; ///< stores the previous actuator_armed.armed state
|
bool _previous_armed_state{false}; ///< stores the previous actuator_armed.armed state
|
||||||
|
|
||||||
uint64_t _total_flight_time{0}; ///< in microseconds
|
uint64_t _total_flight_time{0}; ///< in microseconds
|
||||||
|
|||||||
Reference in New Issue
Block a user