From d1831bf2767d6cf5acd56edd79478613a7c1ddab Mon Sep 17 00:00:00 2001 From: Tatsuya Yamaguchi Date: Thu, 7 May 2026 10:50:12 +0900 Subject: [PATCH] ArduSub: clear RC overrides on forward/lateral/yaw/vertical input Override has_pilot_input_for_override_clear() to use Sub's joystick axes (forward, lateral, yaw, plus throttle mapped to vertical thrust) instead of the Copter-style roll/pitch/yaw/throttle set. --- ArduSub/RC_Channel_Sub.cpp | 14 ++++++++++++++ ArduSub/RC_Channel_Sub.h | 3 +++ 2 files changed, 17 insertions(+) diff --git a/ArduSub/RC_Channel_Sub.cpp b/ArduSub/RC_Channel_Sub.cpp index dc09a6160f5..a717898d3ac 100644 --- a/ArduSub/RC_Channel_Sub.cpp +++ b/ArduSub/RC_Channel_Sub.cpp @@ -52,6 +52,20 @@ bool RC_Channels_Sub::has_valid_input() const return RC_Channels::has_valid_input(); } +bool RC_Channels_Sub::has_pilot_input_for_override_clear() +{ + if (channel_outside_trim_dz(get_forward_channel()) || + channel_outside_trim_dz(get_lateral_channel()) || + channel_outside_trim_dz(get_yaw_channel())) { + return true; + } + // Sub throttle (=vertical) is biased away from trim by the GCS, so use movement-since-override-start + if (throttle_moved_since_override_start()) { + return true; + } + return false; +} + // do_aux_function - implement the function invoked by auxiliary switches bool RC_Channel_Sub::do_aux_function(const AuxFuncTrigger &trigger) diff --git a/ArduSub/RC_Channel_Sub.h b/ArduSub/RC_Channel_Sub.h index 1d5ca86cfa9..3a73e801a80 100644 --- a/ArduSub/RC_Channel_Sub.h +++ b/ArduSub/RC_Channel_Sub.h @@ -26,6 +26,9 @@ public: bool in_rc_failsafe() const override; // returns true if throttle arming checks should be run bool arming_check_throttle() const override; + + bool has_pilot_input_for_override_clear() override; + RC_Channel_Sub obj_channels[NUM_RC_CHANNELS]; RC_Channel_Sub *channel(const uint8_t chan) override { if (chan >= ARRAY_SIZE(obj_channels)) {