RC_Channel: move mission reset in from Copter

This commit is contained in:
Peter Barker 2019-06-06 09:39:14 +10:00 committed by Andrew Tridgell
parent 4b51239920
commit aab787b08b
2 changed files with 17 additions and 0 deletions

View File

@ -446,6 +446,7 @@ void RC_Channel::init_aux_function(const aux_func_t ch_option, const aux_switch_
switch(ch_option) { switch(ch_option) {
case AUX_FUNC::RC_OVERRIDE_ENABLE: case AUX_FUNC::RC_OVERRIDE_ENABLE:
case AUX_FUNC::AVOID_PROXIMITY: case AUX_FUNC::AVOID_PROXIMITY:
case AUX_FUNC::MISSION_RESET:
do_aux_function(ch_option, ch_flag); do_aux_function(ch_option, ch_flag);
break; break;
// the following functions do not need to be initialised: // the following functions do not need to be initialised:
@ -633,6 +634,18 @@ void RC_Channel::do_aux_function_rc_override_enable(const aux_switch_pos_t ch_fl
} }
} }
void RC_Channel::do_aux_function_mission_reset(const aux_switch_pos_t ch_flag)
{
if (ch_flag != HIGH) {
return;
}
AP_Mission *mission = AP::mission();
if (mission == nullptr) {
return;
}
mission->reset();
}
void RC_Channel::do_aux_function(const aux_func_t ch_option, const aux_switch_pos_t ch_flag) void RC_Channel::do_aux_function(const aux_func_t ch_option, const aux_switch_pos_t ch_flag)
{ {
switch(ch_option) { switch(ch_option) {
@ -674,6 +687,9 @@ void RC_Channel::do_aux_function(const aux_func_t ch_option, const aux_switch_po
case AUX_FUNC::CLEAR_WP: case AUX_FUNC::CLEAR_WP:
do_aux_function_clear_wp(ch_flag); do_aux_function_clear_wp(ch_flag);
break; break;
case AUX_FUNC::MISSION_RESET:
do_aux_function_mission_reset(ch_flag);
break;
case AUX_FUNC::SPRAYER: case AUX_FUNC::SPRAYER:
do_aux_function_sprayer(ch_flag); do_aux_function_sprayer(ch_flag);

View File

@ -195,6 +195,7 @@ protected:
void do_aux_function_clear_wp(const aux_switch_pos_t ch_flag); void do_aux_function_clear_wp(const aux_switch_pos_t ch_flag);
void do_aux_function_gripper(const aux_switch_pos_t ch_flag); void do_aux_function_gripper(const aux_switch_pos_t ch_flag);
void do_aux_function_lost_vehicle_sound(const aux_switch_pos_t ch_flag); void do_aux_function_lost_vehicle_sound(const aux_switch_pos_t ch_flag);
void do_aux_function_mission_reset(const aux_switch_pos_t ch_flag);
void do_aux_function_rc_override_enable(const aux_switch_pos_t ch_flag); void do_aux_function_rc_override_enable(const aux_switch_pos_t ch_flag);
void do_aux_function_relay(uint8_t relay, bool val); void do_aux_function_relay(uint8_t relay, bool val);
void do_aux_function_sprayer(const aux_switch_pos_t ch_flag); void do_aux_function_sprayer(const aux_switch_pos_t ch_flag);