diff --git a/Multiprotocol/FX_nrf24l01.ino b/Multiprotocol/FX_nrf24l01.ino index 76d2185..d1566a9 100644 --- a/Multiprotocol/FX_nrf24l01.ino +++ b/Multiprotocol/FX_nrf24l01.ino @@ -34,13 +34,12 @@ Multiprotocol is distributed in the hope that it will be useful, #define FX620_CH_OFFSET 1 #define FX9630_PACKET_PERIOD 8124 //8156 on QIDI-560 -#define FX9630_BIND_PACKET_PERIOD 8124 #define FX9630_BIND_CHANNEL 51 #define FX9630_PAYLOAD_SIZE 8 #define FX9630_NUM_CHANNELS 3 #define FX9630_WRITE_TIME 500 -#define FX_QF012_BIND_PACKET_PERIOD 12194 +#define FX_QF012_PACKET_PERIOD 12194 #define FX_QF012_RX_PAYLOAD_SIZE 3 //#define FORCE_FX620_ID @@ -199,7 +198,7 @@ static void __attribute__((unused)) FX_RF_init() { XN297_SetTXAddr((uint8_t *)"\x56\x78\x90\x12", 4); XN297_RFChannel(FX9630_BIND_CHANNEL); - packet_period = sub_protocol == FX_QF012 ? FX_QF012_BIND_PACKET_PERIOD : FX9630_BIND_PACKET_PERIOD; + packet_period = sub_protocol == FX_QF012 ? FX_QF012_PACKET_PERIOD : FX9630_PACKET_PERIOD; packet_length = FX9630_PAYLOAD_SIZE; } } @@ -291,7 +290,7 @@ uint16_t FX_callback() {//Good CRC //packets: A5 00 11 -> A5 01 11 telemetry_link = 1; - v_lipo1 = packet_in[1] == 0x01 ? 60:81; // low voltage + v_lipo1 = packet_in[1] ? 60:81; // low voltage 3.7V #if 0 for(uint8_t i=0; i < FX_QF012_RX_PAYLOAD_SIZE; i++) debug(" %02X", packet_in[i]); diff --git a/Multiprotocol/Multiprotocol.h b/Multiprotocol/Multiprotocol.h index e9391f3..3b3c2c6 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 48 +#define VERSION_PATCH_LEVEL 49 #define MODE_SERIAL 0 diff --git a/Multiprotocol/XK2_ccnrf.ino b/Multiprotocol/XK2_ccnrf.ino index 0337bcc..f0ae8ef 100644 --- a/Multiprotocol/XK2_ccnrf.ino +++ b/Multiprotocol/XK2_ccnrf.ino @@ -21,19 +21,30 @@ Multiprotocol is distributed in the hope that it will be useful, //#define FORCE_XK2_ID //#define FORCE_XK2_P10_ID -#define XK2_RF_BIND_CHANNEL 71 +#define XK2_RF_BIND_CHANNEL 71 #define XK2_P10_RF_BIND_CHANNEL 69 -#define XK2_PAYLOAD_SIZE 9 -#define XK2_PACKET_PERIOD 4911 -#define XK2_RF_NUM_CHANNELS 4 +#define XK2_PAYLOAD_SIZE 9 +#define XK2_PACKET_PERIOD 4911 +#define XK2_RF_NUM_CHANNELS 4 +#define XK2_WRITE_TIME 1000 enum { XK2_BIND1, XK2_BIND2, XK2_DATA_PREP, - XK2_DATA + XK2_DATA, + XK2_RX, }; +static uint8_t __attribute__((unused)) XK2_checksum(uint8_t init) +{ + for(uint8_t i=0; i CHANNEL_MIN_COMMAND) packet[5] |= 0x08; //3D - - //Telemetry not received=00, Telemetry received=01 but sometimes switch to 1 even if telemetry is not there... - packet[6] = 0x00; + //Requiest telemetry flag + packet[6] = 0x01; //RXID checksum packet[7] = crc8; //Sum RX_ID[0..2] - //Checksum seed - packet[8] = num_ch; //Based on TX ID } //Checksum - for(uint8_t i=0; i E5 20 F2 80 00 00 00 00 43 + telemetry_link = 1; + v_lipo1 = packet[3] ? 137:162; // low voltage 7.1V + } + } + #endif if(bind_counter) { bind_counter--; if(bind_counter == 0) - { phase = XK2_DATA_PREP; - //phase = XK2_BIND1; - } + break; } - XK2_send_packet(); + #ifndef XK2_HUB_TELEMETRY break; + #else + phase++; + return XK2_WRITE_TIME; + default: //XK2_RX + /*{ // Wait for packet to be sent before switching to receive mode + uint16_t start=(uint16_t)micros(), count=0; + while ((uint16_t)((uint16_t)micros()-(uint16_t)start) < 500) + { + if(XN297_IsPacketSent()) + break; + count++; + } + debugln("%d",count); + }*/ + //Switch to RX + XN297_SetTxRxMode(TXRX_OFF); + XN297_SetTxRxMode(RX_EN); + phase = XK2_DATA; + return XK2_PACKET_PERIOD-XK2_WRITE_TIME; + #endif } return XK2_PACKET_PERIOD; } @@ -242,6 +286,9 @@ void XK2_init() phase = XK2_DATA_PREP; bind_counter = 0; hopping_frequency_no = 0; + #ifdef XK2_HUB_TELEMETRY + RX_RSSI = 100; // Dummy value + #endif } #endif diff --git a/Multiprotocol/_Config.h b/Multiprotocol/_Config.h index 9f4d65b..d0aa66f 100644 --- a/Multiprotocol/_Config.h +++ b/Multiprotocol/_Config.h @@ -350,6 +350,7 @@ #define V761_HUB_TELEMETRY // Use FrSkyD Hub format to send telemetry to TX #define KAMTOM_HUB_TELEMETRY // Use FrSkyD Hub format to send telemetry to TX #define FX_HUB_TELEMETRY // Use FrSkyD Hub format to send telemetry to TX +#define XK2_HUB_TELEMETRY // Use FrSkyD Hub format to send telemetry to TX #define YUXIANG_HUB_TELEMETRY // Use FrSkyD Hub format to send telemetry to TX #define PROPEL_HUB_TELEMETRY // Use FrSkyD Hub format to send telemetry to TX #define CABELL_HUB_TELEMETRY // Use FrSkyD Hub format to send telemetry to TX diff --git a/Protocols_Details.md b/Protocols_Details.md index b657b00..837148a 100644 --- a/Protocols_Details.md +++ b/Protocols_Details.md @@ -1579,6 +1579,8 @@ A|E|T|R|Rate|Mode|Hover|Light The plane does not need to be bound each time if it is powered on **after** the radio/protocol is on. +Telemetry is supported. The plane sends a battery status of good->empty which is visible in A1 (good=8.4V->empty=7.1V) and RSSI gets a dummy value of 100. + The rudder trim is driven from the rudder channel to increase the range (Original TX rudder has no range once the motor has been turned on...). Mode: -100%=6G, 0%=3D, +100%=Gyro off (Senior mode)