Skip to content

Copter: correct setting of deadzone on RC tuning channel #30038

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions ArduCopter/Copter.h
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,9 @@ class Copter : public AP_Vehicle {
RC_Channel *channel_throttle;
RC_Channel *channel_yaw;

// channel which is being used to tune a parameter value:
RC_Channel *rc_tuning;

// flight modes convenience array
AP_Int8 *flight_modes;
const uint8_t num_flight_modes = 6;
Expand Down
6 changes: 5 additions & 1 deletion ArduCopter/radio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ void Copter::default_dead_zones()
channel_throttle->set_default_dead_zone(30);
channel_yaw->set_default_dead_zone(20);
#endif
rc().channel(CH_6)->set_default_dead_zone(0);
if (rc_tuning != nullptr) {
rc_tuning->set_default_dead_zone(0);
}
}

void Copter::init_rc_in()
Expand All @@ -32,6 +34,8 @@ void Copter::init_rc_in()
channel_yaw->set_angle(ROLL_PITCH_YAW_INPUT_MAX);
channel_throttle->set_range(1000);

rc_tuning = rc().find_channel_for_option(RC_Channel::AUX_FUNC::TRANSMITTER_TUNING);

// set default dead zones
default_dead_zones();

Expand Down
2 changes: 0 additions & 2 deletions ArduCopter/tuning.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
// should be called at 3.3hz
void Copter::tuning()
{
const RC_Channel *rc_tuning = rc().find_channel_for_option(RC_Channel::AUX_FUNC::TRANSMITTER_TUNING);

// exit immediately if tuning channel is not set
if (rc_tuning == nullptr) {
return;
Expand Down