Skip to content

Commit

Permalink
landdetector flight time: fix cast to 64 bits
Browse files Browse the repository at this point in the history
`_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.
  • Loading branch information
bkueng authored and dagar committed Jul 10, 2019
1 parent 321c2c0 commit aa86bf5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/modules/land_detector/LandDetector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit aa86bf5

Please sign in to comment.