mirror of
https://github.com/pascallanger/DIY-Multiprotocol-TX-Module.git
synced 2025-07-01 10:17:53 +00:00
Hitec: new protocol
Hitec protocol using the CC2500 RF component Protocol number: 39 Sub protocols: - Optima (0): the TX must be really close to the RX for the bind negociation to complete. - Minima (1): untested Optima supports basic telemetry using the FrSky Hub format: RX volt, TX RSSI,&LQI
This commit is contained in:
parent
0b8ff15133
commit
d9f343e20b
@ -177,12 +177,6 @@ static void AFHDS2A_build_packet(uint8_t type)
|
|||||||
packet[0] = 0x58;
|
packet[0] = 0x58;
|
||||||
for(uint8_t ch=0; ch<14; ch++)
|
for(uint8_t ch=0; ch<14; ch++)
|
||||||
{
|
{
|
||||||
if(ch >= 12) // limit to 12 channels, 14 needs to be tested
|
|
||||||
{
|
|
||||||
packet[9 + ch*2] = 0xdc;
|
|
||||||
packet[10 + ch*2] = 0x05;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
uint16_t channelMicros = convert_channel_ppm(CH_AETR[ch]);
|
uint16_t channelMicros = convert_channel_ppm(CH_AETR[ch]);
|
||||||
packet[9 + ch*2] = channelMicros&0xFF;
|
packet[9 + ch*2] = channelMicros&0xFF;
|
||||||
packet[10 + ch*2] = (channelMicros>>8)&0xFF;
|
packet[10 + ch*2] = (channelMicros>>8)&0xFF;
|
||||||
|
340
Multiprotocol/Hitec_cc2500.ino
Normal file
340
Multiprotocol/Hitec_cc2500.ino
Normal file
@ -0,0 +1,340 @@
|
|||||||
|
/*
|
||||||
|
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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined(HITEC_CC2500_INO)
|
||||||
|
|
||||||
|
#include "iface_cc2500.h"
|
||||||
|
|
||||||
|
//#define HITEC_FORCE_ID //Use the ID and hopping table from original dump
|
||||||
|
|
||||||
|
#define HITEC_COARSE 0
|
||||||
|
|
||||||
|
#define HITEC_PACKET_LEN 13
|
||||||
|
#define HITEC_TX_ID_LEN 2
|
||||||
|
#define HITEC_BIND_COUNT 444 // 10sec
|
||||||
|
#define HITEC_NUM_FREQUENCE 21
|
||||||
|
#define HITEC_BIND_NUM_FREQUENCE 14
|
||||||
|
|
||||||
|
enum {
|
||||||
|
HITEC_START = 0x00,
|
||||||
|
HITEC_CALIB = 0x01,
|
||||||
|
HITEC_PREP = 0x02,
|
||||||
|
HITEC_DATA1 = 0x03,
|
||||||
|
HITEC_DATA2 = 0x04,
|
||||||
|
HITEC_DATA3 = 0x05,
|
||||||
|
HITEC_DATA4 = 0x06,
|
||||||
|
HITEC_RX1 = 0x07,
|
||||||
|
HITEC_RX2 = 0x08,
|
||||||
|
};
|
||||||
|
|
||||||
|
#define HITEC_FREQ0_VAL 0xE8
|
||||||
|
|
||||||
|
const PROGMEM uint8_t HITEC_init_values[] = {
|
||||||
|
/* 00 */ 0x2F, 0x2E, 0x2F, 0x07, 0xD3, 0x91, 0xFF, 0x04,
|
||||||
|
/* 08 */ 0x45, 0x00, 0x00, 0x12, 0x00, 0x5C, 0x85, HITEC_FREQ0_VAL + HITEC_COARSE,
|
||||||
|
/* 10 */ 0x3D, 0x3B, 0x73, 0x73, 0x7A, 0x01, 0x07, 0x30,
|
||||||
|
/* 18 */ 0x08, 0x1D, 0x1C, 0xC7, 0x00, 0xB0, 0x87, 0x6B,
|
||||||
|
/* 20 */ 0xF8, 0xB6, 0x10, 0xEA, 0x0A, 0x00, 0x11
|
||||||
|
};
|
||||||
|
|
||||||
|
static void __attribute__((unused)) HITEC_CC2500_init()
|
||||||
|
{
|
||||||
|
CC2500_Strobe(CC2500_SIDLE);
|
||||||
|
|
||||||
|
for (uint8_t i = 0; i < 39; ++i)
|
||||||
|
CC2500_WriteReg(i, pgm_read_byte_near(&HITEC_init_values[i]));
|
||||||
|
|
||||||
|
prev_option = option;
|
||||||
|
CC2500_WriteReg(CC2500_0C_FSCTRL0, option);
|
||||||
|
|
||||||
|
CC2500_SetTxRxMode(TX_EN);
|
||||||
|
CC2500_SetPower();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Generate RF channels
|
||||||
|
static void __attribute__((unused)) HITEC_RF_channels()
|
||||||
|
{
|
||||||
|
//Normal hopping
|
||||||
|
uint8_t idx = 0;
|
||||||
|
uint32_t rnd = MProtocol_id;
|
||||||
|
|
||||||
|
while (idx < HITEC_NUM_FREQUENCE)
|
||||||
|
{
|
||||||
|
uint8_t i;
|
||||||
|
uint8_t count_0_47 = 0, count_48_93 = 0, count_94_140 = 0;
|
||||||
|
|
||||||
|
rnd = rnd * 0x0019660D + 0x3C6EF35F; // Randomization
|
||||||
|
// Use least-significant byte and make sure it's pair.
|
||||||
|
uint8_t next_ch = ((rnd >> 8) % 141) & 0xFE;
|
||||||
|
// Check that it's not duplicated and spread uniformly
|
||||||
|
for (i = 0; i < idx; i++) {
|
||||||
|
if(hopping_frequency[i] == next_ch)
|
||||||
|
break;
|
||||||
|
if(hopping_frequency[i] <= 47)
|
||||||
|
count_0_47++;
|
||||||
|
else if (hopping_frequency[i] <= 93)
|
||||||
|
count_48_93++;
|
||||||
|
else
|
||||||
|
count_94_140++;
|
||||||
|
}
|
||||||
|
if (i != idx)
|
||||||
|
continue;
|
||||||
|
if ( (next_ch <= 47 && count_0_47 < 8) || (next_ch >= 48 && next_ch <= 93 && count_48_93 < 8) || (next_ch >= 94 && count_94_140 < 8) )
|
||||||
|
hopping_frequency[idx++] = next_ch;//find hopping frequency
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void __attribute__((unused)) HITEC_tune_chan()
|
||||||
|
{
|
||||||
|
CC2500_Strobe(CC2500_SIDLE);
|
||||||
|
if(IS_BIND_IN_PROGRESS)
|
||||||
|
CC2500_WriteReg(CC2500_0A_CHANNR, hopping_frequency_no*10);
|
||||||
|
else
|
||||||
|
CC2500_WriteReg(CC2500_0A_CHANNR, hopping_frequency[hopping_frequency_no]);
|
||||||
|
CC2500_Strobe(CC2500_SFTX);
|
||||||
|
CC2500_Strobe(CC2500_SCAL);
|
||||||
|
CC2500_Strobe(CC2500_STX);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void __attribute__((unused)) HITEC_change_chan_fast()
|
||||||
|
{
|
||||||
|
CC2500_Strobe(CC2500_SIDLE);
|
||||||
|
if(IS_BIND_IN_PROGRESS)
|
||||||
|
CC2500_WriteReg(CC2500_0A_CHANNR, hopping_frequency_no*10);
|
||||||
|
else
|
||||||
|
CC2500_WriteReg(CC2500_0A_CHANNR, hopping_frequency[hopping_frequency_no]);
|
||||||
|
CC2500_WriteReg(CC2500_25_FSCAL1, calData[hopping_frequency_no]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Channel values are 12-bit values between 1020 and 2020, 1520 is the middle.
|
||||||
|
// Futaba @140% is 2070...1520...970
|
||||||
|
// Values grow down and to the right.
|
||||||
|
static void __attribute__((unused)) HITEC_build_packet()
|
||||||
|
{
|
||||||
|
packet[1] = 0x00; // unknown always 0x00 and does not seem to work if different
|
||||||
|
packet[2] = rx_tx_addr[3];
|
||||||
|
packet[3] = rx_tx_addr[2];
|
||||||
|
packet[22] = 0xEE; // unknown always 0xEE
|
||||||
|
if(IS_BIND_IN_PROGRESS)
|
||||||
|
{
|
||||||
|
packet[0] = 0x16; // 22 bytes to follow
|
||||||
|
memset(packet+5,0x00,14);
|
||||||
|
switch(bind_phase)
|
||||||
|
{
|
||||||
|
case 0x72:
|
||||||
|
for(uint8_t i=0;i<14;i++)
|
||||||
|
packet[5+i]=hopping_frequency[i]>>1;
|
||||||
|
break;
|
||||||
|
case 0x73:
|
||||||
|
for(uint8_t i=0;i<7;i++)
|
||||||
|
packet[5+i]=hopping_frequency[i+14]>>1;
|
||||||
|
break;
|
||||||
|
case 0x74:
|
||||||
|
packet[7]=0x55; // unknown but bind does not complete if not there
|
||||||
|
packet[8]=0x55; // unknown but bind does not complete if not there
|
||||||
|
break;
|
||||||
|
case 0x7B:
|
||||||
|
packet[5]=hopping_frequency[13]>>1; // if not there the link is jerky...
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if(sub_protocol==OPTIMA)
|
||||||
|
packet[4] = bind_phase; // increments based on RX answer
|
||||||
|
else
|
||||||
|
{
|
||||||
|
packet[4] = bind_phase+0x10;
|
||||||
|
bind_phase^=0x01; // switch between 0x82 (first part of the hopping table) and 0x83 (second part)
|
||||||
|
}
|
||||||
|
packet[19] = 0x08; // packet number
|
||||||
|
packet[20] = 0x00; // starts with 0x00 and after some time it alternates between 0x00 and 0xF5
|
||||||
|
packet[21] = 0x00; // unknown when [20]=0xF5 then the value is 0xE0 or 0xDC
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
packet[0] = 0x1A; // 26 bytes to follow
|
||||||
|
for(uint8_t i=0;i<9;i++)
|
||||||
|
{
|
||||||
|
uint16_t ch = convert_channel_16b_nolimit(i,0x1B87,0x3905);
|
||||||
|
packet[4+2*i] = ch >> 8;
|
||||||
|
packet[5+2*i] = ch & 0xFF;
|
||||||
|
}
|
||||||
|
packet[23] = 0x80; // packet number
|
||||||
|
packet[24] = 0x00; // starts with 0x00 and after some time it alternates between 0x00 and 0xF5
|
||||||
|
packet[25] = 0x00; // unknown when [24]=0xF5 then the value is 0xDB or 0xDF
|
||||||
|
packet[26] = 0x00; // unknown always 0 and the RX doesn't seem to care about the value?
|
||||||
|
}
|
||||||
|
/* debug("P:");
|
||||||
|
for(uint8_t i=0;i<packet[0]+1;i++)
|
||||||
|
debug("%02X,",packet[i]);
|
||||||
|
debugln("");
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
static void __attribute__((unused)) HITEC_send_packet()
|
||||||
|
{
|
||||||
|
CC2500_WriteData(packet, packet[0]+1);
|
||||||
|
if(IS_BIND_IN_PROGRESS)
|
||||||
|
packet[19] >>= 1; // packet number
|
||||||
|
else
|
||||||
|
packet[23] >>= 1; // packet number
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t ReadHITEC()
|
||||||
|
{
|
||||||
|
switch(phase)
|
||||||
|
{
|
||||||
|
case HITEC_START:
|
||||||
|
HITEC_CC2500_init();
|
||||||
|
bind_phase=0x72;
|
||||||
|
if(IS_BIND_IN_PROGRESS)
|
||||||
|
{
|
||||||
|
bind_counter = HISKY_BIND_COUNT;
|
||||||
|
rf_ch_num=HITEC_BIND_NUM_FREQUENCE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
bind_counter=0;
|
||||||
|
rf_ch_num=HITEC_NUM_FREQUENCE;
|
||||||
|
//Set TXID
|
||||||
|
CC2500_WriteReg(CC2500_04_SYNC1,rx_tx_addr[2]);
|
||||||
|
CC2500_WriteReg(CC2500_05_SYNC0,rx_tx_addr[3]);
|
||||||
|
}
|
||||||
|
hopping_frequency_no=0;
|
||||||
|
HITEC_tune_chan();
|
||||||
|
phase = HITEC_CALIB;
|
||||||
|
return 2000;
|
||||||
|
case HITEC_CALIB:
|
||||||
|
calData[hopping_frequency_no]=CC2500_ReadReg(CC2500_25_FSCAL1);
|
||||||
|
hopping_frequency_no++;
|
||||||
|
if (hopping_frequency_no < rf_ch_num)
|
||||||
|
HITEC_tune_chan();
|
||||||
|
else
|
||||||
|
{
|
||||||
|
hopping_frequency_no = 0;
|
||||||
|
phase = HITEC_PREP;
|
||||||
|
}
|
||||||
|
return 2000;
|
||||||
|
|
||||||
|
/* Work cycle: 22.5ms */
|
||||||
|
#define HITEC_PACKET_PERIOD 22500
|
||||||
|
#define HITEC_PREP_TIMING 462
|
||||||
|
#define HITEC_DATA_TIMING 2736
|
||||||
|
#define HITEC_RX1_TIMING 4636
|
||||||
|
case HITEC_PREP:
|
||||||
|
if ( prev_option == option )
|
||||||
|
{ // No user frequency change
|
||||||
|
HITEC_change_chan_fast();
|
||||||
|
hopping_frequency_no++;
|
||||||
|
if(hopping_frequency_no>=rf_ch_num)
|
||||||
|
hopping_frequency_no=0;
|
||||||
|
CC2500_SetPower();
|
||||||
|
CC2500_SetTxRxMode(TX_EN);
|
||||||
|
HITEC_build_packet();
|
||||||
|
phase++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
phase = HITEC_START; // Restart the tune process if option is changed to get good tuned values
|
||||||
|
return HITEC_PREP_TIMING;
|
||||||
|
case HITEC_DATA1:
|
||||||
|
case HITEC_DATA2:
|
||||||
|
case HITEC_DATA3:
|
||||||
|
case HITEC_DATA4:
|
||||||
|
HITEC_send_packet();
|
||||||
|
phase++;
|
||||||
|
return HITEC_DATA_TIMING;
|
||||||
|
case HITEC_RX1:
|
||||||
|
CC2500_SetTxRxMode(RX_EN);
|
||||||
|
CC2500_Strobe(CC2500_SRX); // Turn RX ON
|
||||||
|
phase++;
|
||||||
|
return HITEC_RX1_TIMING;
|
||||||
|
case HITEC_RX2:
|
||||||
|
uint8_t len=CC2500_ReadReg(CC2500_3B_RXBYTES | CC2500_READ_BURST) & 0x7F;
|
||||||
|
if(len && len<MAX_PKT)
|
||||||
|
{ // Something has been received
|
||||||
|
CC2500_ReadData(pkt, len);
|
||||||
|
if( (pkt[len-1] & 0x80) && pkt[0]==len-3 && packet[2]==rx_tx_addr[3] && packet[3]==rx_tx_addr[2])
|
||||||
|
{ //valid crc && length ok && tx_id ok
|
||||||
|
debug("RX:l=%d",len);
|
||||||
|
for(uint8_t i=0;i<len;i++)
|
||||||
|
debug(",%02X",pkt[i]);
|
||||||
|
if(IS_BIND_IN_PROGRESS)
|
||||||
|
{
|
||||||
|
if(len==13) // Bind packets have a length of 13
|
||||||
|
{ // bind packet 0A,00,E5,F2,7X,05,06,07,08,09,00
|
||||||
|
debug(",bind");
|
||||||
|
boolean check=true;
|
||||||
|
for(uint8_t i=5;i<=10;i++)
|
||||||
|
if(pkt[i]!=i%10) check=false;
|
||||||
|
if((pkt[4]&0xF0)==0x70 && check)
|
||||||
|
{
|
||||||
|
bind_phase=pkt[4]+1;
|
||||||
|
if(bind_phase==0x7B)
|
||||||
|
bind_counter=164; // in dumps the RX stops to reply at 0x7B so wait a little and exit
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if(len==15) // Telemetry packets have a length of 15
|
||||||
|
{ //Not fully handled since the RX I have only send 1 frame where from what I've been reading on Hitec telemetry should have at least 4 frames...
|
||||||
|
debug(",telem");
|
||||||
|
#if defined(HITEC_HUB_TELEMETRY)
|
||||||
|
TX_RSSI = pkt[len-2];
|
||||||
|
if(TX_RSSI >=128)
|
||||||
|
TX_RSSI -= 128;
|
||||||
|
else
|
||||||
|
TX_RSSI += 128;
|
||||||
|
TX_LQI = pkt[len-1]&0x7F;
|
||||||
|
if(pkt[1]==0x00) // Telemetry frame number???
|
||||||
|
v_lipo1 = (pkt[len-3])<<5 | (pkt[len-4])>>3; // calculation in decimal is volt=(pkt[len-3]<<8+pkt[len-4])/28
|
||||||
|
telemetry_link=1;
|
||||||
|
#elif defined(HITEC_FW_TELEMETRY)
|
||||||
|
pkt[0]=pkt[1]; // Telemetry frame number???
|
||||||
|
for(uint8_t i=4;i < len; i++)
|
||||||
|
pkt[i-3]=pkt[i];
|
||||||
|
telemetry_link=2;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
debugln("");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CC2500_Strobe(CC2500_SRX); // Flush the RX FIFO buffer
|
||||||
|
phase = HITEC_PREP;
|
||||||
|
if(bind_counter)
|
||||||
|
{
|
||||||
|
bind_counter--;
|
||||||
|
if(!bind_counter)
|
||||||
|
{
|
||||||
|
BIND_DONE;
|
||||||
|
phase=HITEC_START;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return (HITEC_PACKET_PERIOD -HITEC_PREP_TIMING -4*HITEC_DATA_TIMING -HITEC_RX1_TIMING);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t initHITEC()
|
||||||
|
{
|
||||||
|
HITEC_RF_channels();
|
||||||
|
#ifdef HITEC_FORCE_ID
|
||||||
|
// ID and channels taken from dump
|
||||||
|
rx_tx_addr[3]=0x6A;
|
||||||
|
rx_tx_addr[2]=0x03;
|
||||||
|
memcpy((void *)hopping_frequency,(void *)"\x00\x3A\x4A\x32\x0C\x58\x2A\x10\x26\x20\x08\x60\x68\x70\x78\x80\x88\x56\x5E\x66\x6E",HITEC_NUM_FREQUENCE);
|
||||||
|
#endif
|
||||||
|
phase = HITEC_START;
|
||||||
|
return 10000;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
@ -36,4 +36,4 @@
|
|||||||
36,H8_3D,H8_3D,H20H,H20Mini,H30Mini
|
36,H8_3D,H8_3D,H20H,H20Mini,H30Mini
|
||||||
37,CORONA,COR_V1,COR_V2,FD_V3
|
37,CORONA,COR_V1,COR_V2,FD_V3
|
||||||
38,CFlie
|
38,CFlie
|
||||||
|
39,Hitec,Optima,Minima
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
#define VERSION_MAJOR 1
|
#define VERSION_MAJOR 1
|
||||||
#define VERSION_MINOR 2
|
#define VERSION_MINOR 2
|
||||||
#define VERSION_REVISION 0
|
#define VERSION_REVISION 0
|
||||||
#define VERSION_PATCH_LEVEL 22
|
#define VERSION_PATCH_LEVEL 23
|
||||||
|
|
||||||
//******************
|
//******************
|
||||||
// Protocols
|
// Protocols
|
||||||
@ -65,6 +65,7 @@ enum PROTOCOLS
|
|||||||
PROTO_H8_3D = 36, // =>NRF24L01
|
PROTO_H8_3D = 36, // =>NRF24L01
|
||||||
PROTO_CORONA = 37, // =>CC2500
|
PROTO_CORONA = 37, // =>CC2500
|
||||||
PROTO_CFLIE = 38, // =>NRF24L01
|
PROTO_CFLIE = 38, // =>NRF24L01
|
||||||
|
PROTO_HITEC = 39, // =>CC2500
|
||||||
};
|
};
|
||||||
|
|
||||||
enum Flysky
|
enum Flysky
|
||||||
@ -231,6 +232,11 @@ enum CORONA
|
|||||||
COR_V2 = 1,
|
COR_V2 = 1,
|
||||||
FD_V3 = 2,
|
FD_V3 = 2,
|
||||||
};
|
};
|
||||||
|
enum HITEC
|
||||||
|
{
|
||||||
|
OPTIMA = 0,
|
||||||
|
MINIMA = 1,
|
||||||
|
};
|
||||||
|
|
||||||
#define NONE 0
|
#define NONE 0
|
||||||
#define P_HIGH 1
|
#define P_HIGH 1
|
||||||
@ -261,6 +267,7 @@ enum MultiPacketTypes
|
|||||||
MULTI_TELEMETRY_CONFIG = 7,
|
MULTI_TELEMETRY_CONFIG = 7,
|
||||||
MULTI_TELEMETRY_SYNC = 8,
|
MULTI_TELEMETRY_SYNC = 8,
|
||||||
MULTI_TELEMETRY_SPORT_POLLING = 9,
|
MULTI_TELEMETRY_SPORT_POLLING = 9,
|
||||||
|
MULTI_TELEMETRY_HITEC = 10,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Macros
|
// Macros
|
||||||
@ -560,6 +567,7 @@ Serial: 100000 Baud 8e2 _ xxxx xxxx p --
|
|||||||
H8_3D 36
|
H8_3D 36
|
||||||
CORONA 37
|
CORONA 37
|
||||||
CFlie 38
|
CFlie 38
|
||||||
|
Hitec 39
|
||||||
BindBit=> 0x80 1=Bind/0=No
|
BindBit=> 0x80 1=Bind/0=No
|
||||||
AutoBindBit=> 0x40 1=Yes /0=No
|
AutoBindBit=> 0x40 1=Yes /0=No
|
||||||
RangeCheck=> 0x20 1=Yes /0=No
|
RangeCheck=> 0x20 1=Yes /0=No
|
||||||
@ -680,6 +688,9 @@ Serial: 100000 Baud 8e2 _ xxxx xxxx p --
|
|||||||
COR_V1 0
|
COR_V1 0
|
||||||
COR_V2 1
|
COR_V2 1
|
||||||
FD_V3 2
|
FD_V3 2
|
||||||
|
sub_protocol==HITEC
|
||||||
|
OPTIMA 0
|
||||||
|
MINIMA 1
|
||||||
|
|
||||||
Power value => 0x80 0=High/1=Low
|
Power value => 0x80 0=High/1=Low
|
||||||
Stream[3] = option_protocol;
|
Stream[3] = option_protocol;
|
||||||
@ -780,4 +791,8 @@ Serial: 100000 Baud 8e2 _ xxxx xxxx p --
|
|||||||
data[0] = RSSI value
|
data[0] = RSSI value
|
||||||
data[1-28] telemetry data
|
data[1-28] telemetry data
|
||||||
|
|
||||||
|
Type 0x0A Hitec telemetry data
|
||||||
|
length: 12
|
||||||
|
data[0-10] telemetry data
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
@ -431,6 +431,11 @@ void setup()
|
|||||||
if (protocol==PROTO_CORONA)
|
if (protocol==PROTO_CORONA)
|
||||||
option = FORCE_CORONA_TUNING; // Use config-defined tuning value for CORONA
|
option = FORCE_CORONA_TUNING; // Use config-defined tuning value for CORONA
|
||||||
else
|
else
|
||||||
|
#endif
|
||||||
|
#if defined(FORCE_HITEC_TUNING) && defined(HITEC_CC2500_INO)
|
||||||
|
if (protocol==PROTO_HITEC)
|
||||||
|
option = FORCE_HITEC_TUNING; // Use config-defined tuning value for HITEC
|
||||||
|
else
|
||||||
#endif
|
#endif
|
||||||
option = PPM_prot[line].option; // Use radio-defined option value
|
option = PPM_prot[line].option; // Use radio-defined option value
|
||||||
|
|
||||||
@ -605,7 +610,7 @@ uint8_t Update_All()
|
|||||||
update_led_status();
|
update_led_status();
|
||||||
#if defined(TELEMETRY)
|
#if defined(TELEMETRY)
|
||||||
#if ( !( defined(MULTI_TELEMETRY) || defined(MULTI_STATUS) ) )
|
#if ( !( defined(MULTI_TELEMETRY) || defined(MULTI_STATUS) ) )
|
||||||
if( (protocol==PROTO_FRSKYD) || (protocol==PROTO_BAYANG) || (protocol==PROTO_HUBSAN) || (protocol==PROTO_AFHDS2A) || (protocol==PROTO_FRSKYX) || (protocol==PROTO_DSM) || (protocol==PROTO_CABELL) )
|
if( (protocol==PROTO_FRSKYD) || (protocol==PROTO_BAYANG) || (protocol==PROTO_HUBSAN) || (protocol==PROTO_AFHDS2A) || (protocol==PROTO_FRSKYX) || (protocol==PROTO_DSM) || (protocol==PROTO_CABELL) || (protocol==PROTO_HITEC))
|
||||||
#endif
|
#endif
|
||||||
TelemetryUpdate();
|
TelemetryUpdate();
|
||||||
#endif
|
#endif
|
||||||
@ -948,6 +953,14 @@ static void protocol_init()
|
|||||||
remote_callback = ReadCORONA;
|
remote_callback = ReadCORONA;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(HITEC_CC2500_INO)
|
||||||
|
case PROTO_HITEC:
|
||||||
|
PE1_off; //antenna RF2
|
||||||
|
PE2_on;
|
||||||
|
next_callback = initHITEC();
|
||||||
|
remote_callback = ReadHITEC;
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#ifdef CYRF6936_INSTALLED
|
#ifdef CYRF6936_INSTALLED
|
||||||
#if defined(DSM_CYRF6936_INO)
|
#if defined(DSM_CYRF6936_INO)
|
||||||
@ -1236,6 +1249,11 @@ void update_serial_data()
|
|||||||
if (protocol==PROTO_CORONA)
|
if (protocol==PROTO_CORONA)
|
||||||
option=FORCE_CORONA_TUNING; // Use config-defined tuning value for CORONA
|
option=FORCE_CORONA_TUNING; // Use config-defined tuning value for CORONA
|
||||||
else
|
else
|
||||||
|
#endif
|
||||||
|
#if defined(FORCE_HITEC_TUNING) && defined(HITEC_CC2500_INO)
|
||||||
|
if (protocol==PROTO_HITEC)
|
||||||
|
option=FORCE_HITEC_TUNING; // Use config-defined tuning value for HITEC
|
||||||
|
else
|
||||||
#endif
|
#endif
|
||||||
option=rx_ok_buff[3]; // Use radio-defined option value
|
option=rx_ok_buff[3]; // Use radio-defined option value
|
||||||
|
|
||||||
|
@ -349,7 +349,7 @@ void frsky_link_frame()
|
|||||||
telemetry_link |= 2 ; // Send hub if available
|
telemetry_link |= 2 ; // Send hub if available
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (protocol==PROTO_HUBSAN||protocol==PROTO_AFHDS2A||protocol==PROTO_BAYANG||protocol==PROTO_CABELL)
|
if (protocol==PROTO_HUBSAN||protocol==PROTO_AFHDS2A||protocol==PROTO_BAYANG||protocol==PROTO_CABELL||protocol==PROTO_HITEC)
|
||||||
{
|
{
|
||||||
frame[1] = v_lipo1;
|
frame[1] = v_lipo1;
|
||||||
frame[2] = v_lipo2;
|
frame[2] = v_lipo2;
|
||||||
|
@ -87,6 +87,11 @@
|
|||||||
#error "The CORONA forced frequency tuning value is outside of the range -127..127."
|
#error "The CORONA forced frequency tuning value is outside of the range -127..127."
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef FORCE_HITEC_TUNING
|
||||||
|
#if ( FORCE_HITEC_TUNING < -127 ) || ( FORCE_HITEC_TUNING > 127 )
|
||||||
|
#error "The HITEC forced frequency tuning value is outside of the range -127..127."
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
#ifdef FORCE_FLYSKY_TUNING
|
#ifdef FORCE_FLYSKY_TUNING
|
||||||
#if ( FORCE_FLYSKY_TUNING < -300 ) || ( FORCE_FLYSKY_TUNING > 300 )
|
#if ( FORCE_FLYSKY_TUNING < -300 ) || ( FORCE_FLYSKY_TUNING > 300 )
|
||||||
#error "The Flysky forced frequency tuning value is outside of the range -300..300."
|
#error "The Flysky forced frequency tuning value is outside of the range -300..300."
|
||||||
@ -146,6 +151,7 @@
|
|||||||
#undef FRSKYX_CC2500_INO
|
#undef FRSKYX_CC2500_INO
|
||||||
#undef SFHSS_CC2500_INO
|
#undef SFHSS_CC2500_INO
|
||||||
#undef CORONA_CC2500_INO
|
#undef CORONA_CC2500_INO
|
||||||
|
#undef HITEC_CC2500_INO
|
||||||
#endif
|
#endif
|
||||||
#ifndef NRF24L01_INSTALLED
|
#ifndef NRF24L01_INSTALLED
|
||||||
#undef BAYANG_NRF24L01_INO
|
#undef BAYANG_NRF24L01_INO
|
||||||
@ -179,11 +185,14 @@
|
|||||||
#undef INVERT_TELEMETRY
|
#undef INVERT_TELEMETRY
|
||||||
#undef AFHDS2A_FW_TELEMETRY
|
#undef AFHDS2A_FW_TELEMETRY
|
||||||
#undef AFHDS2A_HUB_TELEMETRY
|
#undef AFHDS2A_HUB_TELEMETRY
|
||||||
|
#undef HITEC_FW_TELEMETRY
|
||||||
|
#undef HITEC_HUB_TELEMETRY
|
||||||
#undef BAYANG_HUB_TELEMETRY
|
#undef BAYANG_HUB_TELEMETRY
|
||||||
#undef CABELL_HUB_TELEMETRY
|
#undef CABELL_HUB_TELEMETRY
|
||||||
#undef HUBSAN_HUB_TELEMETRY
|
#undef HUBSAN_HUB_TELEMETRY
|
||||||
#undef HUB_TELEMETRY
|
#undef HUB_TELEMETRY
|
||||||
#undef SPORT_TELEMETRY
|
#undef SPORT_TELEMETRY
|
||||||
|
#undef SPORT_POLLING
|
||||||
#undef DSM_TELEMETRY
|
#undef DSM_TELEMETRY
|
||||||
#undef MULTI_STATUS
|
#undef MULTI_STATUS
|
||||||
#undef MULTI_TELEMETRY
|
#undef MULTI_TELEMETRY
|
||||||
@ -204,25 +213,36 @@
|
|||||||
#undef AFHDS2A_HUB_TELEMETRY
|
#undef AFHDS2A_HUB_TELEMETRY
|
||||||
#undef AFHDS2A_FW_TELEMETRY
|
#undef AFHDS2A_FW_TELEMETRY
|
||||||
#endif
|
#endif
|
||||||
|
#if not defined(HITEC_CC2500_INO)
|
||||||
|
#undef HITEC_HUB_TELEMETRY
|
||||||
|
#undef HITEC_FW_TELEMETRY
|
||||||
|
#endif
|
||||||
|
#if defined(HITEC_HUB_TELEMETRY) && defined(HITEC_FW_TELEMETRY)
|
||||||
|
#error You need to choose HUB or FW telemetry but not both.
|
||||||
|
#endif
|
||||||
#if not defined(FRSKYD_CC2500_INO)
|
#if not defined(FRSKYD_CC2500_INO)
|
||||||
#undef HUB_TELEMETRY
|
#undef HUB_TELEMETRY
|
||||||
#endif
|
#endif
|
||||||
#if not defined(FRSKYX_CC2500_INO)
|
#if not defined(FRSKYX_CC2500_INO)
|
||||||
#undef SPORT_TELEMETRY
|
#undef SPORT_TELEMETRY
|
||||||
|
#undef SPORT_POLLING
|
||||||
|
#endif
|
||||||
|
#if not defined (SPORT_TELEMETRY) || not defined (STM32_BOARD)
|
||||||
|
#undef SPORT_POLLING
|
||||||
|
#endif
|
||||||
|
#if defined SPORT_POLLING && not defined INVERT_TELEMETRY
|
||||||
|
#error SPORT_POLLING has been defined but not INVERT_TELEMETRY. They should be both enabled to work.
|
||||||
#endif
|
#endif
|
||||||
#if not defined(DSM_CYRF6936_INO)
|
#if not defined(DSM_CYRF6936_INO)
|
||||||
#undef DSM_TELEMETRY
|
#undef DSM_TELEMETRY
|
||||||
#endif
|
#endif
|
||||||
#if not defined(DSM_TELEMETRY) && not defined(SPORT_TELEMETRY) && not defined(HUB_TELEMETRY) && not defined(HUBSAN_HUB_TELEMETRY) && not defined(BAYANG_HUB_TELEMETRY) && not defined(CABELL_HUB_TELEMETRY) && not defined(AFHDS2A_HUB_TELEMETRY) && not defined(AFHDS2A_FW_TELEMETRY) && not defined(MULTI_TELEMETRY) && not defined(MULTI_STATUS)
|
#if not defined(DSM_TELEMETRY) && not defined(SPORT_TELEMETRY) && not defined(HUB_TELEMETRY) && not defined(HUBSAN_HUB_TELEMETRY) && not defined(BAYANG_HUB_TELEMETRY) && not defined(CABELL_HUB_TELEMETRY) && not defined(AFHDS2A_HUB_TELEMETRY) && not defined(AFHDS2A_FW_TELEMETRY) && not defined(MULTI_TELEMETRY) && not defined(MULTI_STATUS) && not defined(HITEC_HUB_TELEMETRY) && not defined(HITEC_FW_TELEMETRY)
|
||||||
#undef TELEMETRY
|
#undef TELEMETRY
|
||||||
#undef INVERT_TELEMETRY
|
#undef INVERT_TELEMETRY
|
||||||
|
#undef SPORT_POLLING
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if not defined (SPORT_TELEMETRY) || not defined (STM32_BOARD)
|
|
||||||
#undef SPORT_POLLING
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//Make sure TX is defined correctly
|
//Make sure TX is defined correctly
|
||||||
#ifndef AILERON
|
#ifndef AILERON
|
||||||
#error You must select a correct channel order.
|
#error You must select a correct channel order.
|
||||||
|
@ -99,6 +99,7 @@
|
|||||||
//#define FORCE_FRSKYX_TUNING 0
|
//#define FORCE_FRSKYX_TUNING 0
|
||||||
//#define FORCE_SFHSS_TUNING 0
|
//#define FORCE_SFHSS_TUNING 0
|
||||||
//#define FORCE_CORONA_TUNING 0
|
//#define FORCE_CORONA_TUNING 0
|
||||||
|
//#define FORCE_HITEC_TUNING 0
|
||||||
|
|
||||||
/** A7105 Fine Frequency Tuning **/
|
/** A7105 Fine Frequency Tuning **/
|
||||||
//This is required in rare cases where some A7105 modules and/or RXs have an inaccurate crystal oscillator.
|
//This is required in rare cases where some A7105 modules and/or RXs have an inaccurate crystal oscillator.
|
||||||
@ -163,6 +164,7 @@
|
|||||||
#define FRSKYX_CC2500_INO
|
#define FRSKYX_CC2500_INO
|
||||||
#define SFHSS_CC2500_INO
|
#define SFHSS_CC2500_INO
|
||||||
#define CORONA_CC2500_INO
|
#define CORONA_CC2500_INO
|
||||||
|
#define HITEC_CC2500_INO
|
||||||
|
|
||||||
//The protocols below need a NRF24L01 to be installed
|
//The protocols below need a NRF24L01 to be installed
|
||||||
#define BAYANG_NRF24L01_INO
|
#define BAYANG_NRF24L01_INO
|
||||||
@ -246,6 +248,8 @@
|
|||||||
#define BAYANG_HUB_TELEMETRY // Use FrSkyD Hub format to send telemetry to TX
|
#define BAYANG_HUB_TELEMETRY // Use FrSkyD Hub format to send telemetry to TX
|
||||||
#define HUBSAN_HUB_TELEMETRY // Use FrSkyD Hub format to send telemetry to TX
|
#define HUBSAN_HUB_TELEMETRY // Use FrSkyD Hub format to send telemetry to TX
|
||||||
#define CABELL_HUB_TELEMETRY // Use FrSkyD Hub format to send telemetry to TX
|
#define CABELL_HUB_TELEMETRY // Use FrSkyD Hub format to send telemetry to TX
|
||||||
|
#define HITEC_HUB_TELEMETRY // Use FrSkyD Hub format to send telemetry to TX
|
||||||
|
//#define HITEC_FW_TELEMETRY // Forward received telemetry packet directly to TX to be decoded
|
||||||
|
|
||||||
//SPORT_POLLING is an implementation of the same polling routine as XJT module for sport telemetry bidirectional communication.
|
//SPORT_POLLING is an implementation of the same polling routine as XJT module for sport telemetry bidirectional communication.
|
||||||
//This is useful for passing sport control frames from TX to RX(ex: changing Betaflight PID or VTX channels on the fly using LUA scripts with OpentX).
|
//This is useful for passing sport control frames from TX to RX(ex: changing Betaflight PID or VTX channels on the fly using LUA scripts with OpentX).
|
||||||
@ -547,6 +551,9 @@ const PPM_Parameters PPM_prot[14*NBR_BANKS]= {
|
|||||||
FD_V3
|
FD_V3
|
||||||
PROTO_CFLIE
|
PROTO_CFLIE
|
||||||
NONE
|
NONE
|
||||||
|
PROTO_HITEC
|
||||||
|
OPTIMA
|
||||||
|
MINIMA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// RX_Num is used for TX & RX match. Using different RX_Num values for each receiver will prevent starting a model with the false config loaded...
|
// RX_Num is used for TX & RX match. Using different RX_Num values for each receiver will prevent starting a model with the false config loaded...
|
||||||
|
Loading…
x
Reference in New Issue
Block a user