mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-17 02:17:35 +08:00
Continue removing the Button based Flight mode selection code
This commit is contained in:
+1
-7
@@ -20,13 +20,7 @@ uint8 FUNCTION_PARAM_3_5 = 16
|
||||
uint8 FUNCTION_KILLSWITCH = 17
|
||||
uint8 FUNCTION_TRANSITION = 18
|
||||
uint8 FUNCTION_GEAR = 19
|
||||
uint8 FUNCTION_ARMSWITCH = 20
|
||||
uint8 FUNCTION_FLTBTN_SLOT_1 = 21
|
||||
uint8 FUNCTION_FLTBTN_SLOT_2 = 22
|
||||
uint8 FUNCTION_FLTBTN_SLOT_3 = 23
|
||||
uint8 FUNCTION_FLTBTN_SLOT_4 = 24
|
||||
uint8 FUNCTION_FLTBTN_SLOT_5 = 25
|
||||
uint8 FUNCTION_FLTBTN_SLOT_6 = 26
|
||||
uint8 FUNCTION_ARMSWITCH = 2
|
||||
|
||||
uint8 FUNCTION_FLTBTN_SLOT_COUNT = 6
|
||||
|
||||
|
||||
@@ -1557,7 +1557,7 @@ PARAM_DEFINE_INT32(RC_MAP_TRANS_SW, 0);
|
||||
PARAM_DEFINE_INT32(RC_MAP_GEAR_SW, 0);
|
||||
|
||||
/**
|
||||
* Mask to indicate which channels are buttons for the Triggers
|
||||
* Mask to indicate if the channel is a button for the trigger action
|
||||
*
|
||||
* This bitmask allows to specify multiple channels to indicate whether it's a button.
|
||||
* If not marked, the channel is assumed to be a switch. This configuration allows the
|
||||
@@ -1565,31 +1565,59 @@ PARAM_DEFINE_INT32(RC_MAP_GEAR_SW, 0);
|
||||
*
|
||||
* @min 0
|
||||
* @max 258048
|
||||
* @group Radio Switches
|
||||
* @bit 0 Mask Channel 1 as a mode button
|
||||
* @bit 1 Mask Channel 2 as a mode button
|
||||
* @bit 2 Mask Channel 3 as a mode button
|
||||
* @bit 3 Mask Channel 4 as a mode button
|
||||
* @bit 4 Mask Channel 5 as a mode button
|
||||
* @bit 5 Mask Channel 6 as a mode button
|
||||
* @bit 6 Mask Channel 7 as a mode button
|
||||
* @bit 7 Mask Channel 8 as a mode button
|
||||
* @bit 8 Mask Channel 9 as a mode button
|
||||
* @bit 9 Mask Channel 10 as a mode button
|
||||
* @bit 10 Mask Channel 11 as a mode button
|
||||
* @bit 11 Mask Channel 12 as a mode button
|
||||
* @bit 12 Mask Channel 13 as a mode button
|
||||
* @bit 13 Mask Channel 14 as a mode button
|
||||
* @bit 14 Mask Channel 15 as a mode button
|
||||
* @bit 15 Mask Channel 16 as a mode button
|
||||
* @bit 16 Mask Channel 17 as a mode button
|
||||
* @bit 17 Mask Channel 18 as a mode button
|
||||
* @group Radio Trigger
|
||||
* @bit 0 Mask Channel 1 as a button
|
||||
* @bit 1 Mask Channel 2 as a button
|
||||
* @bit 2 Mask Channel 3 as a button
|
||||
* @bit 3 Mask Channel 4 as a button
|
||||
* @bit 4 Mask Channel 5 as a button
|
||||
* @bit 5 Mask Channel 6 as a button
|
||||
* @bit 6 Mask Channel 7 as a button
|
||||
* @bit 7 Mask Channel 8 as a button
|
||||
* @bit 8 Mask Channel 9 as a button
|
||||
* @bit 9 Mask Channel 10 as a button
|
||||
* @bit 10 Mask Channel 11 as a button
|
||||
* @bit 11 Mask Channel 12 as a button
|
||||
* @bit 12 Mask Channel 13 as a button
|
||||
* @bit 13 Mask Channel 14 as a button
|
||||
* @bit 14 Mask Channel 15 as a button
|
||||
* @bit 15 Mask Channel 16 as a button
|
||||
* @bit 16 Mask Channel 17 as a button
|
||||
* @bit 17 Mask Channel 18 as a button
|
||||
*/
|
||||
PARAM_DEFINE_INT32(RC_ISBTN_MASK, 0);
|
||||
PARAM_DEFINE_INT32(RC_TRIG_BTN_MASK, 0);
|
||||
|
||||
/**
|
||||
* RC Channel for trigger slot 1
|
||||
*
|
||||
* @min 0
|
||||
* @max 18
|
||||
* @group Radio Trigger
|
||||
* @value 0 Unassigned
|
||||
* @value 1 Channel 1
|
||||
* @value 2 Channel 2
|
||||
* @value 3 Channel 3
|
||||
* @value 4 Channel 4
|
||||
* @value 5 Channel 5
|
||||
* @value 6 Channel 6
|
||||
* @value 7 Channel 7
|
||||
* @value 8 Channel 8
|
||||
* @value 9 Channel 9
|
||||
* @value 10 Channel 10
|
||||
* @value 11 Channel 11
|
||||
* @value 12 Channel 12
|
||||
* @value 13 Channel 13
|
||||
* @value 14 Channel 14
|
||||
* @value 15 Channel 15
|
||||
* @value 16 Channel 16
|
||||
* @value 17 Channel 17
|
||||
* @value 18 Channel 18
|
||||
*/
|
||||
PARAM_DEFINE_INT32(RC_TRIG1_CHAN, 0);
|
||||
|
||||
/**
|
||||
* Which action the Trigger slot 1 triggers
|
||||
*
|
||||
* @min -1
|
||||
* @max 20
|
||||
* @group Radio Trigger
|
||||
@@ -1614,34 +1642,6 @@ PARAM_DEFINE_INT32(RC_ISBTN_MASK, 0);
|
||||
* @value 18 Armswitch
|
||||
* @value 19 Transition
|
||||
* @value 20 Gear
|
||||
*/
|
||||
PARAM_DEFINE_INT32(RC_TRIG1_CHAN, 0);
|
||||
|
||||
/**
|
||||
* Which action the Trigger slot 1 triggers
|
||||
*
|
||||
* @min 0
|
||||
* @max
|
||||
* @value 0 Unassigned
|
||||
* @value 1 Channel 1
|
||||
* @value 2 Channel 2
|
||||
* @value 3 Channel 3
|
||||
* @value 4 Channel 4
|
||||
* @value 5 Channel 5
|
||||
* @value 6 Channel 6
|
||||
* @value 7 Channel 7
|
||||
* @value 8 Channel 8
|
||||
* @value 9 Channel 9
|
||||
* @value 10 Channel 10
|
||||
* @value 11 Channel 11
|
||||
* @value 12 Channel 12
|
||||
* @value 13 Channel 13
|
||||
* @value 14 Channel 14
|
||||
* @value 15 Channel 15
|
||||
* @value 16 Channel 16
|
||||
* @value 17 Channel 17
|
||||
* @value 18 Channel 18
|
||||
* @group Radio Trigger
|
||||
*
|
||||
*/
|
||||
PARAM_DEFINE_INT32(RC_TRIG1_ACTION, 0);
|
||||
|
||||
@@ -309,11 +309,6 @@ void RCUpdate::set_params_from_rc()
|
||||
void
|
||||
RCUpdate::map_flight_modes_buttons()
|
||||
{
|
||||
static_assert(rc_channels_s::FUNCTION_FLTBTN_SLOT_1 + manual_control_switches_s::MODE_SLOT_NUM <= sizeof(
|
||||
_rc.function) / sizeof(_rc.function[0]), "Unexpected number of RC functions");
|
||||
static_assert(rc_channels_s::FUNCTION_FLTBTN_SLOT_COUNT == manual_control_switches_s::MODE_SLOT_NUM,
|
||||
"Unexpected number of Flight Modes slots");
|
||||
|
||||
// Reset all the slots to -1
|
||||
for (uint8_t slot = 0; slot < manual_control_switches_s::MODE_SLOT_NUM; slot++) {
|
||||
_rc.function[rc_channels_s::FUNCTION_FLTBTN_SLOT_1 + slot] = -1;
|
||||
|
||||
@@ -191,7 +191,7 @@ private:
|
||||
uint8_t _input_source_previous{input_rc_s::RC_INPUT_SOURCE_UNKNOWN};
|
||||
|
||||
uint8_t _potential_button_press_slot{0};
|
||||
systemlib::Hysteresis _button_pressed_hysteresis{false};
|
||||
systemlib::Hysteresis _trigger_slots_hysteresis[]
|
||||
systemlib::Hysteresis _rc_signal_lost_hysteresis{true};
|
||||
|
||||
uint8_t _channel_count_max{0};
|
||||
@@ -209,9 +209,11 @@ private:
|
||||
(ParamInt<px4::params::RC_MAP_FAILSAFE>) _param_rc_map_failsafe,
|
||||
|
||||
(ParamInt<px4::params::RC_MAP_FLTMODE>) _param_rc_map_fltmode,
|
||||
(ParamInt<px4::params::RC_TRIG_BTN_MASK>) _param_rc_trig_btn_mask,
|
||||
(ParamInt<px4::params::RC_TRIG1_CHAN>) _param_rc_trig1_chan,
|
||||
(ParamInt<px4::params::RC_TRIG1_ACTION>) _param_rc_trig1_action,
|
||||
|
||||
(ParamInt<px4::params::RC_MAP_FLAPS>) _param_rc_map_flaps,
|
||||
|
||||
(ParamInt<px4::params::RC_MAP_RETURN_SW>) _param_rc_map_return_sw,
|
||||
(ParamInt<px4::params::RC_MAP_LOITER_SW>) _param_rc_map_loiter_sw,
|
||||
(ParamInt<px4::params::RC_MAP_OFFB_SW>) _param_rc_map_offb_sw,
|
||||
@@ -219,7 +221,6 @@ private:
|
||||
(ParamInt<px4::params::RC_MAP_ARM_SW>) _param_rc_map_arm_sw,
|
||||
(ParamInt<px4::params::RC_MAP_TRANS_SW>) _param_rc_map_trans_sw,
|
||||
(ParamInt<px4::params::RC_MAP_GEAR_SW>) _param_rc_map_gear_sw,
|
||||
(ParamInt<px4::params::RC_MAP_FLTM_BTN>) _param_rc_map_flightmode_buttons,
|
||||
|
||||
(ParamInt<px4::params::RC_MAP_AUX1>) _param_rc_map_aux1,
|
||||
(ParamInt<px4::params::RC_MAP_AUX2>) _param_rc_map_aux2,
|
||||
|
||||
Reference in New Issue
Block a user