diff --git a/Multiprotocol/FX_nrf24l01.ino b/Multiprotocol/FX_nrf24l01.ino index ad6351f..8c767b9 100644 --- a/Multiprotocol/FX_nrf24l01.ino +++ b/Multiprotocol/FX_nrf24l01.ino @@ -90,7 +90,7 @@ static void __attribute__((unused)) FX_send_packet() // QIDI-550=>0:3D, 1:6G, 2:Torque | (Channel_data[CH6] < CHANNEL_MIN_COMMAND ? 0x00 : (Channel_data[CH6] > CHANNEL_MAX_COMMAND ? 0x04 : 0x02)); if(sub_protocol == FX_Q560) - packet[5] |= GET_FLAG(CH7_SW, 0x18); // Q560 LED flag 0x10 conflicting with trim_ch... + packet[5] |= GET_FLAG(CH7_SW, 0x18); // Q560 LED flag 0x10 conflicting with trim_ch... Corrected on new boards using 0x08 instead } else // FX816 and FX620 { diff --git a/Multiprotocol/Multi_Protos.ino b/Multiprotocol/Multi_Protos.ino index e0a8d03..bb9bc5f 100644 --- a/Multiprotocol/Multi_Protos.ino +++ b/Multiprotocol/Multi_Protos.ino @@ -112,6 +112,7 @@ const char STR_SGF22[] ="SGF22"; const char STR_EAZYRC[] ="EazyRC"; const char STR_KYOSHO3[] ="Kyosho3"; const char STR_YUXIANG[] ="YuXiang"; +const char STR_PINECONE[] ="PineCone"; const char STR_SUBTYPE_FLYSKY[] = "\x04""Std\0""V9x9""V6x6""V912""CX20"; const char STR_SUBTYPE_HUBSAN[] = "\x04""H107""H301""H501"; @@ -425,6 +426,9 @@ const mm_protocol_definition multi_protocols[] = { #if defined(PELIKAN_A7105_INO) {PROTO_PELIKAN, STR_PELIKAN, STR_SUBTYPE_PELIKAN, 3, OPTION_NONE, 0, 1, SW_A7105, PELIKAN_init, PELIKAN_callback }, #endif + #if defined(PINECONE_CCNRF_INO) + {PROTO_PINECONE, STR_PINECONE, NO_SUBTYPE, 0, OPTION_NONE, 0, 0, SW_NRF, PINECONE_init, PINECONE_callback }, + #endif #if defined(POTENSIC_NRF24L01_INO) {PROTO_POTENSIC, STR_POTENSIC, STR_SUBTYPE_POTENSIC, 1, OPTION_NONE, 0, 0, SW_NRF, POTENSIC_init, POTENSIC_callback }, #endif diff --git a/Multiprotocol/Multiprotocol.h b/Multiprotocol/Multiprotocol.h index d52ec72..b0208b5 100644 --- a/Multiprotocol/Multiprotocol.h +++ b/Multiprotocol/Multiprotocol.h @@ -19,7 +19,7 @@ #define VERSION_MAJOR 1 #define VERSION_MINOR 3 #define VERSION_REVISION 4 -#define VERSION_PATCH_LEVEL 21 +#define VERSION_PATCH_LEVEL 22 #define MODE_SERIAL 0 @@ -75,7 +75,7 @@ enum PROTOCOLS PROTO_NCC1701 = 44, // =>NRF24L01 PROTO_E01X = 45, // =>CYRF6936 PROTO_V911S = 46, // =>NRF24L01 - PROTO_GD00X = 47, // =>NRF24L01 + PROTO_GD00X = 47, // =>CC2500 & NRF24L01 PROTO_V761 = 48, // =>NRF24L01 PROTO_KF606 = 49, // =>NRF24L01 PROTO_REDPINE = 50, // =>CC2500 @@ -128,6 +128,7 @@ enum PROTOCOLS PROTO_KYOSHO3 = 98, // =>CYRF6936 PROTO_XK2 = 99, // =>CC2500 & NRF24L01 PROTO_YUXIANG = 100, // =>NRF24L01 + PROTO_PINECONE = 101, // =>CC2500 & NRF24L01 PROTO_NANORF = 126, // =>NRF24L01 PROTO_TEST = 127, // =>CC2500 diff --git a/Multiprotocol/Pinecone_ccnrf.ino b/Multiprotocol/Pinecone_ccnrf.ino new file mode 100644 index 0000000..693428e --- /dev/null +++ b/Multiprotocol/Pinecone_ccnrf.ino @@ -0,0 +1,167 @@ +/* + This project is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + +Multiprotocol is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Multiprotocol. If not, see . + */ +#if defined(PINECONE_CCNRF_INO) + +#include "iface_xn297.h" + +#define FORCE_PINECONE_ORIGINAL_ID + +#define PINECONE_PAYLOAD_SIZE 15 +#define PINECONE_RF_NUM_CHANNELS 4 +#define PINECONE_PACKET_PERIOD 9000 +#define PINECONE_BIND_COUNT 2000 +#define PINECONE_WRITE_TIME 1500 + +enum { + PINECONE_DATA=0, + PINECONE_RX, +}; + +static void __attribute__((unused)) PINECONE_send_packet() +{ + if(rf_ch_num==0) + { + XN297_Hopping(hopping_frequency_no); + debug("H %d ",hopping_frequency_no); + hopping_frequency_no++; + hopping_frequency_no &= 3; + } + + if(bind_counter==0) bind_counter=2; + memset(&packet[3], 0x00, 12); + if(bind_counter) + {//Bind in progress + bind_counter--; + if(bind_counter) + {//Bind + packet[0] = 0x01; + memcpy(&packet[1],rx_tx_addr,5); + } + else + {//Switch to normal + XN297_SetTXAddr(rx_tx_addr, 5); + XN297_SetRXAddr(rx_tx_addr, PINECONE_PAYLOAD_SIZE); + } + } + if(!bind_counter) + {//Normal + packet[0] = 0x08; + packet[1] = convert_channel_16b_limit(AILERON,0,200); //ST + packet[2] = convert_channel_16b_limit(THROTTLE,0,200); //TH + packet[3] = convert_channel_16b_limit(ELEVATOR,0,200); //CH4 + packet[4] = convert_channel_16b_limit(RUDDER,0,200); //CH3 + } + //packet[5/6..8] = 00 unknown + packet[9] = convert_channel_16b_limit(CH5,0,200); //ESP + packet[10] = convert_channel_16b_limit(CH6,0,200); //ST_TRIM + packet[11] = convert_channel_16b_limit(CH7,0,200); //ST_DR + packet[12] = GET_FLAG(CH8_SW, 0x40) //TH.REV + |GET_FLAG(CH9_SW, 0x80); //ST.REV + //packet[13] = 00 unknown + for(uint8_t i=0;i CHANNEL_MAX_COMMAND) - packet[8] |= SGF22_FLAG_VERTICAL; // CH5 100%, vertical mode (torque) - else if(Channel_data[CH5] > CHANNEL_MIN_COMMAND ) - packet[8] |= ( sub_protocol == SGF22_J20 ? SGF22_J20_FLAG_HORIZONTAL : SGF22_FLAG_6G ); // CH5 0%, F22 & F22S - 6G mode, J20 - Horizontal mode - packet[9] = GET_FLAG(CH8_SW, SGF22_FLAG_PHOTO) // F22: photo, press in throttle trim in the stock TX, J20: invert flight - | GET_FLAG(CH10_SW, ( sub_protocol == SGF22_J20 ? SGF22_J20_FLAG_FIXHEIGHT : SGF22_FLAG_TRIMRESET )) ; // F22: Both sticks down inwards in the stock TX, J20: Altitude hold + packet[8] = SGF22_FLAG_3D // CH5 -100%, F22 & F22S - 3D mode, J20 - Gyro off + | GET_FLAG(CH6_SW, SGF22_FLAG_ROLL) // roll + | GET_FLAG(CH7_SW, SGF22_FLAG_LIGHT) // push up throttle trim for light in the stock TX + | GET_FLAG(CH9_SW, SGF22_FLAG_VIDEO); // push down throttle trim for video in the stock TX + if(Channel_data[CH5] > CHANNEL_MAX_COMMAND) + packet[8] |= SGF22_FLAG_VERTICAL; // CH5 100%, vertical mode (torque) + else if(Channel_data[CH5] > CHANNEL_MIN_COMMAND ) + packet[8] |= ( sub_protocol == SGF22_J20 ? SGF22_J20_FLAG_HORIZONTAL : SGF22_FLAG_6G ); // CH5 0%, F22 & F22S - 6G mode, J20 - Horizontal mode + packet[9] = GET_FLAG(CH8_SW, SGF22_FLAG_PHOTO) // F22: photo, press in throttle trim in the stock TX, J20: invert flight + | GET_FLAG(CH10_SW, ( sub_protocol == SGF22_J20 ? SGF22_J20_FLAG_FIXHEIGHT : SGF22_FLAG_TRIMRESET )) ; // F22: Both sticks down inwards in the stock TX, J20: Altitude hold + + //Trial for FLYBear FX922 + if(sub_protocol==SGF22_F22) + { + packet[8] = GET_FLAG(CH11_SW, 0x01) + | GET_FLAG(CH12_SW, 0x02) + | GET_FLAG(CH13_SW, 0x20) + | GET_FLAG(CH14_SW, 0x80); + packet[9] = GET_FLAG(CH15_SW, 0x01) + | GET_FLAG(CH16_SW, 0x02); + // | GET_FLAG(CH13_SW, 0x08) + // | GET_FLAG(CH13_SW, 0x10) + // | GET_FLAG(CH13_SW, 0x20) + // | GET_FLAG(CH13_SW, 0x80) + } packet[10] = 0x42; // no fine tune packet[11] = 0x10; // no fine tune } diff --git a/Multiprotocol/XN297_EMU.ino b/Multiprotocol/XN297_EMU.ino index e1a1de9..5edb30c 100644 --- a/Multiprotocol/XN297_EMU.ino +++ b/Multiprotocol/XN297_EMU.ino @@ -440,7 +440,6 @@ static uint8_t __attribute__((unused)) XN297_ReadEnhancedPayload(uint8_t* msg, u // Read payload XN297_ReceivePayload(buffer, len+2); // Read pcf + payload + CRC - // Decode payload pcf_size = buffer[0]; if(xn297_scramble_enabled)