Bind channel: configurable channel number

Bind channel can be configured between 5 and 16.
This commit is contained in:
pascallanger 2017-01-02 17:26:35 +01:00
parent 0d0acb9d10
commit 18e31b3821
3 changed files with 17 additions and 5 deletions

View File

@ -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]<PPM_MIN_COMMAND)
CH16_PREV_off;
#endif //ENABLE_BIND_CH16
#endif //ENABLE_BIND_CH
if(IS_CHANGE_PROTOCOL_FLAG_on)
{ // Protocol needs to be changed or relaunched for bind
LED_off; //led off during protocol init

View File

@ -110,3 +110,12 @@
#if not defined(PPM_MAX_100) || not defined(PPM_MIN_100) || not defined(PPM_MAX_125) || not defined(PPM_MIN_125)
#error You must set correct TX end points.
#endif
#if defined(ENABLE_BIND_CH)
#if BIND_CH<4
#error BIND_CH must be above 4.
#endif
#if BIND_CH>16
#error BIND_CH must be below or equal to 16.
#endif
#endif

View File

@ -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 ***/