diff --git a/Multiprotocol/Bayang_nrf24l01.ino b/Multiprotocol/Bayang_nrf24l01.ino index 5cd2a99..08a3d0f 100644 --- a/Multiprotocol/Bayang_nrf24l01.ino +++ b/Multiprotocol/Bayang_nrf24l01.ino @@ -37,10 +37,10 @@ enum BAYANG_FLAGS { BAYANG_FLAG_PICTURE = 0x20, // flags going to packet[3] BAYANG_FLAG_INVERTED = 0x80, // inverted flight on Floureon H101 - BAYANG_FLAG_TAKE_OFF = 0x20, // take off / landing on X16 AH + BAYANG_FLAG_TAKE_OFF = 0x20, // take off / landing on X16 AH + BAYANG_FLAG_EMG_STOP = 0x04, }; -uint8_t bayang_bind_chan; static void __attribute__((unused)) BAYANG_send_packet(uint8_t bind) { uint8_t i; @@ -62,6 +62,10 @@ static void __attribute__((unused)) BAYANG_send_packet(uint8_t bind) packet[10] = 0x00; packet[11] = 0x00; break; + case IRDRONE: + packet[10] = 0x30; + packet[11] = 0x01; + break; default: packet[10] = rx_tx_addr[0]; // txid[0] packet[11] = rx_tx_addr[1]; // txid[1] @@ -73,6 +77,7 @@ static void __attribute__((unused)) BAYANG_send_packet(uint8_t bind) uint16_t val; switch (sub_protocol) { case X16_AH: + case IRDRONE: packet[0] = 0xA6; break; default: @@ -99,6 +104,8 @@ static void __attribute__((unused)) BAYANG_send_packet(uint8_t bind) packet[3] = BAYANG_FLAG_INVERTED; if(Servo_AUX7) packet[3] |= BAYANG_FLAG_TAKE_OFF; + if(Servo_AUX8) + packet[3] |= BAYANG_FLAG_EMG_STOP; //Aileron val = convert_channel_10b(AILERON); packet[4] = (val>>8) + ((val>>2) & 0xFC); @@ -126,6 +133,10 @@ static void __attribute__((unused)) BAYANG_send_packet(uint8_t bind) packet[12] = 0; packet[13] = 0; break; + case IRDRONE: + packet[12] = 0xE0; + packet[13] = 0x2E; + break; default: packet[12] = rx_tx_addr[2]; // txid[2] packet[13] = 0x0A; @@ -135,7 +146,7 @@ static void __attribute__((unused)) BAYANG_send_packet(uint8_t bind) for (uint8_t i=0; i < BAYANG_PACKET_SIZE-1; i++) packet[14] += packet[i]; - NRF24L01_WriteReg(NRF24L01_05_RF_CH, bind ? bayang_bind_chan:hopping_frequency[hopping_frequency_no++]); + NRF24L01_WriteReg(NRF24L01_05_RF_CH, bind ? rf_ch_num:hopping_frequency[hopping_frequency_no++]); hopping_frequency_no%=BAYANG_RF_NUM_CHANNELS; // clear packet status bits and TX FIFO @@ -203,16 +214,28 @@ static void __attribute__((unused)) BAYANG_init() NRF24L01_FlushTx(); NRF24L01_FlushRx(); - NRF24L01_WriteReg(NRF24L01_07_STATUS, 0x70); // Clear data ready, data sent, and retransmit - NRF24L01_WriteReg(NRF24L01_01_EN_AA, 0x00); // No Auto Acknowldgement on all data pipes - NRF24L01_WriteReg(NRF24L01_02_EN_RXADDR, 0x01); // Enable data pipe 0 only + NRF24L01_WriteReg(NRF24L01_07_STATUS, 0x70); // Clear data ready, data sent, and retransmit + NRF24L01_WriteReg(NRF24L01_01_EN_AA, 0x00); // No Auto Acknowldgement on all data pipes + NRF24L01_WriteReg(NRF24L01_02_EN_RXADDR, 0x01); // Enable data pipe 0 only NRF24L01_WriteReg(NRF24L01_11_RX_PW_P0, BAYANG_PACKET_SIZE); - NRF24L01_SetBitrate(NRF24L01_BR_1M); // 1Mbps + NRF24L01_SetBitrate(NRF24L01_BR_1M); // 1Mbps + NRF24L01_WriteReg(NRF24L01_04_SETUP_RETR, 0x00); // No retransmits NRF24L01_SetPower(); - NRF24L01_Activate(0x73); // Activate feature register - NRF24L01_WriteReg(NRF24L01_1C_DYNPD, 0x00); // Disable dynamic payload length on all pipes + NRF24L01_Activate(0x73); // Activate feature register + NRF24L01_WriteReg(NRF24L01_1C_DYNPD, 0x00); // Disable dynamic payload length on all pipes NRF24L01_WriteReg(NRF24L01_1D_FEATURE, 0x01); NRF24L01_Activate(0x73); + + switch (sub_protocol) + { + case X16_AH: + case IRDRONE: + rf_ch_num = BAYANG_RF_BIND_CHANNEL_X16_AH; + break; + default: + rf_ch_num = BAYANG_RF_BIND_CHANNEL; + break; + } } uint16_t BAYANG_callback() @@ -270,7 +293,7 @@ static void __attribute__((unused)) BAYANG_initialize_txid() { //Could be using txid[0..2] but using rx_tx_addr everywhere instead... hopping_frequency[0]=0; - hopping_frequency[1]=(rx_tx_addr[0]&0x1F)+0x10; + hopping_frequency[1]=(rx_tx_addr[3]&0x1F)+0x10; hopping_frequency[2]=hopping_frequency[1]+0x20; hopping_frequency[3]=hopping_frequency[2]+0x20; hopping_frequency_no=0; @@ -283,14 +306,6 @@ uint16_t initBAYANG(void) BAYANG_initialize_txid(); BAYANG_init(); packet_count=0; - switch (sub_protocol) { - case X16_AH: - bayang_bind_chan = BAYANG_RF_BIND_CHANNEL_X16_AH; - break; - default: - bayang_bind_chan = BAYANG_RF_BIND_CHANNEL; - break; - } #ifdef BAYANG_HUB_TELEMETRY init_frskyd_link_telemetry(); telemetry_lost=1; // do not send telemetry to TX right away until we have a TX_RSSI value to prevent warning message... diff --git a/Multiprotocol/Multi.txt b/Multiprotocol/Multi.txt index e5054ac..470896c 100644 --- a/Multiprotocol/Multi.txt +++ b/Multiprotocol/Multi.txt @@ -11,7 +11,7 @@ 11,SLT,SLT,VISTA 12,CX10,GREEN,BLUE,DM007,---,J3015_1,J3015_2,MK33041 13,CG023,CG023,YD829,H8_3D -14,Bayang,Bayang,H8S3D,X16_AH +14,Bayang,Bayang,H8S3D,X16_AH,IRDRONE 15,FrskyX,CH_16,CH_8,EU_16,EU_8 16,ESky 17,MT99xx,MT,H7,YZ,LS,FY805 diff --git a/Multiprotocol/Multiprotocol.h b/Multiprotocol/Multiprotocol.h index be8b5fb..e018945 100644 --- a/Multiprotocol/Multiprotocol.h +++ b/Multiprotocol/Multiprotocol.h @@ -19,7 +19,7 @@ #define VERSION_MAJOR 1 #define VERSION_MINOR 1 #define VERSION_REVISION 6 -#define VERSION_PATCH_LEVEL 31 +#define VERSION_PATCH_LEVEL 32 //****************** // Protocols //****************** @@ -140,6 +140,7 @@ enum BAYANG BAYANG = 0, H8S3D = 1, X16_AH = 2, + IRDRONE = 3, }; enum MT99XX { @@ -590,6 +591,7 @@ Serial: 100000 Baud 8e2 _ xxxx xxxx p -- BAYANG 0 H8S3D 1 X16_AH 2 + IRDRONE 3 sub_protocol==MT99XX MT99 0 H7 1 diff --git a/Multiprotocol/_Config.h b/Multiprotocol/_Config.h index f172eb7..364684c 100644 --- a/Multiprotocol/_Config.h +++ b/Multiprotocol/_Config.h @@ -353,6 +353,7 @@ const PPM_Parameters PPM_prot[15]= { BAYANG H8S3D X16_AH + IRDRONE MODE_ESKY NONE MODE_MT99XX diff --git a/Protocols_Details.md b/Protocols_Details.md index 00b4870..a7bda68 100644 --- a/Protocols_Details.md +++ b/Protocols_Details.md @@ -363,9 +363,9 @@ Models: EAchine H8(C) mini, BayangToys X6/X7/X9, JJRC JJ850, Floureon H101 ... Autobind protocol -CH1|CH2|CH3|CH4|CH5|CH6|CH7|CH8|CH9|CH10|CH11 ----|---|---|---|---|---|---|---|---|----|--- -A|E|T|R|FLIP|RTH|PICTURE|VIDEO|HEADLESS|INVERTED|TAKE_OFF +CH1|CH2|CH3|CH4|CH5|CH6|CH7|CH8|CH9|CH10 +---|---|---|---|---|---|---|---|---|---- +A|E|T|R|FLIP|RTH|PICTURE|VIDEO|HEADLESS|INVERTED ### Sub_protocol BAYANG - *0* Option=0 -> normal Bayang protocol @@ -380,7 +380,16 @@ Same channels assignement as above. ### Sub_protocol X16_AH - *2* Model: X16 AH -Same channels assignement as above. +CH11 +---- +TAKE_OFF + +### Sub_protocol IRDRONE - *3* +Model: IRDRONE + +CH11|CH12 +----|---- +TAKE_OFF|EMG_STOP ## Cabell - *34* Homegrown protocol with variable number of channels (4-16) and telemetry (RSSI, V1, V2).