diff --git a/Multiprotocol/Multi.txt b/Multiprotocol/Multi.txt index b8073e6..0ef1bd6 100644 --- a/Multiprotocol/Multi.txt +++ b/Multiprotocol/Multi.txt @@ -48,4 +48,5 @@ 48,V761 49,KF606 50,REDPINE,FAST,SLOW +51,POTENSIC,A20 63,XN_DUMP,250K,1M,2M diff --git a/Multiprotocol/Multiprotocol.h b/Multiprotocol/Multiprotocol.h index fed9edd..866af62 100644 --- a/Multiprotocol/Multiprotocol.h +++ b/Multiprotocol/Multiprotocol.h @@ -19,7 +19,7 @@ #define VERSION_MAJOR 1 #define VERSION_MINOR 2 #define VERSION_REVISION 1 -#define VERSION_PATCH_LEVEL 62 +#define VERSION_PATCH_LEVEL 63 //****************** // Protocols @@ -77,6 +77,7 @@ enum PROTOCOLS PROTO_V761 = 48, // =>NRF24L01 PROTO_KF606 = 49, // =>NRF24L01 PROTO_REDPINE = 50, // =>CC2500 + PROTO_POTENSIC = 51, // =>NRF24L01 PROTO_XN297DUMP = 63, // =>NRF24L01 }; @@ -620,6 +621,7 @@ Serial: 100000 Baud 8e2 _ xxxx xxxx p -- V761 48 KF606 49 REDPINE 50 + POTENSIC 51 BindBit=> 0x80 1=Bind/0=No AutoBindBit=> 0x40 1=Yes /0=No RangeCheck=> 0x20 1=Yes /0=No diff --git a/Multiprotocol/Multiprotocol.ino b/Multiprotocol/Multiprotocol.ino index 871376c..b858923 100644 --- a/Multiprotocol/Multiprotocol.ino +++ b/Multiprotocol/Multiprotocol.ino @@ -1247,6 +1247,12 @@ static void protocol_init() remote_callback = KF606_callback; break; #endif + #if defined(POTENSIC_NRF24L01_INO) + case PROTO_POTENSIC: + next_callback=initPOTENSIC(); + remote_callback = POTENSIC_callback; + break; + #endif #if defined(XN297DUMP_NRF24L01_INO) case PROTO_XN297DUMP: next_callback=initXN297Dump(); diff --git a/Multiprotocol/POTENSIC_nrf24l01.ino b/Multiprotocol/POTENSIC_nrf24l01.ino new file mode 100644 index 0000000..88895de --- /dev/null +++ b/Multiprotocol/POTENSIC_nrf24l01.ino @@ -0,0 +1,124 @@ +/* + 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(POTENSIC_NRF24L01_INO) + +#include "iface_nrf24l01.h" + +//#define FORCE_POTENSIC_ORIGINAL_ID + +#define POTENSIC_PACKET_PERIOD 4100 // Timeout for callback in uSec +#define POTENSIC_INITIAL_WAIT 500 +#define POTENSIC_PACKET_SIZE 10 +#define POTENSIC_BIND_COUNT 400 +#define POTENSIC_RF_NUM_CHANNELS 4 + +static void __attribute__((unused)) POTENSIC_set_checksum() +{ + uint8_t checksum = packet[1]; + for(uint8_t i=2; i>3; + packet[2] = ((255-convert_channel_8b(RUDDER))&0xF8)|(elevator>>2); + packet[3] = (elevator<<6)|(((255-convert_channel_8b(AILERON))>>2)&0xFE); + packet[4] = 0x20; // Trim + packet[5] = 0x20 // Trim + | GET_FLAG(CH7_SW, 0x80); // High: +100% + packet[6] = 0x20; // Trim + packet[7] = 0x40 // Low: -100% + | GET_FLAG((Channel_data[CH7] > CHANNEL_MIN_COMMAND && !CH7_SW), 0x80) // Medium: 0% + | GET_FLAG((CH5_SW||CH6_SW), 0x02) // Momentary Take off/Landing + Emergency + | GET_FLAG(CH8_SW, 0x04); // Headless: -100%=off,+100%=on + packet[8] = GET_FLAG(CH6_SW, 0x80); // Emergency + } + POTENSIC_set_checksum(); + packet[9] = hopping_frequency_no; + NRF24L01_WriteReg(NRF24L01_05_RF_CH, hopping_frequency[hopping_frequency_no&0x03]); + hopping_frequency_no++; + // Power on, TX mode, 2byte CRC + XN297_Configure(_BV(NRF24L01_00_EN_CRC) | _BV(NRF24L01_00_CRCO) | _BV(NRF24L01_00_PWR_UP)); + NRF24L01_WriteReg(NRF24L01_07_STATUS, 0x70); + NRF24L01_FlushTx(); + XN297_WritePayload(packet, POTENSIC_PACKET_SIZE); + NRF24L01_SetPower(); +} + +static void __attribute__((unused)) POTENSIC_init() +{ + NRF24L01_Initialize(); + NRF24L01_SetTxRxMode(TX_EN); + NRF24L01_FlushTx(); + NRF24L01_FlushRx(); + if(IS_BIND_IN_PROGRESS) + XN297_SetTXAddr((uint8_t*)"\x01\x01\x01\x01\x06", 5); // Bind address + else + XN297_SetTXAddr(rx_tx_addr,5); // Normal address + 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_03_SETUP_AW, 0x03); // set address length (5 bytes) + NRF24L01_WriteReg(NRF24L01_04_SETUP_RETR, 0x00); // no retransmits + NRF24L01_SetBitrate(NRF24L01_BR_1M); // 1Mbps + NRF24L01_SetPower(); + 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); +} + +static void __attribute__((unused)) POTENSIC_initialize_txid() +{ + #ifdef FORCE_POTENSIC_ORIGINAL_ID + memcpy(rx_tx_addr,(uint8_t *)"\xF6\xE0\x20\x00\x0E",5); + #endif + memcpy(hopping_frequency,(uint8_t *)"\x32\x3E\x3A\x36",POTENSIC_RF_NUM_CHANNELS); //50, 62, 58, 54 +} + +uint16_t POTENSIC_callback() +{ + if(IS_BIND_IN_PROGRESS) + if(--bind_counter==0) + { + BIND_DONE; + XN297_SetTXAddr(rx_tx_addr,5); + } + POTENSIC_send_packet(); + return POTENSIC_PACKET_PERIOD; +} + +uint16_t initPOTENSIC(void) +{ + bind_counter = POTENSIC_BIND_COUNT; + POTENSIC_initialize_txid(); + POTENSIC_init(); + hopping_frequency_no = 0; + return POTENSIC_INITIAL_WAIT; +} + +#endif diff --git a/Multiprotocol/Validate.h b/Multiprotocol/Validate.h index 2387495..30b1375 100644 --- a/Multiprotocol/Validate.h +++ b/Multiprotocol/Validate.h @@ -196,6 +196,7 @@ #undef V761_NRF24L01_INO #undef V911S_NRF24L01_INO #undef XN297L_CC2500_EMU + #undef POTENSIC_NRF24L01_INO #endif //Make sure telemetry is selected correctly diff --git a/Multiprotocol/_Config.h b/Multiprotocol/_Config.h index 16fa8d8..b39f7ea 100644 --- a/Multiprotocol/_Config.h +++ b/Multiprotocol/_Config.h @@ -200,7 +200,8 @@ #define KN_NRF24L01_INO #define MJXQ_NRF24L01_INO #define MT99XX_NRF24L01_INO -#define NCC1701_NRF24L01_INO +#define NCC1701_NRF24L01_INO +#define POTENSIC_NRF24L01_INO #define Q303_NRF24L01_INO #define SHENQI_NRF24L01_INO #define SLT_NRF24L01_INO @@ -592,6 +593,8 @@ const PPM_Parameters PPM_prot[14*NBR_BANKS]= { FY805 PROTO_NCC1701 NONE + PROTO_POTENSIC + NONE PROTO_Q2X2 Q222 Q242 diff --git a/Protocols_Details.md b/Protocols_Details.md index 12365b0..ccc0ff0 100644 --- a/Protocols_Details.md +++ b/Protocols_Details.md @@ -103,8 +103,10 @@ CFlie|38|CFlie||||||||NRF24L01 [MT99xx](Protocols_Details.md#MT99XX---17)|17|MT|H7|YZ|LS|FY805||||NRF24L01 [NCC1701](Protocols_Details.md#NCC1701---44)|44|NCC1701||||||||NRF24L01 [OpenLRS](Protocols_Details.md#OpenLRS---27)|27|||||||||None +[Potensic](Protocols_Details.md#Potensic---51)|51|A20||||||||NRF24L01 [Q2X2](Protocols_Details.md#Q2X2---29)|29|Q222|Q242|Q282||||||NRF24L01 [Q303](Protocols_Details.md#Q303---31)|31|Q303|CX35|CX10D|CX10WD|||||NRF24L01 +[Redpine](Protocols_Details.md#Redpine---50)|50|FAST|SLOW|||||||NRF24L01 [SFHSS](Protocols_Details.md#SFHSS---21)|21|SFHSS||||||||CC2500 [Shenqi](Protocols_Details.md#Shenqi---19)|19|Shenqi||||||||NRF24L01 [SLT](Protocols_Details.md#SLT---11)|11|SLT_V1|SLT_V2|Q100|Q200|MR100||||NRF24L01 @@ -944,6 +946,21 @@ CH1|CH2|CH3|CH4|CH5 ---|---|---|---|--- A|E|T|R|Warp +## Potensic - *51* +Models: Potensic A20 + +CH1|CH2|CH3|CH4|CH5|CH6|CH7|CH8 +---|---|---|---|---|---|---|--- +A|E|T|R|TAKE_OFF/LANDING|EMERGENCY|MODE|HEADLESS + +TAKE_OFF/LANDING: momentary switch -100% -> +100% + +EMERGENCY: Stop +100% + +MODE: Beginner -100%, Medium 0%, Advanced +100% + +HEADLESS: Off -100%, On +100% + ## Q2X2 - *29* ### Sub_protocol Q222 - *0* Models: Q222 v1 and V686 v2 @@ -994,6 +1011,12 @@ ARM|FLIP ARM is 3 positions: -100%=land / 0%=manual / +100%=take off +##Redpine - *50* +[Link](https://www.rcgroups.com/forums/showthread.php?3236043-Redpine-Lowest-latency-RC-protocol) + +### Sub_protocol FAST - *0* +### Sub_protocol SLOW - *1* + ## Shenqi - *19* Autobind protocol