Bind function on channel 16

Toggling channel 16 (-100%->+100%->-100%) will execute a bind only if
the loaded protocol is an autobind protocol or autobind is set AND
throttle is low (below -95%).
This commit is contained in:
pascallanger 2017-01-02 17:04:50 +01:00
parent 6a792ce6a0
commit 0d0acb9d10
3 changed files with 28 additions and 9 deletions

View File

@ -265,6 +265,11 @@ enum MultiPacketTypes {
#define INPUT_SIGNAL_on protocol_flags2 |= _BV(5)
#define IS_INPUT_SIGNAL_on ( ( protocol_flags2 & _BV(5) ) !=0 )
#define IS_INPUT_SIGNAL_off ( ( protocol_flags2 & _BV(5) ) ==0 )
//CH16
#define CH16_PREV_off protocol_flags2 &= ~_BV(6)
#define CH16_PREV_on protocol_flags2 |= _BV(6)
#define IS_CH16_PREV_on ( ( protocol_flags2 & _BV(6) ) !=0 )
#define IS_CH16_PREV_off ( ( protocol_flags2 & _BV(6) ) ==0 )
//********************
//*** Blink timing ***

View File

@ -460,12 +460,6 @@ void Update_All()
if(mode_select==MODE_SERIAL && IS_RX_FLAG_on) // Serial mode and something has been received
{
update_serial_data(); // Update protocol and data
if(IS_CHANGE_PROTOCOL_FLAG_on)
{ // Protocol needs to be changed
LED_off; //led off during protocol init
modules_reset(); //reset all modules
protocol_init(); //init new protocol
}
INPUT_SIGNAL_on; //valid signal received
last_signal=millis();
}
@ -488,6 +482,21 @@ 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))
{ // 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
if(IS_CHANGE_PROTOCOL_FLAG_on)
{ // Protocol needs to be changed or relaunched for bind
LED_off; //led off during protocol init
modules_reset(); //reset all modules
protocol_init(); //init new protocol
}
update_channels_aux();
#if defined(TELEMETRY)
#if !defined(MULTI_TELEMETRY)

View File

@ -41,6 +41,8 @@
//#define REVERSE_THROTTLE
//#define REVERSE_RUDDER
//Comment to disable the bind feature on channel 16
#define ENABLE_BIND_CH16
/**************************/
/*** RF CHIPS INSTALLED ***/
@ -106,9 +108,12 @@
//If you do not plan using the telemetry comment this global setting using "//" and skip to the next section.
#define TELEMETRY
//Uncomment to invert the polarity of the telemetry serial signal.
//For ER9X and ERSKY9X it must be commented. For OpenTX it must be uncommented.
//#define INVERT_TELEMETRY
//Comment to invert the polarity of the output telemetry serial signal.
//This function takes quite some flash space and processor power on an atmega.
//For OpenTX and ersky9x it must be uncommented.
//On a 9XR_PRO running ersky9x both commented and uncommented will work depending on the radio setting Invert COM1 under the Telemetry menu.
//For er9x it depends if you have an inveter mod or not on the telemetry pin. If you don't have an inverter comment this line.
#define INVERT_TELEMETRY
//Uncomment to send also Multi status and wrap other telemetry to allow TX to autodetect the format
//Only for newest OpenTX version