From 9ff1b59795bceba85dbbaedf3530ab4d6e9b23f0 Mon Sep 17 00:00:00 2001 From: Filip Kotoucek Date: Tue, 27 Dec 2022 22:15:09 +0100 Subject: [PATCH] KF606: subprotocol ZC-Z50v2 Cessna Maybe newer iteration of Z50. My plane does not have front propeller. But if there is one, its just for design. This model does not have front motor. Thanks @pascallanger for support and reviews. --- Lua_scripts/MultiChan.txt | 1 + Multiprotocol/KF606_ccnrf.ino | 74 +++++++++++++++++++++++++--------- Multiprotocol/Multi.txt | 2 +- Multiprotocol/Multi_Protos.ino | 4 +- Multiprotocol/Multiprotocol.h | 3 +- Multiprotocol/_Config.h | 1 + Protocols_Details.md | 11 ++++- 7 files changed, 73 insertions(+), 23 deletions(-) diff --git a/Lua_scripts/MultiChan.txt b/Lua_scripts/MultiChan.txt index 95caf80..67af1b2 100644 --- a/Lua_scripts/MultiChan.txt +++ b/Lua_scripts/MultiChan.txt @@ -117,6 +117,7 @@ 71,1,JJRC345,SkyTmblr,1,Flip,HLess,RTH,LED,UNK1,UNK2,UNK3 49,0,KF606,KF606,1,Trim 49,1,KF606,MIG320,1,Trim,LED +49,2,KF606,ZCZ50,1,Trim,UNK 9,0,KN,WLToys,0,DRate,THold,IdleUp,Gyro,Ttrim,Atrim,Etrim 9,1,KN,Feilun,0,DRate,THold,IdleUp,Gyro,Ttrim,Atrim,Etrim 73,0,Kyosho,Std,0,CH5,CH6,CH7,CH8,CH9,CH10,CH11,CH12,CH13,CH14 diff --git a/Multiprotocol/KF606_ccnrf.ino b/Multiprotocol/KF606_ccnrf.ino index aadf8e4..516451a 100644 --- a/Multiprotocol/KF606_ccnrf.ino +++ b/Multiprotocol/KF606_ccnrf.ino @@ -20,6 +20,7 @@ Multiprotocol is distributed in the hope that it will be useful, //#define FORCE_KF606_ORIGINAL_ID //#define FORCE_MIG320_ORIGINAL_ID +//#define FORCE_ZCZ50_ORIGINAL_ID #define KF606_INITIAL_WAIT 500 #define KF606_PACKET_PERIOD 3000 @@ -30,10 +31,16 @@ Multiprotocol is distributed in the hope that it will be useful, static void __attribute__((unused)) KF606_send_packet() { + uint8_t len = KF606_PAYLOAD_SIZE; if(IS_BIND_IN_PROGRESS) { - packet[0] = 0xAA; - memcpy(&packet[1],rx_tx_addr,3); + if(sub_protocol != KF606_ZCZ50) + { + packet[0] = 0xAA; + memcpy(&packet[1],rx_tx_addr,3); + } + else + memcpy(packet,rx_tx_addr,4); } else { @@ -43,25 +50,32 @@ static void __attribute__((unused)) KF606_send_packet() packet[0] = 0x55; packet[1] = convert_channel_8b(THROTTLE); // 0..255 // Deadband is needed on aileron, 40 gives +-6% - if(sub_protocol == KF606_KF606) + switch(sub_protocol) { - packet[2] = convert_channel_8b_limit_deadband(AILERON,0x20,0x80,0xE0,40); // Aileron: Max values:20..80..E0, Low rates:50..80..AF, High rates:3E..80..C1 - packet[3] = convert_channel_16b_limit(CH5,0xC1,0xDF); // Aileron trim must be on a separated channel C1..D0..DF - } - else - { - packet[2] = convert_channel_8b_limit_deadband(AILERON,0x00,0x80,0xFF,40); // Aileron: High rate:2B..80..DA - packet[3] = convert_channel_16b_limit(CH5,0x01,0x1F); // Aileron trim must be on a separated channel 01..10..1F - packet[3] += (packet[2]-0x80)>>3; // Drive trims for more aileron authority - if(packet[3] > 0x80) - packet[3] = 0x01; - else if(packet[3] > 0x1F) - packet[3] = 0x1F; - packet[3] |= GET_FLAG(CH6_SW, 0xC0); // 0xC0 and 0xE0 are both turning the LED off, not sure if there is another hidden feature + case KF606_KF606: + packet[2] = convert_channel_8b_limit_deadband(AILERON,0x20,0x80,0xE0,40); // Aileron: Max values:20..80..E0, Low rates:50..80..AF, High rates:3E..80..C1 + packet[3] = convert_channel_16b_limit(CH5,0xC1,0xDF); // Aileron trim must be on a separated channel C1..D0..DF + break; + case KF606_MIG320: + packet[2] = convert_channel_8b_limit_deadband(AILERON,0x00,0x80,0xFF,40); // Aileron: High rate:2B..80..DA + packet[3] = convert_channel_16b_limit(CH5,0x01,0x1F); // Aileron trim must be on a separated channel 01..10..1F + packet[3] += (packet[2]-0x80)>>3; // Drive trims for more aileron authority + if(packet[3] > 0x80) + packet[3] = 0x01; + else if(packet[3] > 0x1F) + packet[3] = 0x1F; + packet[3] |= GET_FLAG(CH6_SW, 0xC0); // 0xC0 and 0xE0 are both turning the LED off, not sure if there is another hidden feature + break; + case KF606_ZCZ50: + len--; // uses only 3 bytes of payload + packet[0] = packet[1]; // Throttle: 0x00..0xFF + packet[1] = convert_channel_8b_limit_deadband(AILERON,0x20,0x80,0xE0,40); // Aileron: Max values:20..80..E0, low rate 0x52..0x80..0xB1, high rate: 0x41..0x80..0xC3. + packet[2] = convert_channel_16b_limit(CH5,0x01,0x1F); // Trim: 0x01..0x10..0x1F + packet[2] |= GET_FLAG(CH6_SW, 0xC0); // Unknown: 0x00 or 0xC0. Left top switch on original TX changes nothing on my plane. Maybe ON/OFF for main motor? + break; } } - uint8_t len = KF606_PAYLOAD_SIZE; if(sub_protocol == KF606_MIG320) { len++; @@ -107,6 +121,19 @@ static void __attribute__((unused)) KF606_initialize_txid() hopping_frequency[0]=68; hopping_frequency[1]=71; #endif + if(sub_protocol == KF606_ZCZ50) + { + rx_tx_addr[1] = rx_tx_addr[0]; + rx_tx_addr[0]=0xAA; + } + #ifdef FORCE_ZCZ50_ORIGINAL_ID + rx_tx_addr[0]=0xAA; + rx_tx_addr[1]=0x67; + rx_tx_addr[2]=0x64; + rx_tx_addr[3]=0x01; + hopping_frequency[0]=48; + hopping_frequency[1]=51; + #endif } static void __attribute__((unused)) KF606_RF_init() @@ -126,7 +153,7 @@ uint16_t KF606_callback() if(--bind_counter==0) { BIND_DONE; - XN297_SetTXAddr(rx_tx_addr, 3); + XN297_SetTXAddr(rx_tx_addr, sub_protocol != KF606_ZCZ50 ? 3 : 4); } KF606_send_packet(); return KF606_PACKET_PERIOD; @@ -153,3 +180,14 @@ void KF606_init() // P[2] = AIL 2B..80..DA // P[3] = TRIM 01..10..1F // channels 68=BB&3F+9 and 71 + + +// ZCZ50v2 protocol (with fake front propeller) +// Bind +// 250K C=7 S=Y A= E7 E7 E7 E7 E7 P(4)= AA 67 64 01 +// 3ms on ch7 +// Normal +// 250K C=48 S=Y A= AA 67 64 01 P(3)= 00 80 10 +// P[0] = THR 0x00..0xFF +// P[1] = AIL low rate 0x52..0x80..0xB1, high rate: 0x41..0x80..0xC3 +// P[2] = TRIM 0x01..0x10..0x1F + UNKNOWN 0x00 or 0xC0 diff --git a/Multiprotocol/Multi.txt b/Multiprotocol/Multi.txt index a547ce5..eaf5d05 100644 --- a/Multiprotocol/Multi.txt +++ b/Multiprotocol/Multi.txt @@ -46,7 +46,7 @@ 46,V911S,V911S,E119 47,GD00x,GD_V1,GD_V2 48,V761,3CH,4CH,TOPRC -49,KF606,KF606,MIG320 +49,KF606,KF606,MIG320,ZCZ50 50,Redpine,Fast,Slow 51,Potensic,A20 52,ZSX,280 diff --git a/Multiprotocol/Multi_Protos.ino b/Multiprotocol/Multi_Protos.ino index 9097782..2831243 100644 --- a/Multiprotocol/Multi_Protos.ino +++ b/Multiprotocol/Multi_Protos.ino @@ -171,7 +171,7 @@ const char STR_SUBTYPE_KYOSHO2[] = "\x05""KT-17"; const char STR_SUBTYPE_FUTABA[] = "\x05""SFHSS"; const char STR_SUBTYPE_JJRC345[] = "\x08""JJRC345\0""SkyTmblr"; const char STR_SUBTYPE_MOULKG[] = "\x06""Analog""Digit\0"; -const char STR_SUBTYPE_KF606[] = "\x06""KF606\0""MIG320"; +const char STR_SUBTYPE_KF606[] = "\x06""KF606\0""MIG320""ZCZ50\0"; const char STR_SUBTYPE_E129[] = "\x04""E129""C186"; const char STR_SUBTYPE_FX[] = "\x03""816""620"; #define NO_SUBTYPE nullptr @@ -360,7 +360,7 @@ const mm_protocol_definition multi_protocols[] = { {PROTO_JOYSWAY, STR_JOYSWAY, NO_SUBTYPE, 0, OPTION_NONE, 0, 0, SW_A7105, JOYSWAY_init, JOYSWAY_callback }, #endif #if defined(KF606_CCNRF_INO) - {PROTO_KF606, STR_KF606, STR_SUBTYPE_KF606, 2, OPTION_RFTUNE, 0, 0, SW_NRF, KF606_init, KF606_callback }, + {PROTO_KF606, STR_KF606, STR_SUBTYPE_KF606, 3, OPTION_RFTUNE, 0, 0, SW_NRF, KF606_init, KF606_callback }, #endif #if defined(KN_NRF24L01_INO) {PROTO_KN, STR_KN, STR_SUBTYPE_KN, 2, OPTION_NONE, 0, 0, SW_NRF, KN_init, KN_callback }, diff --git a/Multiprotocol/Multiprotocol.h b/Multiprotocol/Multiprotocol.h index d866fd0..06557dd 100644 --- a/Multiprotocol/Multiprotocol.h +++ b/Multiprotocol/Multiprotocol.h @@ -19,7 +19,7 @@ #define VERSION_MAJOR 1 #define VERSION_MINOR 3 #define VERSION_REVISION 3 -#define VERSION_PATCH_LEVEL 24 +#define VERSION_PATCH_LEVEL 25 #define MODE_SERIAL 0 @@ -450,6 +450,7 @@ enum KF606 { KF606_KF606 = 0, KF606_MIG320 = 1, + KF606_ZCZ50 = 2, }; enum E129 { diff --git a/Multiprotocol/_Config.h b/Multiprotocol/_Config.h index c64a023..ba8e0f6 100644 --- a/Multiprotocol/_Config.h +++ b/Multiprotocol/_Config.h @@ -717,6 +717,7 @@ const PPM_Parameters PPM_prot[14*NBR_BANKS]= { PROTO_KF606 KF606_KF606 KF606_MIG320 + KF606_ZCZ50 PROTO_KN WLTOYS FEILUN diff --git a/Protocols_Details.md b/Protocols_Details.md index fd74844..5bbeb22 100644 --- a/Protocols_Details.md +++ b/Protocols_Details.md @@ -110,7 +110,7 @@ CFlie|38|CFlie||||||||NRF24L01| [J6Pro](Protocols_Details.md#J6Pro---22)|22|||||||||CYRF6936| [JJRC345](Protocols_Details.md#JJRC345---71)|71|JJRC345|SkyTmblr|||||||NRF24L01|XN297 [JOYSWAY](Protocols_Details.md#JOYSWAY---84)|84|||||||||NRF24L01|XN297 -[KF606](Protocols_Details.md#KF606---49)|49|KF606|MIG320|||||||NRF24L01|XN297 +[KF606](Protocols_Details.md#KF606---49)|49|KF606|MIG320|ZCZ50||||||NRF24L01|XN297 [KN](Protocols_Details.md#KN---9)|9|WLTOYS|FEILUN|||||||NRF24L01| [Kyosho](Protocols_Details.md#Kyosho---73)|73|FHSS|Hype|||||||A7105| [Kyosho2](Protocols_Details.md#Kyosho2---93)|93|KT-17||||||||NRF24L01| @@ -1049,6 +1049,15 @@ CH1|CH2|CH3|CH4|CH5|CH6 ---|---|---|---|---|--- A||T||TRIM|LED +### Sub_protocol ZCZ50v2 - *2* +Model: ZC-Z50 Cessna + +This might be newer version of the model. My plane does not have front propeller, but its just fake anyway (no motor in the front). + +CH1|CH2|CH3|CH4|CH5|CH6 +---|---|---|---|---|--- +A||T||TRIM|UNKNOWN + ## MJXQ - *18* Autobind protocol