diff --git a/Multiprotocol/ESky_nrf24l01.ino b/Multiprotocol/ESky_nrf24l01.ino index fdf7613..a7f3f5a 100644 --- a/Multiprotocol/ESky_nrf24l01.ino +++ b/Multiprotocol/ESky_nrf24l01.ino @@ -18,8 +18,13 @@ #include "iface_nrf24l01.h" +//#define ESKY_ET4_FORCE_ID + #define ESKY_BIND_COUNT 1000 -#define ESKY_PACKET_PERIOD 3333 +#define ESKY_STD_PACKET_PERIOD 3333 +#define ESKY_ET4_PACKET_PERIOD 1190 +#define ESKY_ET4_TOTAL_PACKET_PERIOD 20300 +#define ESKY_ET4_BIND_PACKET_PERIOD 5000 #define ESKY_PAYLOAD_SIZE 13 #define ESKY_PACKET_CHKTIME 100 // Time to wait for packet to be sent (no ACK, so very short) @@ -63,28 +68,37 @@ static void __attribute__((unused)) ESKY_init() static void __attribute__((unused)) ESKY_init2() { NRF24L01_FlushTx(); - hopping_frequency_no = 0; - uint16_t channel_ord = rx_tx_addr[0] % 74; - hopping_frequency[12] = 10 + (uint8_t)channel_ord; //channel_code - uint8_t channel1, channel2; - channel1 = 10 + (uint8_t)((37 + channel_ord*5) % 74); - channel2 = 10 + (uint8_t)(( channel_ord*5) % 74) ; + if(sub_protocol==ESKY_STD) + { + uint16_t channel_ord = rx_tx_addr[0] % 74; + hopping_frequency[12] = 10 + (uint8_t)channel_ord; //channel_code + uint8_t channel1, channel2; + channel1 = 10 + (uint8_t)((37 + channel_ord*5) % 74); + channel2 = 10 + (uint8_t)(( channel_ord*5) % 74) ; - hopping_frequency[0] = channel1; - hopping_frequency[1] = channel1; - hopping_frequency[2] = channel1; - hopping_frequency[3] = channel2; - hopping_frequency[4] = channel2; - hopping_frequency[5] = channel2; - - //end_bytes - hopping_frequency[6] = 6; - hopping_frequency[7] = channel1*2; - hopping_frequency[8] = channel2*2; - hopping_frequency[9] = 6; - hopping_frequency[10] = channel1*2; - hopping_frequency[11] = channel2*2; + hopping_frequency[0] = channel1; + hopping_frequency[1] = channel1; + hopping_frequency[2] = channel1; + hopping_frequency[3] = channel2; + hopping_frequency[4] = channel2; + hopping_frequency[5] = channel2; + //end_bytes + hopping_frequency[6] = 6; + hopping_frequency[7] = channel1*2; + hopping_frequency[8] = channel2*2; + hopping_frequency[9] = 6; + hopping_frequency[10] = channel1*2; + hopping_frequency[11] = channel2*2; + } + else + { // ESKY_ET4 + hopping_frequency[0] = 0x29; //41 + hopping_frequency[1] = 0x12; //18 + hopping_frequency[6] = 0x87; //135 payload end byte + hopping_frequency[12] = 0x84; //132 indicates which channels to use + } + // Turn radio power on NRF24L01_SetTxRxMode(TX_EN); } @@ -111,20 +125,32 @@ static void __attribute__((unused)) ESKY_send_packet(uint8_t bind) } else { - // Regular packet - // Each data packet is repeated 3 times on one channel, and 3 times on another channel - // For arithmetic simplicity, channels are repeated in rf_channels array - if (hopping_frequency_no == 0) + if (packet_count == 0) for (uint8_t i = 0; i < 6; i++) { uint16_t val=convert_channel_ppm(CH_AETR[i]); packet[i*2] = val>>8; //high byte of servo timing(1000-2000us) packet[i*2+1] = val&0xFF; //low byte of servo timing(1000-2000us) } - rf_ch = hopping_frequency[hopping_frequency_no]; - packet[12] = hopping_frequency[hopping_frequency_no+6]; // end_bytes - hopping_frequency_no++; - if (hopping_frequency_no > 6) hopping_frequency_no = 0; + if(sub_protocol==ESKY_STD) + { + // Regular packet + // Each data packet is repeated 3 times on one channel, and 3 times on another channel + // For arithmetic simplicity, channels are repeated in rf_channels array + rf_ch = hopping_frequency[packet_count]; + packet[12] = hopping_frequency[packet_count+6]; // end_bytes + packet_count++; + if (packet_count > 6) packet_count = 0; + } + else + { // ESKY_ET4 + // Regular packet + // Each data packet is repeated 14 times alternating between 2 channels + rf_ch = hopping_frequency[packet_count&1]; + packet_count++; + if(packet_count>14) packet_count=0; + packet[12] = hopping_frequency[6]; // end_byte + } } NRF24L01_WriteReg(NRF24L01_05_RF_CH, rf_ch); NRF24L01_FlushTx(); @@ -137,9 +163,17 @@ uint16_t ESKY_callback() if(IS_BIND_DONE) { #ifdef MULTI_SYNC - telemetry_set_input_sync(ESKY_PACKET_PERIOD); + if(packet_count==0) + telemetry_set_input_sync(sub_protocol==ESKY_STD?ESKY_STD_PACKET_PERIOD*6:ESKY_ET4_TOTAL_PACKET_PERIOD); #endif ESKY_send_packet(0); + if(sub_protocol==ESKY_ET4) + { + if(packet_count==0) + return ESKY_ET4_TOTAL_PACKET_PERIOD-ESKY_ET4_PACKET_PERIOD*13; + else + return ESKY_ET4_PACKET_PERIOD; + } } else { @@ -150,16 +184,25 @@ uint16_t ESKY_callback() BIND_DONE; } } - return ESKY_PACKET_PERIOD; + return ESKY_STD_PACKET_PERIOD; } uint16_t initESKY(void) { bind_counter = ESKY_BIND_COUNT; rx_tx_addr[2] = rx_tx_addr[3]; // Model match + #ifdef ESKY_ET4_FORCE_ID + if(sub_protocol==ESKY_ET4) + { + rx_tx_addr[0]=0x72; + rx_tx_addr[1]=0xBB; + rx_tx_addr[2]=0xCC; + } + #endif rx_tx_addr[3] = 0xBB; ESKY_init(); ESKY_init2(); + packet_count=0; return 50000; } diff --git a/Multiprotocol/Multi.txt b/Multiprotocol/Multi.txt index dd9666c..6d80d43 100644 --- a/Multiprotocol/Multi.txt +++ b/Multiprotocol/Multi.txt @@ -13,7 +13,7 @@ 13,CG023,CG023,YD829 14,Bayang,Bayang,H8S3D,X16_AH,IRDRONE,DHD_D4 15,FrskyX,CH_16,CH_8,EU_16,EU_8 -16,ESky,4CH,7CH +16,ESky,Std,ET4 17,MT99xx,MT,H7,YZ,LS,FY805 18,MJXq,WLH08,X600,X800,H26D,E010,H26WH,PHOENIX 19,Shenqi @@ -32,7 +32,7 @@ 32,GW008 33,DM002 34,CABELL,CAB_V3,C_TELEM,-,-,-,-,F_SAFE,UNBIND -35,ESKY150 +35,ESKY150,4CH,7CH 36,H8_3D,H8_3D,H20H,H20Mini,H30Mini 37,CORONA,COR_V1,COR_V2,FD_V3 38,CFlie diff --git a/Multiprotocol/Multi_Names.ino b/Multiprotocol/Multi_Names.ino index 2844e9d..a468ffe 100644 --- a/Multiprotocol/Multi_Names.ino +++ b/Multiprotocol/Multi_Names.ino @@ -120,6 +120,7 @@ const char STR_SUBTYPE_ESKY150[] = "\x03""4CH""7CH"; const char STR_SUBTYPE_V911S[] = "\x05""V911S""E119\0"; const char STR_SUBTYPE_XK[] = "\x04""X450""X420"; const char STR_SUBTYPE_FRSKYR9[] = "\x07""915MHz\0""868MHz\0""915 8ch""868 8ch"; +const char STR_SUBTYPE_ESKY[] = "\x03""Std""ET4"; enum { @@ -187,7 +188,7 @@ const mm_protocol_definition multi_protocols[] = { {PROTO_FRSKYX2, STR_FRSKYX2, 4, STR_SUBTYPE_FRSKYX, OPTION_RFTUNE }, #endif #if defined(ESKY_NRF24L01_INO) - {PROTO_ESKY, STR_ESKY, 0, NO_SUBTYPE, OPTION_NONE }, + {PROTO_ESKY, STR_ESKY, 2, STR_SUBTYPE_ESKY, OPTION_NONE }, #endif #if defined(MT99XX_NRF24L01_INO) {PROTO_MT99XX, STR_MT99XX, 5, STR_SUBTYPE_MT99, OPTION_NONE }, diff --git a/Multiprotocol/Multiprotocol.h b/Multiprotocol/Multiprotocol.h index 94dced6..cab1554 100644 --- a/Multiprotocol/Multiprotocol.h +++ b/Multiprotocol/Multiprotocol.h @@ -19,7 +19,7 @@ #define VERSION_MAJOR 1 #define VERSION_MINOR 3 #define VERSION_REVISION 0 -#define VERSION_PATCH_LEVEL 73 +#define VERSION_PATCH_LEVEL 74 //****************** // Protocols @@ -334,6 +334,11 @@ enum FRSKY_R9 R9_915_8CH = 2, R9_868_8CH = 3, }; +enum ESKY +{ + ESKY_STD = 0, + ESKY_ET4 = 1, +}; #define NONE 0 #define P_HIGH 1 @@ -884,6 +889,9 @@ Serial: 100000 Baud 8e2 _ xxxx xxxx p -- R9_868 1 R9_915_8CH 2 R9_868_8CH 3 + sub_protocol==ESKY + ESKY_STD 0 + ESKY_ET4 1 Power value => 0x80 0=High/1=Low Stream[3] = option_protocol; diff --git a/Multiprotocol/_Config.h b/Multiprotocol/_Config.h index 5b4a89a..9889e6f 100644 --- a/Multiprotocol/_Config.h +++ b/Multiprotocol/_Config.h @@ -548,7 +548,8 @@ const PPM_Parameters PPM_prot[14*NBR_BANKS]= { E015 E016H PROTO_ESKY - NONE + ESKY_STD + ESKY_ET4 PROTO_ESKY150 ESKY150_4CH ESKY150_7CH diff --git a/Protocols_Details.md b/Protocols_Details.md index 1b0c981..2e7a36e 100644 --- a/Protocols_Details.md +++ b/Protocols_Details.md @@ -80,7 +80,7 @@ CFlie|38|CFlie||||||||NRF24L01| [DM002](Protocols_Details.md#DM002---33)|33|DM002||||||||NRF24L01|XN297 [DSM](Protocols_Details.md#DSM---6)|6|DSM2-22|DSM2-11|DSMX-22|DSMX-11|AUTO||||CYRF6936| [E01X](Protocols_Details.md#E01X---45)|45|E012|E015|E016H||||||NRF24L01|XN297/HS6200 -[ESky](Protocols_Details.md#ESKY---16)|16|ESky||||||||NRF24L01| +[ESky](Protocols_Details.md#ESKY---16)|16|ESky|Std|ET4||||||NRF24L01| [ESky150](Protocols_Details.md#ESKY150---35)|35|ESKY150||||||||NRF24L01| [Flysky](Protocols_Details.md#FLYSKY---1)|1|Flysky|V9x9|V6x6|V912|CX20||||A7105| [Flysky AFHDS2A](Protocols_Details.md#FLYSKY-AFHDS2A---28)|28|PWM_IBUS|PPM_IBUS|PWM_SBUS|PPM_SBUS|||||A7105| @@ -851,6 +851,12 @@ CH1|CH2|CH3|CH4|CH5|CH6 ---|---|---|---|---|--- A|E|T|R|GYRO|PITCH +### Sub_protocol Std - *0* + +### Sub_protocol ET4 - *1* +Models compatible with the ET4 transmitter like ESky Big Lama +**Multiple IDs but only one frequency...** + ## ESKY150 - *35* ESky protocol for small models since 2014 (150, 300, 150X, ...)