From 18e31b3821f87913abf6d19315d4066b01bb07fa Mon Sep 17 00:00:00 2001 From: pascallanger Date: Mon, 2 Jan 2017 17:26:35 +0100 Subject: [PATCH] Bind channel: configurable channel number Bind channel can be configured between 5 and 16. --- Multiprotocol/Multiprotocol.ino | 6 +++--- Multiprotocol/Validate.h | 9 +++++++++ Multiprotocol/_Config.h | 7 +++++-- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/Multiprotocol/Multiprotocol.ino b/Multiprotocol/Multiprotocol.ino index 285d29f..df90929 100644 --- a/Multiprotocol/Multiprotocol.ino +++ b/Multiprotocol/Multiprotocol.ino @@ -482,15 +482,15 @@ void Update_All() last_signal=millis(); } #endif //ENABLE_PPM - #ifdef ENABLE_BIND_CH16 - if(IS_AUTOBIND_FLAG_on && IS_CH16_PREV_off && Servo_data[15]>PPM_MAX_COMMAND && Servo_data[THROTTLE]<(servo_min_100+25)) + #ifdef ENABLE_BIND_CH + if(IS_AUTOBIND_FLAG_on && IS_CH16_PREV_off && Servo_data[BIND_CH-1]>PPM_MAX_COMMAND && Servo_data[THROTTLE]<(servo_min_100+25)) { // Autobind is on and CH16 went up and Throttle is low CHANGE_PROTOCOL_FLAG_on; //reload protocol to rebind CH16_PREV_on; } if(IS_CH16_PREV_on && Servo_data[15]16 + #error BIND_CH must be below or equal to 16. + #endif +#endif diff --git a/Multiprotocol/_Config.h b/Multiprotocol/_Config.h index 221c034..255db71 100644 --- a/Multiprotocol/_Config.h +++ b/Multiprotocol/_Config.h @@ -41,8 +41,11 @@ //#define REVERSE_THROTTLE //#define REVERSE_RUDDER -//Comment to disable the bind feature on channel 16 -#define ENABLE_BIND_CH16 +//Comment to disable the bind feature on a channel +#define ENABLE_BIND_CH +//Set the channel number used for bind. Default is 16. +#define BIND_CH 16 + /**************************/ /*** RF CHIPS INSTALLED ***/