mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-03 06:28:27 -04:00
RC_Channel: factor out a do_aux_function_armdisarm method
This commit is contained in:
parent
a50b777179
commit
ac25b90dda
@ -517,6 +517,22 @@ bool RC_Channel::read_aux()
|
||||
}
|
||||
|
||||
|
||||
void RC_Channel::do_aux_function_armdisarm(const aux_switch_pos_t ch_flag)
|
||||
{
|
||||
// arm or disarm the vehicle
|
||||
switch (ch_flag) {
|
||||
case HIGH:
|
||||
AP::arming().arm(AP_Arming::Method::AUXSWITCH, true);
|
||||
break;
|
||||
case MIDDLE:
|
||||
// nothing
|
||||
break;
|
||||
case LOW:
|
||||
AP::arming().disarm();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void RC_Channel::do_aux_function_avoid_adsb(const aux_switch_pos_t ch_flag)
|
||||
{
|
||||
AP_Avoidance *avoidance = AP::ap_avoidance();
|
||||
@ -807,18 +823,7 @@ void RC_Channel::do_aux_function(const aux_func_t ch_option, const aux_switch_po
|
||||
break;
|
||||
|
||||
case AUX_FUNC::ARMDISARM:
|
||||
// arm or disarm the vehicle
|
||||
switch (ch_flag) {
|
||||
case HIGH:
|
||||
AP::arming().arm(AP_Arming::Method::AUXSWITCH, true);
|
||||
break;
|
||||
case MIDDLE:
|
||||
// nothing
|
||||
break;
|
||||
case LOW:
|
||||
AP::arming().disarm();
|
||||
break;
|
||||
}
|
||||
do_aux_function_armdisarm(ch_flag);
|
||||
break;
|
||||
|
||||
case AUX_FUNC::COMPASS_LEARN:
|
||||
|
@ -202,6 +202,7 @@ protected:
|
||||
virtual void init_aux_function(aux_func_t ch_option, aux_switch_pos_t);
|
||||
virtual void do_aux_function(aux_func_t ch_option, aux_switch_pos_t);
|
||||
|
||||
virtual void do_aux_function_armdisarm(const aux_switch_pos_t ch_flag);
|
||||
void do_aux_function_avoid_adsb(const aux_switch_pos_t ch_flag);
|
||||
void do_aux_function_avoid_proximity(const aux_switch_pos_t ch_flag);
|
||||
void do_aux_function_camera_trigger(const aux_switch_pos_t ch_flag);
|
||||
|
Loading…
Reference in New Issue
Block a user