diff --git a/Lua_scripts/MultiChan.txt b/Lua_scripts/MultiChan.txt index 6fae6aafd..f0e0ee0b0 100644 --- a/Lua_scripts/MultiChan.txt +++ b/Lua_scripts/MultiChan.txt @@ -169,6 +169,7 @@ 11,2,SLT,Q100,0,Rates,n-a,CH7,CH8,Mode,Flip,n-a,n-a,Calib 11,3,SLT,Q200,0,Rates,n-a,CH7,CH8,Mode,VidOn,VidOff,Calib 11,4,SLT,MR100,0,Rates,n-a,CH7,CH8,Mode,Flip,Video,Pict +11,5,SLT,V1_4CH,0 10,0,Symax,Std,1,Flip,Rates,Pict,Video,HLess 10,1,Symax,X5C,1,Flip,Rates,Pict,Video,HLess 43,0,Traxxas,TQ,0 diff --git a/Multiprotocol/Multi.txt b/Multiprotocol/Multi.txt index af4d57133..a8dc922e8 100644 --- a/Multiprotocol/Multi.txt +++ b/Multiprotocol/Multi.txt @@ -8,7 +8,7 @@ 8,YD717,YD717,SKYWLKR,SYMAX4,XINXUN,NIHUI 9,KN,WLTOYS,FEILUN 10,SymaX,SYMAX,SYMAX5C -11,SLT,SLT_V1,SLT_V2,Q100,Q200,MR100 +11,SLT,SLT_V1,SLT_V2,Q100,Q200,MR100,V1_4CH 12,CX10,GREEN,BLUE,DM007,---,J3015_1,J3015_2,MK33041 13,CG023,CG023,YD829 14,Bayang,Bayang,H8S3D,X16_AH,IRDRONE,DHD_D4,QX100 diff --git a/Multiprotocol/Multi_Protos.ino b/Multiprotocol/Multi_Protos.ino index 77d7d0ec7..50a34dcea 100644 --- a/Multiprotocol/Multi_Protos.ino +++ b/Multiprotocol/Multi_Protos.ino @@ -130,7 +130,7 @@ const char STR_SUBTYPE_DEVO[] = "\x04""8ch\0""10ch""12ch""6ch\0""7ch\0"; const char STR_SUBTYPE_YD717[] = "\x07""Std\0 ""SkyWlkr""Syma X4""XINXUN\0""NIHUI\0 "; const char STR_SUBTYPE_KN[] = "\x06""WLtoys""FeiLun"; const char STR_SUBTYPE_SYMAX[] = "\x03""Std""X5C"; -const char STR_SUBTYPE_SLT[] = "\x06""V1_6ch""V2_8ch""Q100\0 ""Q200\0 ""MR100\0"; +const char STR_SUBTYPE_SLT[] = "\x06""V1_6ch""V2_8ch""Q100\0 ""Q200\0 ""MR100\0""V1_4ch"; const char STR_SUBTYPE_CX10[] = "\x07""Green\0 ""Blue\0 ""DM007\0 ""-\0 ""JC3015a""JC3015b""MK33041"; const char STR_SUBTYPE_CG023[] = "\x05""Std\0 ""YD829"; const char STR_SUBTYPE_BAYANG[] = "\x07""Std\0 ""H8S3D\0 ""X16 AH\0""IRDrone""DHD D4\0""QX100\0 "; @@ -462,7 +462,7 @@ const mm_protocol_definition multi_protocols[] = { {PROTO_SKYARTEC, STR_SKYARTEC, NO_SUBTYPE, 0, OPTION_RFTUNE, 0, 1, SW_CC2500, SKYARTEC_init, SKYARTEC_callback }, #endif #if defined(SLT_CCNRF_INO) - {PROTO_SLT, STR_SLT, STR_SUBTYPE_SLT, 5, OPTION_RFTUNE, 0, 1, SW_NRF, SLT_init, SLT_callback }, + {PROTO_SLT, STR_SLT, STR_SUBTYPE_SLT, 6, OPTION_RFTUNE, 0, 1, SW_NRF, SLT_init, SLT_callback }, #endif #if defined(SYMAX_NRF24L01_INO) {PROTO_SYMAX, STR_SYMAX, STR_SUBTYPE_SYMAX, 2, OPTION_NONE, 0, 0, SW_NRF, SYMAX_init, SYMAX_callback }, diff --git a/Multiprotocol/Multiprotocol.h b/Multiprotocol/Multiprotocol.h index 82a3b7076..d29353171 100644 --- a/Multiprotocol/Multiprotocol.h +++ b/Multiprotocol/Multiprotocol.h @@ -202,11 +202,12 @@ enum SYMAX }; enum SLT { - SLT_V1 = 0, - SLT_V2 = 1, - Q100 = 2, - Q200 = 3, - MR100 = 4, + SLT_V1 = 0, + SLT_V2 = 1, + Q100 = 2, + Q200 = 3, + MR100 = 4, + SLT_V1_4 = 5, }; enum CX10 { diff --git a/Multiprotocol/SLT_ccnrf.ino b/Multiprotocol/SLT_ccnrf.ino index 73b5ea3e3..88fd8c3fe 100644 --- a/Multiprotocol/SLT_ccnrf.ino +++ b/Multiprotocol/SLT_ccnrf.ino @@ -21,11 +21,12 @@ //#define SLT_Q200_FORCE_ID // For code readability -#define SLT_PAYLOADSIZE_V1 7 -#define SLT_PAYLOADSIZE_V2 11 -#define SLT_NFREQCHANNELS 15 -#define SLT_TXID_SIZE 4 -#define SLT_BIND_CHANNEL 0x50 +#define SLT_PAYLOADSIZE_V1 7 +#define SLT_PAYLOADSIZE_V1_4 5 +#define SLT_PAYLOADSIZE_V2 11 +#define SLT_NFREQCHANNELS 15 +#define SLT_TXID_SIZE 4 +#define SLT_BIND_CHANNEL 0x50 enum{ // flags going to packet[6] (Q200) @@ -93,6 +94,12 @@ static void __attribute__((unused)) SLT_set_freq(void) } } } + #if 0 + debug("CH:"); + for (uint8_t i = 0; i < SLT_NFREQCHANNELS; ++i) + debug(" %02X", hopping_frequency[i]); + debugln(); + #endif //Bind channel hopping_frequency[SLT_NFREQCHANNELS]=SLT_BIND_CHANNEL; @@ -129,44 +136,47 @@ static void __attribute__((unused)) SLT_build_packet() uint8_t e = 0; // byte where extension 2 bits for every 10-bit channel are packed for (uint8_t i = 0; i < 4; ++i) { - uint16_t v = convert_channel_10b(CH_AETR[i], false); - if(sub_protocol>SLT_V2 && (i==CH2 || i==CH3) ) + uint16_t v = convert_channel_10b(sub_protocol != SLT_V1_4 ? CH_AETR[i] : i, false); + if(sub_protocol>SLT_V2 && (i==CH2 || i==CH3) && sub_protocol != SLT_V1_4) v=1023-v; // reverse throttle and elevator channels for Q100/Q200/MR100 protocols packet[i] = v; e = (e >> 2) | (uint8_t) ((v >> 2) & 0xC0); } // Extra bits for AETR packet[4] = e; + + //->V1_4CH stops here + // 8-bit channels packet[5] = convert_channel_8b(CH5); packet[6] = convert_channel_8b(CH6); - if(sub_protocol!=SLT_V1) - { - if(sub_protocol==Q200) - packet[6] = GET_FLAG(CH9_SW , FLAG_Q200_FMODE) - |GET_FLAG(CH10_SW, FLAG_Q200_FLIP) - |GET_FLAG(CH11_SW, FLAG_Q200_VIDON) - |GET_FLAG(CH12_SW, FLAG_Q200_VIDOFF); - else if(sub_protocol==MR100 || sub_protocol==Q100) - packet[6] = GET_FLAG(CH9_SW , FLAG_MR100_FMODE) - |GET_FLAG(CH10_SW, FLAG_MR100_FLIP) - |GET_FLAG(CH11_SW, FLAG_MR100_VIDEO) // Does not exist on the Q100 but... - |GET_FLAG(CH12_SW, FLAG_MR100_PICTURE); // Does not exist on the Q100 but... - packet[7]=convert_channel_8b(CH7); - packet[8]=convert_channel_8b(CH8); - packet[9]=0xAA; //normal mode for Q100/Q200, unknown for V2/MR100 - packet[10]=0x00; //normal mode for Q100/Q200, unknown for V2/MR100 - if((sub_protocol==Q100 || sub_protocol==Q200) && CH13_SW) - {//Calibrate - packet[9]=0x77; //enter calibration - if(calib_counter>=20 && calib_counter<=25) // 7 packets for Q100 / 3 packets for Q200 - packet[10]=0x20; //launch calibration - calib_counter++; - if(calib_counter>250) calib_counter=250; - } - else - calib_counter=0; + + //->V1 stops here + + if(sub_protocol==Q200) + packet[6] = GET_FLAG(CH9_SW , FLAG_Q200_FMODE) + |GET_FLAG(CH10_SW, FLAG_Q200_FLIP) + |GET_FLAG(CH11_SW, FLAG_Q200_VIDON) + |GET_FLAG(CH12_SW, FLAG_Q200_VIDOFF); + else if(sub_protocol==MR100 || sub_protocol==Q100) + packet[6] = GET_FLAG(CH9_SW , FLAG_MR100_FMODE) + |GET_FLAG(CH10_SW, FLAG_MR100_FLIP) + |GET_FLAG(CH11_SW, FLAG_MR100_VIDEO) // Does not exist on the Q100 but... + |GET_FLAG(CH12_SW, FLAG_MR100_PICTURE); // Does not exist on the Q100 but... + packet[7]=convert_channel_8b(CH7); + packet[8]=convert_channel_8b(CH8); + packet[9]=0xAA; //normal mode for Q100/Q200, unknown for V2/MR100 + packet[10]=0x00; //normal mode for Q100/Q200, unknown for V2/MR100 + if((sub_protocol==Q100 || sub_protocol==Q200) && CH13_SW) + {//Calibrate + packet[9]=0x77; //enter calibration + if(calib_counter>=20 && calib_counter<=25) // 7 packets for Q100 / 3 packets for Q200 + packet[10]=0x20; //launch calibration + calib_counter++; + if(calib_counter>250) calib_counter=250; } + else + calib_counter=0; } static void __attribute__((unused)) SLT_send_bind_packet() @@ -186,6 +196,7 @@ static void __attribute__((unused)) SLT_send_bind_packet() #define SLT_TIMING_BUILD 1000 #define SLT_V1_TIMING_PACKET 1000 +#define SLT_V1_4_TIMING_PACKET 1643 #define SLT_V2_TIMING_PACKET 2042 #define SLT_V1_TIMING_BIND2 1000 #define SLT_V2_TIMING_BIND1 6507 @@ -195,8 +206,9 @@ uint16_t SLT_callback() switch (phase) { case SLT_BUILD: + //debugln_time("b "); #ifdef MULTI_SYNC - telemetry_set_input_sync(sub_protocol==SLT_V1?20000:13730); + telemetry_set_input_sync(packet_period); #endif SLT_build_packet(); NRF250K_SetPower(); //Change power level @@ -206,42 +218,39 @@ uint16_t SLT_callback() case SLT_DATA1: case SLT_DATA2: phase++; + SLT_send_packet(packet_length); if(sub_protocol==SLT_V1) - { - SLT_send_packet(SLT_PAYLOADSIZE_V1); return SLT_V1_TIMING_PACKET; - } - else //V2 + if(sub_protocol==SLT_V1_4) { - SLT_send_packet(SLT_PAYLOADSIZE_V2); - return SLT_V2_TIMING_PACKET; + phase++; //Packets are sent two times only + return SLT_V1_4_TIMING_PACKET; } + //V2 + return SLT_V2_TIMING_PACKET; case SLT_DATA3: - if(sub_protocol==SLT_V1) - SLT_send_packet(SLT_PAYLOADSIZE_V1); - else //V2 - SLT_send_packet(SLT_PAYLOADSIZE_V2); + SLT_send_packet(packet_length); if (++packet_count >= 100) {// Send bind packet packet_count = 0; - if(sub_protocol==SLT_V1) + if(sub_protocol==SLT_V1||sub_protocol==SLT_V1_4) { phase=SLT_BIND2; return SLT_V1_TIMING_BIND2; } - else //V2 - { - phase=SLT_BIND1; - return SLT_V2_TIMING_BIND1; - } + //V2 + phase=SLT_BIND1; + return SLT_V2_TIMING_BIND1; } else {// Continue to send normal packets phase = SLT_BUILD; if(sub_protocol==SLT_V1) return 20000-SLT_TIMING_BUILD; - else //V2 - return 13730-SLT_TIMING_BUILD; + if(sub_protocol==SLT_V1_4) + return 18000-SLT_TIMING_BUILD-SLT_V1_4_TIMING_PACKET; + //V2 + return 13730-SLT_TIMING_BUILD; } case SLT_BIND1: SLT_send_bind_packet(); @@ -252,8 +261,10 @@ uint16_t SLT_callback() phase = SLT_BUILD; if(sub_protocol==SLT_V1) return 20000-SLT_TIMING_BUILD-SLT_V1_TIMING_BIND2; - else //V2 - return 13730-SLT_TIMING_BUILD-SLT_V2_TIMING_BIND1-SLT_V2_TIMING_BIND2; + if(sub_protocol==SLT_V1_4) + return 18000-SLT_TIMING_BUILD-SLT_V1_TIMING_BIND2-SLT_V1_4_TIMING_PACKET; + //V2 + return 13730-SLT_TIMING_BUILD-SLT_V2_TIMING_BIND1-SLT_V2_TIMING_BIND2; } return 19000; } @@ -276,6 +287,29 @@ void SLT_init() SLT_RF_init(); SLT_set_freq(); phase = SLT_BUILD; + if(sub_protocol==SLT_V1) + { + packet_length = SLT_PAYLOADSIZE_V1; + #ifdef MULTI_SYNC + packet_period = 20000+2000; + #endif + } + else if(sub_protocol==SLT_V1_4) + { + packet_length = SLT_PAYLOADSIZE_V1_4; + #ifdef MULTI_SYNC + packet_period = 18000; + #endif + } + else //V2 + { + packet_length = SLT_PAYLOADSIZE_V2; + #ifdef MULTI_SYNC + packet_period = 13730+2000; + #endif + } } #endif +//SLT v1_4ch timing +//268363 + 1643 / 15 = 18000 diff --git a/Protocols_Details.md b/Protocols_Details.md index a595fd514..5908a9301 100644 --- a/Protocols_Details.md +++ b/Protocols_Details.md @@ -141,7 +141,7 @@ CFlie|38|CFlie||||||||NRF24L01| [SGF22](Protocols_Details.md#SGF22---97)|97|SGF22||||||||NRF24L01|XN297 [Shenqi](Protocols_Details.md#Shenqi---19)|19|Shenqi||||||||NRF24L01|LT8900 [Skyartec](Protocols_Details.md#Skyartec---68)|68|||||||||CC2500|CC2500 -[SLT](Protocols_Details.md#SLT---11)|11|SLT_V1|SLT_V2|Q100|Q200|MR100||||NRF24L01|CC2500 +[SLT](Protocols_Details.md#SLT---11)|11|SLT_V1|SLT_V2|Q100|Q200|MR100|V1_4CH|||NRF24L01|CC2500 [SymaX](Protocols_Details.md#Symax---10)|10|SYMAX|SYMAX5C|||||||NRF24L01| [Traxxas](Protocols_Details.md#Traxxas---43)|43|TQ||||||||CYRF6936| [V2x2](Protocols_Details.md#V2X2---5)|5|V2x2|JXD506|MR101||||||NRF24L01| @@ -1413,6 +1413,12 @@ FLIP: sets model into flip mode for approx 5 seconds at each throw of switch (re MODE: -100% level, +100% acro +### Sub_protocol V1_4CH - *5* + +CH1|CH2|CH3|CH4 +---|---|---|--- +CH1|CH2|CH3|CH4 + ## V911S - *46* CH1|CH2|CH3|CH4|CH5|CH6