mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-11-25 16:51:16 +08:00
commander: avoid uint64 timestamp implicit float conversions
- 64 bit time in microseconds stored in a 32 bit float quickly becomes problematic - fixes https://github.com/PX4/PX4-Autopilot/issues/20944
This commit is contained in:
1 parent
3822ef1519
commit
bd9d09663f
2 files changed
+11
-3
No files matched your search
@@ -426,11 +426,16 @@ void Failsafe::checkStateAndMode(const hrt_abstime &time_us, const State &state,
|
||||
|
||||
|
||||
// Failure detector
|
||||
if (_armed_time != 0 && time_us - _armed_time < _param_com_spoolup_time.get() * 1_s) {
|
||||
if ((_armed_time != 0)
|
||||
&& (time_us < _armed_time + static_cast<hrt_abstime>(_param_com_spoolup_time.get() * 1_s))
|
||||
) {
|
||||
CHECK_FAILSAFE(status_flags, fd_esc_arming_failure, Action::Disarm);
|
||||
}
|
||||
|
||||
if (_armed_time != 0 && time_us - _armed_time < (_param_com_lkdown_tko.get() + _param_com_spoolup_time.get()) * 1_s) {
|
||||
if ((_armed_time != 0)
|
||||
&& (time_us < _armed_time
|
||||
+ static_cast<hrt_abstime>((_param_com_lkdown_tko.get() + _param_com_spoolup_time.get()) * 1_s))
|
||||
) {
|
||||
// This handles the case where something fails during the early takeoff phase
|
||||
CHECK_FAILSAFE(status_flags, fd_critical_failure, Action::Disarm);
|
||||
|
||||
|
||||
Reference in new issue
Block a user