mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
Commander: switch main_state functions to pass by reference
This commit is contained in:
parent
531de5c588
commit
29e1e0905c
@ -2279,7 +2279,7 @@ Commander::run()
|
||||
}
|
||||
|
||||
// evaluate the main state machine according to mode switches
|
||||
if (set_main_state(&_status_changed) == TRANSITION_CHANGED) {
|
||||
if (set_main_state(_status_changed) == TRANSITION_CHANGED) {
|
||||
// play tune on mode change only if armed, blink LED always
|
||||
tune_positive(_armed.armed);
|
||||
_status_changed = true;
|
||||
@ -2855,7 +2855,7 @@ Commander::control_status_leds(bool changed, const uint8_t battery_warning)
|
||||
}
|
||||
|
||||
transition_result_t
|
||||
Commander::set_main_state(bool *changed)
|
||||
Commander::set_main_state(bool &changed)
|
||||
{
|
||||
if (_safety.override_available && _safety.override_enabled) {
|
||||
return set_main_state_override_on(changed);
|
||||
@ -2866,11 +2866,11 @@ Commander::set_main_state(bool *changed)
|
||||
}
|
||||
|
||||
transition_result_t
|
||||
Commander::set_main_state_override_on(bool *changed)
|
||||
Commander::set_main_state_override_on(bool &changed)
|
||||
{
|
||||
const transition_result_t res = main_state_transition(_status, commander_state_s::MAIN_STATE_MANUAL, _status_flags,
|
||||
_internal_state);
|
||||
*changed = (res == TRANSITION_CHANGED);
|
||||
changed = (res == TRANSITION_CHANGED);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -175,10 +175,10 @@ private:
|
||||
void UpdateEstimateValidity();
|
||||
|
||||
// Set the main system state based on RC and override device inputs
|
||||
transition_result_t set_main_state(bool *changed);
|
||||
transition_result_t set_main_state(bool &changed);
|
||||
|
||||
// Enable override (manual reversion mode) on the system
|
||||
transition_result_t set_main_state_override_on(bool *changed);
|
||||
transition_result_t set_main_state_override_on(bool &changed);
|
||||
|
||||
// Set the system main state based on the current RC inputs
|
||||
transition_result_t set_main_state_rc();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user