drivers/rc_input: always report new lock

This commit is contained in:
Daniel Agar 2021-03-24 15:15:07 -04:00 committed by David Sidrane
parent 34483aef0f
commit 98f89aae9b

View File

@ -246,6 +246,8 @@ void RCInput::set_rc_scan_state(RC_SCAN newState)
_rc_scan_begin = 0;
_rc_scan_state = newState;
_rc_scan_locked = false;
_report_lock = true;
}
void RCInput::rc_io_invert(bool invert)
@ -388,11 +390,6 @@ void RCInput::Run()
unsigned frame_drops = 0;
if (_report_lock && _rc_scan_locked) {
_report_lock = false;
PX4_INFO("RC scan: %s RC input locked", RC_SCAN_STRING[_rc_scan_state]);
}
int newBytes = 0;
// TODO: needs work (poll _rcs_fd)
@ -704,6 +701,11 @@ void RCInput::Run()
} else if (!rc_updated && ((hrt_absolute_time() - _rc_in.timestamp_last_signal) > 1_s)) {
_rc_scan_locked = false;
}
if (_report_lock && _rc_scan_locked) {
_report_lock = false;
PX4_INFO("RC scan: %s RC input locked", RC_SCAN_STRING[_rc_scan_state]);
}
}
}