mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-22 22:32:11 +08:00
landdetector flight time: fix cast to 64 bits
`_param_total_flight_time_low.get()` is an int32_t and gets sign-extended if cast directly to uint64_t. To avoid that we first cast to uint32_t.
This commit is contained in:
@@ -190,7 +190,7 @@ 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();
|
||||
_total_flight_time |= static_cast<uint32_t>(_param_total_flight_time_low.get());
|
||||
}
|
||||
|
||||
} // namespace land_detector
|
||||
|
||||
Reference in New Issue
Block a user