Browse Source

RC_Channel: move mission reset in from Copter

master
Peter Barker 6 years ago committed by Andrew Tridgell
parent
commit
aab787b08b
  1. 16
      libraries/RC_Channel/RC_Channel.cpp
  2. 1
      libraries/RC_Channel/RC_Channel.h

16
libraries/RC_Channel/RC_Channel.cpp

@ -446,6 +446,7 @@ void RC_Channel::init_aux_function(const aux_func_t ch_option, const aux_switch_ @@ -446,6 +446,7 @@ void RC_Channel::init_aux_function(const aux_func_t ch_option, const aux_switch_
switch(ch_option) {
case AUX_FUNC::RC_OVERRIDE_ENABLE:
case AUX_FUNC::AVOID_PROXIMITY:
case AUX_FUNC::MISSION_RESET:
do_aux_function(ch_option, ch_flag);
break;
// 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 @@ -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)
{
switch(ch_option) {
@ -674,6 +687,9 @@ void RC_Channel::do_aux_function(const aux_func_t ch_option, const aux_switch_po @@ -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:
do_aux_function_clear_wp(ch_flag);
break;
case AUX_FUNC::MISSION_RESET:
do_aux_function_mission_reset(ch_flag);
break;
case AUX_FUNC::SPRAYER:
do_aux_function_sprayer(ch_flag);

1
libraries/RC_Channel/RC_Channel.h

@ -195,6 +195,7 @@ protected: @@ -195,6 +195,7 @@ protected:
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_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_relay(uint8_t relay, bool val);
void do_aux_function_sprayer(const aux_switch_pos_t ch_flag);

Loading…
Cancel
Save