mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-02-06 16:03:58 -04:00
Plane: add arm/disarm on aux switch
This commit is contained in:
parent
93d99dacd1
commit
4ad1869f43
@ -150,6 +150,7 @@ public:
|
|||||||
friend class AP_AdvancedFailsafe_Plane;
|
friend class AP_AdvancedFailsafe_Plane;
|
||||||
friend class AP_Avoidance_Plane;
|
friend class AP_Avoidance_Plane;
|
||||||
friend class GCS_Plane;
|
friend class GCS_Plane;
|
||||||
|
friend class RC_Channel_Plane;
|
||||||
friend class RC_Channels_Plane;
|
friend class RC_Channels_Plane;
|
||||||
|
|
||||||
Plane(void);
|
Plane(void);
|
||||||
|
@ -26,3 +26,40 @@ bool RC_Channels_Plane::has_valid_input() const
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RC_Channel_Plane::init_aux_function(const RC_Channel::aux_func_t ch_option,
|
||||||
|
const RC_Channel::aux_switch_pos_t ch_flag)
|
||||||
|
{
|
||||||
|
switch(ch_option) {
|
||||||
|
// the following functions do not need to be initialised:
|
||||||
|
case ARMDISARM:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
RC_Channel::init_aux_function(ch_option, ch_flag);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// do_aux_function - implement the function invoked by auxillary switches
|
||||||
|
void RC_Channel_Plane::do_aux_function(const aux_func_t ch_option, const aux_switch_pos_t ch_flag)
|
||||||
|
{
|
||||||
|
switch(ch_option) {
|
||||||
|
case ARMDISARM:
|
||||||
|
// arm or disarm the vehicle
|
||||||
|
switch (ch_flag) {
|
||||||
|
case HIGH:
|
||||||
|
plane.arm_motors(AP_Arming::ArmingMethod::AUXSWITCH, true);
|
||||||
|
break;
|
||||||
|
case MIDDLE:
|
||||||
|
// nothing
|
||||||
|
break;
|
||||||
|
case LOW:
|
||||||
|
plane.disarm_motors();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
RC_Channel::do_aux_function(ch_option, ch_flag);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -9,6 +9,11 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
void init_aux_function(aux_func_t ch_option,
|
||||||
|
aux_switch_pos_t ch_flag) override;
|
||||||
|
void do_aux_function(aux_func_t ch_option, aux_switch_pos_t) override;
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user