mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-28 06:03:34 +08:00
rc_update: introduce support for toggle buttons via RC channels
Signed-off-by: Claudio Micheli <claudio@auterion.com>
This commit is contained in:
committed by
Matthias Grob
parent
ca2d8f6de2
commit
c50daae4a3
@@ -59,6 +59,7 @@
|
||||
#include <uORB/topics/rc_channels.h>
|
||||
#include <uORB/topics/rc_parameter_map.h>
|
||||
#include <uORB/topics/parameter_update.h>
|
||||
#include <hysteresis/hysteresis.h>
|
||||
|
||||
using namespace time_literals;
|
||||
|
||||
@@ -130,6 +131,8 @@ 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 {
|
||||
@@ -186,6 +189,10 @@ private:
|
||||
uint8_t _channel_count_previous{0};
|
||||
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 _rc_signal_lost_hysteresis{true};
|
||||
|
||||
uint8_t _channel_count_max{0};
|
||||
|
||||
perf_counter_t _loop_perf{perf_alloc(PC_ELAPSED, MODULE_NAME": cycle")};
|
||||
@@ -216,6 +223,7 @@ private:
|
||||
(ParamInt<px4::params::RC_MAP_GEAR_SW>) _param_rc_map_gear_sw,
|
||||
(ParamInt<px4::params::RC_MAP_STAB_SW>) _param_rc_map_stab_sw,
|
||||
(ParamInt<px4::params::RC_MAP_MAN_SW>) _param_rc_map_man_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