mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-06-02 11:59:17 +08:00
commander delete unused main_state_prev
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -448,8 +448,6 @@ bool StateMachineHelperTest::mainStateTransitionTest()
|
|||||||
struct commander_state_s current_commander_state = {};
|
struct commander_state_s current_commander_state = {};
|
||||||
struct vehicle_status_flags_s current_status_flags = {};
|
struct vehicle_status_flags_s current_status_flags = {};
|
||||||
|
|
||||||
uint8_t main_state_prev = 0;
|
|
||||||
|
|
||||||
current_commander_state.main_state = test->from_state;
|
current_commander_state.main_state = test->from_state;
|
||||||
current_vehicle_status.is_rotary_wing = test->condition_bits & MTT_ROTARY_WING;
|
current_vehicle_status.is_rotary_wing = test->condition_bits & MTT_ROTARY_WING;
|
||||||
current_status_flags.condition_local_altitude_valid = test->condition_bits & MTT_LOC_ALT_VALID;
|
current_status_flags.condition_local_altitude_valid = test->condition_bits & MTT_LOC_ALT_VALID;
|
||||||
@@ -459,7 +457,7 @@ bool StateMachineHelperTest::mainStateTransitionTest()
|
|||||||
current_status_flags.condition_auto_mission_available = true;
|
current_status_flags.condition_auto_mission_available = true;
|
||||||
|
|
||||||
// Attempt transition
|
// Attempt transition
|
||||||
transition_result_t result = main_state_transition(current_vehicle_status, test->to_state, main_state_prev, current_status_flags, ¤t_commander_state);
|
transition_result_t result = main_state_transition(current_vehicle_status, test->to_state, current_status_flags, ¤t_commander_state);
|
||||||
|
|
||||||
// Validate result of transition
|
// Validate result of transition
|
||||||
ut_compare(test->assertMsg, test->expected_transition_result, result);
|
ut_compare(test->assertMsg, test->expected_transition_result, result);
|
||||||
|
|||||||
@@ -393,7 +393,7 @@ bool is_safe(const struct safety_s *safety, const struct actuator_armed_s *armed
|
|||||||
}
|
}
|
||||||
|
|
||||||
transition_result_t
|
transition_result_t
|
||||||
main_state_transition(const vehicle_status_s& status, const main_state_t new_main_state, uint8_t &main_state_prev, const vehicle_status_flags_s& status_flags, commander_state_s *internal_state)
|
main_state_transition(const vehicle_status_s& status, const main_state_t new_main_state, const vehicle_status_flags_s& status_flags, commander_state_s *internal_state)
|
||||||
{
|
{
|
||||||
// IMPORTANT: The assumption of callers of this function is that the execution of
|
// IMPORTANT: The assumption of callers of this function is that the execution of
|
||||||
// this check if essentially "free". Therefore any runtime checking in here has to be
|
// this check if essentially "free". Therefore any runtime checking in here has to be
|
||||||
@@ -505,7 +505,6 @@ main_state_transition(const vehicle_status_s& status, const main_state_t new_mai
|
|||||||
|
|
||||||
if (ret == TRANSITION_CHANGED) {
|
if (ret == TRANSITION_CHANGED) {
|
||||||
if (internal_state->main_state != new_main_state) {
|
if (internal_state->main_state != new_main_state) {
|
||||||
main_state_prev = internal_state->main_state;
|
|
||||||
internal_state->main_state = new_main_state;
|
internal_state->main_state = new_main_state;
|
||||||
internal_state->timestamp = hrt_absolute_time();
|
internal_state->timestamp = hrt_absolute_time();
|
||||||
|
|
||||||
@@ -1042,8 +1041,7 @@ void set_link_loss_nav_state(vehicle_status_s *status,
|
|||||||
} else if (link_loss_act == link_loss_actions_t::AUTO_RTL
|
} else if (link_loss_act == link_loss_actions_t::AUTO_RTL
|
||||||
&& status_flags->condition_global_position_valid && status_flags->condition_home_position_valid) {
|
&& status_flags->condition_global_position_valid && status_flags->condition_home_position_valid) {
|
||||||
|
|
||||||
uint8_t main_state_prev = 0;
|
main_state_transition(*status, commander_state_s::MAIN_STATE_AUTO_RTL, *status_flags, internal_state);
|
||||||
main_state_transition(*status, commander_state_s::MAIN_STATE_AUTO_RTL, main_state_prev, *status_flags, internal_state);
|
|
||||||
status->nav_state = vehicle_status_s::NAVIGATION_STATE_AUTO_RTL;
|
status->nav_state = vehicle_status_s::NAVIGATION_STATE_AUTO_RTL;
|
||||||
|
|
||||||
} else if (link_loss_act == link_loss_actions_t::AUTO_LAND && status_flags->condition_local_position_valid) {
|
} else if (link_loss_act == link_loss_actions_t::AUTO_LAND && status_flags->condition_local_position_valid) {
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ transition_result_t arming_state_transition(struct vehicle_status_s *status,
|
|||||||
hrt_abstime time_since_boot);
|
hrt_abstime time_since_boot);
|
||||||
|
|
||||||
transition_result_t
|
transition_result_t
|
||||||
main_state_transition(const vehicle_status_s& status, const main_state_t new_main_state, uint8_t &main_state_prev, const vehicle_status_flags_s& status_flags, commander_state_s *internal_state);
|
main_state_transition(const vehicle_status_s& status, const main_state_t new_main_state, const vehicle_status_flags_s& status_flags, commander_state_s *internal_state);
|
||||||
|
|
||||||
transition_result_t hil_state_transition(hil_state_t new_state, orb_advert_t status_pub, struct vehicle_status_s *current_status, orb_advert_t *mavlink_log_pub);
|
transition_result_t hil_state_transition(hil_state_t new_state, orb_advert_t status_pub, struct vehicle_status_s *current_status, orb_advert_t *mavlink_log_pub);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user