diff --git a/src/modules/rc_update/rc_update.cpp b/src/modules/rc_update/rc_update.cpp index 324e7bd6a1..090e0d3cd8 100644 --- a/src/modules/rc_update/rc_update.cpp +++ b/src/modules/rc_update/rc_update.cpp @@ -115,7 +115,6 @@ RCUpdate::RCUpdate() : snprintf(param_name_buf, sizeof(param_name_buf), "RC_TRIG_%d_ACTION", trig_slot); _trigger_action_param_handles[trig_slot - 1] = param_find(param_name_buf); } - } rc_parameter_map_poll(true /* forced */); parameters_updated(); @@ -324,37 +323,6 @@ void RCUpdate::set_params_from_rc() } } -void -RCUpdate::map_flight_modes_buttons() -{ - // 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; - } - - // If the functionality is disabled we don't need to map channels - const int flightmode_buttons = _param_rc_map_flightmode_buttons.get(); - - if (flightmode_buttons == 0) { - return; - } - - uint8_t slot = 0; - - for (uint8_t channel = 0; channel < RC_MAX_CHAN_COUNT; channel++) { - if (flightmode_buttons & (1 << channel)) { - PX4_DEBUG("Slot %d assigned to channel %d", slot + 1, channel); - _rc.function[rc_channels_s::FUNCTION_FLTBTN_SLOT_1 + slot] = channel; - slot++; - } - - if (slot >= manual_control_switches_s::MODE_SLOT_NUM) { - // we have filled all the available slots - break; - } - } -} - void RCUpdate::Run() { if (should_exit()) { @@ -627,9 +595,16 @@ void RCUpdate::UpdateManualSwitches(const hrt_abstime ×tamp_sample) } // Go through the trigger slots and update the states - + const uint32_t rc_trigger_is_button_mask = _param_rc_trig_btn_mask.get(); for (uint8_t trig_slot = 1; trig_slot <= RC_TRIG_SLOT_COUNT; trig_slot++) { + int channel{RC_TRIG_CHAN_UNASSIGNED}; + param_get(_trigger_channel_param_handles[trig_slot-1], &channel); + int action{RC_TRIGGER_ACTION_UNASSIGNED}; + param_get(_trigger_action_param_handles[trig_slot-1], &action); + if (channel > RC_TRIG_CHAN_UNASSIGNED) { + + } } // Update the Generic Action states diff --git a/src/modules/rc_update/rc_update.h b/src/modules/rc_update/rc_update.h index 03766134cd..e9c2b823a4 100644 --- a/src/modules/rc_update/rc_update.h +++ b/src/modules/rc_update/rc_update.h @@ -69,6 +69,8 @@ namespace rc_update // Number of Generic Trigger slots that can be configured static constexpr uint8_t RC_TRIG_SLOT_COUNT = 6; +// Value of the RC_TRIG#_CHAN when the channel is unassigned +static constexpr uint8_t RC_TRIG_CHAN_UNASSIGNED = 0; // Enum class translation of the RC_TRIG#_ACTION values static constexpr enum RC_TRIGGER_ACTIONS { @@ -164,8 +166,6 @@ private: */ void set_params_from_rc(); - void map_flight_modes_buttons(); - static constexpr uint8_t RC_MAX_CHAN_COUNT{input_rc_s::RC_INPUT_MAX_CHANNELS}; /**< maximum number of r/c channels we handle */ struct Parameters {