mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-03 12:48:53 +08:00
ManualControl: put input processing in separate testable function
This commit is contained in:
@@ -86,7 +86,16 @@ void ManualControl::Run()
|
||||
updateParams();
|
||||
}
|
||||
|
||||
const hrt_abstime now = hrt_absolute_time();
|
||||
processInput(hrt_absolute_time());
|
||||
|
||||
// reschedule timeout
|
||||
ScheduleDelayed(200_ms);
|
||||
|
||||
perf_end(_loop_perf);
|
||||
}
|
||||
|
||||
void ManualControl::processInput(hrt_abstime now)
|
||||
{
|
||||
_selector.updateValidityOfChosenInput(now);
|
||||
|
||||
for (int i = 0; i < MAX_MANUAL_INPUT_COUNT; i++) {
|
||||
@@ -267,11 +276,6 @@ void ManualControl::Run()
|
||||
}
|
||||
|
||||
_last_time = now;
|
||||
|
||||
// reschedule timeout
|
||||
ScheduleDelayed(200_ms);
|
||||
|
||||
perf_end(_loop_perf);
|
||||
}
|
||||
|
||||
void ManualControl::updateParams()
|
||||
|
||||
@@ -74,6 +74,9 @@ public:
|
||||
|
||||
int print_status() override;
|
||||
|
||||
protected:
|
||||
void processInput(hrt_abstime now);
|
||||
|
||||
private:
|
||||
static constexpr int MAX_MANUAL_INPUT_COUNT = 3;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user