mirror of
https://github.com/pascallanger/DIY-Multiprotocol-TX-Module.git
synced 2025-03-14 12:19:11 +00:00
Rename FrSkyX Rx to FrSky Rx
This commit is contained in:
parent
6dfd54b8be
commit
2f64f1f84a
@ -17,7 +17,7 @@
|
|||||||
/** FrSky D and X routines **/
|
/** FrSky D and X routines **/
|
||||||
/******************************/
|
/******************************/
|
||||||
|
|
||||||
#if defined(FRSKYX_CC2500_INO) || defined(FRSKYX_RX_CC2500_INO)
|
#if defined(FRSKYX_CC2500_INO) || defined(FRSKY_RX_CC2500_INO)
|
||||||
//**CRC**
|
//**CRC**
|
||||||
const uint16_t PROGMEM FrSkyX_CRC_Short[]={
|
const uint16_t PROGMEM FrSkyX_CRC_Short[]={
|
||||||
0x0000, 0x1189, 0x2312, 0x329B, 0x4624, 0x57AD, 0x6536, 0x74BF,
|
0x0000, 0x1189, 0x2312, 0x329B, 0x4624, 0x57AD, 0x6536, 0x74BF,
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
along with Multiprotocol. If not, see <http://www.gnu.org/licenses/>.
|
along with Multiprotocol. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(FRSKYX_RX_CC2500_INO)
|
#if defined(FRSKY_RX_CC2500_INO)
|
||||||
|
|
||||||
#include "iface_cc2500.h"
|
#include "iface_cc2500.h"
|
||||||
|
|
||||||
@ -21,26 +21,26 @@
|
|||||||
#define FRSKYX_LBT_LENGTH (33+2)
|
#define FRSKYX_LBT_LENGTH (33+2)
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
FRSKYX_RX_TUNE_START,
|
FRSKY_RX_TUNE_START,
|
||||||
FRSKYX_RX_TUNE_LOW,
|
FRSKY_RX_TUNE_LOW,
|
||||||
FRSKYX_RX_TUNE_HIGH,
|
FRSKY_RX_TUNE_HIGH,
|
||||||
FRSKYX_RX_BIND,
|
FRSKY_RX_BIND,
|
||||||
FRSKYX_RX_DATA,
|
FRSKY_RX_DATA,
|
||||||
};
|
};
|
||||||
|
|
||||||
static uint8_t frskyx_rx_chanskip;
|
static uint8_t frsky_rx_chanskip;
|
||||||
static uint8_t frskyx_rx_disable_lna;
|
static uint8_t frsky_rx_disable_lna;
|
||||||
static uint8_t frskyx_rx_data_started;
|
static uint8_t frsky_rx_data_started;
|
||||||
static int8_t frskyx_rx_finetune;
|
static int8_t frsky_rx_finetune;
|
||||||
|
|
||||||
static void __attribute__((unused)) frskyx_rx_strobe_rx()
|
static void __attribute__((unused)) frsky_rx_strobe_rx()
|
||||||
{
|
{
|
||||||
CC2500_Strobe(CC2500_SIDLE);
|
CC2500_Strobe(CC2500_SIDLE);
|
||||||
CC2500_Strobe(CC2500_SFRX);
|
CC2500_Strobe(CC2500_SFRX);
|
||||||
CC2500_Strobe(CC2500_SRX);
|
CC2500_Strobe(CC2500_SRX);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __attribute__((unused)) FrSkyX_Rx_initialise() {
|
static void __attribute__((unused)) frsky_rx_initialise() {
|
||||||
CC2500_Reset();
|
CC2500_Reset();
|
||||||
|
|
||||||
CC2500_WriteReg(CC2500_02_IOCFG0, 0x01);
|
CC2500_WriteReg(CC2500_02_IOCFG0, 0x01);
|
||||||
@ -96,24 +96,24 @@ static void __attribute__((unused)) FrSkyX_Rx_initialise() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
frskyx_rx_disable_lna = IS_POWER_FLAG_on;
|
frsky_rx_disable_lna = IS_POWER_FLAG_on;
|
||||||
CC2500_SetTxRxMode(frskyx_rx_disable_lna ? TXRX_OFF : RX_EN); // lna disable / enable
|
CC2500_SetTxRxMode(frsky_rx_disable_lna ? TXRX_OFF : RX_EN); // lna disable / enable
|
||||||
|
|
||||||
frskyx_rx_strobe_rx();
|
frsky_rx_strobe_rx();
|
||||||
CC2500_WriteReg(CC2500_0A_CHANNR, 0); // bind channel
|
CC2500_WriteReg(CC2500_0A_CHANNR, 0); // bind channel
|
||||||
delayMicroseconds(1000); // wait for RX to activate
|
delayMicroseconds(1000); // wait for RX to activate
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __attribute__((unused)) frskyx_rx_set_channel(uint8_t channel)
|
static void __attribute__((unused)) frsky_rx_set_channel(uint8_t channel)
|
||||||
{
|
{
|
||||||
CC2500_WriteReg(CC2500_0A_CHANNR, hopping_frequency[channel]);
|
CC2500_WriteReg(CC2500_0A_CHANNR, hopping_frequency[channel]);
|
||||||
CC2500_WriteReg(CC2500_25_FSCAL1, calData[channel]);
|
CC2500_WriteReg(CC2500_25_FSCAL1, calData[channel]);
|
||||||
frskyx_rx_strobe_rx();
|
frsky_rx_strobe_rx();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __attribute__((unused)) frskyx_rx_calibrate()
|
static void __attribute__((unused)) frsky_rx_calibrate()
|
||||||
{
|
{
|
||||||
frskyx_rx_strobe_rx();
|
frsky_rx_strobe_rx();
|
||||||
for (unsigned c = 0; c < 47; c++)
|
for (unsigned c = 0; c < 47; c++)
|
||||||
{
|
{
|
||||||
CC2500_Strobe(CC2500_SIDLE);
|
CC2500_Strobe(CC2500_SIDLE);
|
||||||
@ -132,7 +132,7 @@ static uint8_t __attribute__((unused)) frskyx_rx_check_crc()
|
|||||||
return lcrc == rcrc;
|
return lcrc == rcrc;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __attribute__((unused)) frskyx_rx_build_telemetry_packet()
|
static void __attribute__((unused)) frsky_rx_build_telemetry_packet()
|
||||||
{
|
{
|
||||||
static uint16_t frskyx_rx_rc_chan[16];
|
static uint16_t frskyx_rx_rc_chan[16];
|
||||||
uint16_t pxx_channel[8];
|
uint16_t pxx_channel[8];
|
||||||
@ -176,42 +176,42 @@ static void __attribute__((unused)) frskyx_rx_build_telemetry_packet()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t initFrSkyX_Rx()
|
uint16_t initFrSky_Rx()
|
||||||
{
|
{
|
||||||
FrSkyX_Rx_initialise();
|
frsky_rx_initialise();
|
||||||
state = 0;
|
state = 0;
|
||||||
frskyx_rx_chanskip = 1;
|
frsky_rx_chanskip = 1;
|
||||||
hopping_frequency_no = 0;
|
hopping_frequency_no = 0;
|
||||||
frskyx_rx_data_started = 0;
|
frsky_rx_data_started = 0;
|
||||||
frskyx_rx_finetune = 0;
|
frsky_rx_finetune = 0;
|
||||||
telemetry_link = 0;
|
telemetry_link = 0;
|
||||||
if (IS_BIND_IN_PROGRESS) {
|
if (IS_BIND_IN_PROGRESS) {
|
||||||
phase = FRSKYX_RX_TUNE_START;
|
phase = FRSKY_RX_TUNE_START;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
uint16_t temp = FRSKYX_RX_EEPROM_OFFSET;
|
uint16_t temp = FRSKY_RX_EEPROM_OFFSET;
|
||||||
rx_tx_addr[0] = eeprom_read_byte((EE_ADDR)temp++);
|
rx_tx_addr[0] = eeprom_read_byte((EE_ADDR)temp++);
|
||||||
rx_tx_addr[1] = eeprom_read_byte((EE_ADDR)temp++);
|
rx_tx_addr[1] = eeprom_read_byte((EE_ADDR)temp++);
|
||||||
rx_tx_addr[2] = eeprom_read_byte((EE_ADDR)temp++);
|
rx_tx_addr[2] = eeprom_read_byte((EE_ADDR)temp++);
|
||||||
frskyx_rx_finetune = eeprom_read_byte((EE_ADDR)temp++);
|
frsky_rx_finetune = eeprom_read_byte((EE_ADDR)temp++);
|
||||||
for(uint8_t ch = 0; ch < 47; ch++)
|
for(uint8_t ch = 0; ch < 47; ch++)
|
||||||
hopping_frequency[ch] = eeprom_read_byte((EE_ADDR)temp++);
|
hopping_frequency[ch] = eeprom_read_byte((EE_ADDR)temp++);
|
||||||
frskyx_rx_calibrate();
|
frsky_rx_calibrate();
|
||||||
CC2500_WriteReg(CC2500_18_MCSM0, 0x08); // FS_AUTOCAL = manual
|
CC2500_WriteReg(CC2500_18_MCSM0, 0x08); // FS_AUTOCAL = manual
|
||||||
CC2500_WriteReg(CC2500_09_ADDR, rx_tx_addr[0]); // set address
|
CC2500_WriteReg(CC2500_09_ADDR, rx_tx_addr[0]); // set address
|
||||||
CC2500_WriteReg(CC2500_07_PKTCTRL1, 0x05); // check address
|
CC2500_WriteReg(CC2500_07_PKTCTRL1, 0x05); // check address
|
||||||
if (option == 0)
|
if (option == 0)
|
||||||
CC2500_WriteReg(CC2500_0C_FSCTRL0, frskyx_rx_finetune);
|
CC2500_WriteReg(CC2500_0C_FSCTRL0, frsky_rx_finetune);
|
||||||
else
|
else
|
||||||
CC2500_WriteReg(CC2500_0C_FSCTRL0, option);
|
CC2500_WriteReg(CC2500_0C_FSCTRL0, option);
|
||||||
frskyx_rx_set_channel(hopping_frequency_no);
|
frsky_rx_set_channel(hopping_frequency_no);
|
||||||
phase = FRSKYX_RX_DATA;
|
phase = FRSKY_RX_DATA;
|
||||||
}
|
}
|
||||||
packet_length = (sub_protocol == FRSKYX_LBT) ? FRSKYX_LBT_LENGTH : FRSKYX_FCC_LENGTH;
|
packet_length = (sub_protocol == FRSKYX_LBT) ? FRSKYX_LBT_LENGTH : FRSKYX_FCC_LENGTH;
|
||||||
return 1000;
|
return 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t FrSkyX_Rx_callback()
|
uint16_t FrSky_Rx_callback()
|
||||||
{
|
{
|
||||||
static uint32_t pps_timer=0;
|
static uint32_t pps_timer=0;
|
||||||
static uint8_t pps_counter=0;
|
static uint8_t pps_counter=0;
|
||||||
@ -219,78 +219,78 @@ uint16_t FrSkyX_Rx_callback()
|
|||||||
static int8_t tune_low, tune_high;
|
static int8_t tune_low, tune_high;
|
||||||
uint8_t len, ch;
|
uint8_t len, ch;
|
||||||
|
|
||||||
if ((prev_option != option) && (phase >= FRSKYX_RX_DATA)) {
|
if ((prev_option != option) && (phase >= FRSKY_RX_DATA)) {
|
||||||
if (option == 0)
|
if (option == 0)
|
||||||
CC2500_WriteReg(CC2500_0C_FSCTRL0, frskyx_rx_finetune);
|
CC2500_WriteReg(CC2500_0C_FSCTRL0, frsky_rx_finetune);
|
||||||
else
|
else
|
||||||
CC2500_WriteReg(CC2500_0C_FSCTRL0, option);
|
CC2500_WriteReg(CC2500_0C_FSCTRL0, option);
|
||||||
prev_option = option;
|
prev_option = option;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (frskyx_rx_disable_lna != IS_POWER_FLAG_on) {
|
if (frsky_rx_disable_lna != IS_POWER_FLAG_on) {
|
||||||
frskyx_rx_disable_lna = IS_POWER_FLAG_on;
|
frsky_rx_disable_lna = IS_POWER_FLAG_on;
|
||||||
CC2500_SetTxRxMode(frskyx_rx_disable_lna ? TXRX_OFF : RX_EN);
|
CC2500_SetTxRxMode(frsky_rx_disable_lna ? TXRX_OFF : RX_EN);
|
||||||
}
|
}
|
||||||
|
|
||||||
len = CC2500_ReadReg(CC2500_3B_RXBYTES | CC2500_READ_BURST) & 0x7F;
|
len = CC2500_ReadReg(CC2500_3B_RXBYTES | CC2500_READ_BURST) & 0x7F;
|
||||||
|
|
||||||
switch(phase) {
|
switch(phase) {
|
||||||
case FRSKYX_RX_TUNE_START:
|
case FRSKY_RX_TUNE_START:
|
||||||
if (len >= packet_length) {
|
if (len >= packet_length) {
|
||||||
CC2500_ReadData(packet, packet_length);
|
CC2500_ReadData(packet, packet_length);
|
||||||
if(packet[1] == 0x03 && packet[2] == 0x01) {
|
if(packet[1] == 0x03 && packet[2] == 0x01) {
|
||||||
if(frskyx_rx_check_crc()) {
|
if(frskyx_rx_check_crc()) {
|
||||||
frskyx_rx_finetune = -127;
|
frsky_rx_finetune = -127;
|
||||||
CC2500_WriteReg(CC2500_0C_FSCTRL0, frskyx_rx_finetune);
|
CC2500_WriteReg(CC2500_0C_FSCTRL0, frsky_rx_finetune);
|
||||||
phase = FRSKYX_RX_TUNE_LOW;
|
phase = FRSKY_RX_TUNE_LOW;
|
||||||
frskyx_rx_strobe_rx();
|
frsky_rx_strobe_rx();
|
||||||
return 1000;
|
return 1000;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
frskyx_rx_finetune += 10;
|
frsky_rx_finetune += 10;
|
||||||
CC2500_WriteReg(CC2500_0C_FSCTRL0, frskyx_rx_finetune);
|
CC2500_WriteReg(CC2500_0C_FSCTRL0, frsky_rx_finetune);
|
||||||
frskyx_rx_strobe_rx();
|
frsky_rx_strobe_rx();
|
||||||
return 18000;
|
return 18000;
|
||||||
|
|
||||||
case FRSKYX_RX_TUNE_LOW:
|
case FRSKY_RX_TUNE_LOW:
|
||||||
if (len >= packet_length) {
|
if (len >= packet_length) {
|
||||||
CC2500_ReadData(packet, packet_length);
|
CC2500_ReadData(packet, packet_length);
|
||||||
if (frskyx_rx_check_crc()) {
|
if (frskyx_rx_check_crc()) {
|
||||||
tune_low = frskyx_rx_finetune;
|
tune_low = frsky_rx_finetune;
|
||||||
frskyx_rx_finetune = 127;
|
frsky_rx_finetune = 127;
|
||||||
CC2500_WriteReg(CC2500_0C_FSCTRL0, frskyx_rx_finetune);
|
CC2500_WriteReg(CC2500_0C_FSCTRL0, frsky_rx_finetune);
|
||||||
phase = FRSKYX_RX_TUNE_HIGH;
|
phase = FRSKY_RX_TUNE_HIGH;
|
||||||
frskyx_rx_strobe_rx();
|
frsky_rx_strobe_rx();
|
||||||
return 1000;
|
return 1000;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
frskyx_rx_finetune += 1;
|
frsky_rx_finetune += 1;
|
||||||
CC2500_WriteReg(CC2500_0C_FSCTRL0, frskyx_rx_finetune);
|
CC2500_WriteReg(CC2500_0C_FSCTRL0, frsky_rx_finetune);
|
||||||
frskyx_rx_strobe_rx();
|
frsky_rx_strobe_rx();
|
||||||
return 18000;
|
return 18000;
|
||||||
|
|
||||||
case FRSKYX_RX_TUNE_HIGH:
|
case FRSKY_RX_TUNE_HIGH:
|
||||||
if (len >= packet_length) {
|
if (len >= packet_length) {
|
||||||
CC2500_ReadData(packet, packet_length);
|
CC2500_ReadData(packet, packet_length);
|
||||||
if (frskyx_rx_check_crc()) {
|
if (frskyx_rx_check_crc()) {
|
||||||
tune_high = frskyx_rx_finetune;
|
tune_high = frsky_rx_finetune;
|
||||||
frskyx_rx_finetune = (tune_low + tune_high) / 2;
|
frsky_rx_finetune = (tune_low + tune_high) / 2;
|
||||||
CC2500_WriteReg(CC2500_0C_FSCTRL0, (int8_t)frskyx_rx_finetune);
|
CC2500_WriteReg(CC2500_0C_FSCTRL0, (int8_t)frsky_rx_finetune);
|
||||||
if(tune_low < tune_high)
|
if(tune_low < tune_high)
|
||||||
phase = FRSKYX_RX_BIND;
|
phase = FRSKY_RX_BIND;
|
||||||
else
|
else
|
||||||
phase = FRSKYX_RX_TUNE_START;
|
phase = FRSKY_RX_TUNE_START;
|
||||||
frskyx_rx_strobe_rx();
|
frsky_rx_strobe_rx();
|
||||||
return 1000;
|
return 1000;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
frskyx_rx_finetune -= 1;
|
frsky_rx_finetune -= 1;
|
||||||
CC2500_WriteReg(CC2500_0C_FSCTRL0, frskyx_rx_finetune);
|
CC2500_WriteReg(CC2500_0C_FSCTRL0, frsky_rx_finetune);
|
||||||
frskyx_rx_strobe_rx();
|
frsky_rx_strobe_rx();
|
||||||
return 18000;
|
return 18000;
|
||||||
|
|
||||||
case FRSKYX_RX_BIND:
|
case FRSKY_RX_BIND:
|
||||||
if(len >= packet_length) {
|
if(len >= packet_length) {
|
||||||
CC2500_ReadData(packet, packet_length);
|
CC2500_ReadData(packet, packet_length);
|
||||||
if (frskyx_rx_check_crc()) {
|
if (frskyx_rx_check_crc()) {
|
||||||
@ -302,30 +302,30 @@ uint16_t FrSkyX_Rx_callback()
|
|||||||
}
|
}
|
||||||
if (state == 0x3ff) {
|
if (state == 0x3ff) {
|
||||||
debugln("bind complete");
|
debugln("bind complete");
|
||||||
frskyx_rx_calibrate();
|
frsky_rx_calibrate();
|
||||||
rx_tx_addr[0] = packet[3]; // TXID
|
rx_tx_addr[0] = packet[3]; // TXID
|
||||||
rx_tx_addr[1] = packet[4]; // TXID
|
rx_tx_addr[1] = packet[4]; // TXID
|
||||||
rx_tx_addr[2] = packet[12]; // RX #
|
rx_tx_addr[2] = packet[12]; // RX #
|
||||||
CC2500_WriteReg(CC2500_18_MCSM0, 0x08); // FS_AUTOCAL = manual
|
CC2500_WriteReg(CC2500_18_MCSM0, 0x08); // FS_AUTOCAL = manual
|
||||||
CC2500_WriteReg(CC2500_09_ADDR, rx_tx_addr[0]); // set address
|
CC2500_WriteReg(CC2500_09_ADDR, rx_tx_addr[0]); // set address
|
||||||
CC2500_WriteReg(CC2500_07_PKTCTRL1, 0x05); // check address
|
CC2500_WriteReg(CC2500_07_PKTCTRL1, 0x05); // check address
|
||||||
phase = FRSKYX_RX_DATA;
|
phase = FRSKY_RX_DATA;
|
||||||
frskyx_rx_set_channel(hopping_frequency_no);
|
frsky_rx_set_channel(hopping_frequency_no);
|
||||||
// store txid and channel list
|
// store txid and channel list
|
||||||
uint16_t temp = FRSKYX_RX_EEPROM_OFFSET;
|
uint16_t temp = FRSKY_RX_EEPROM_OFFSET;
|
||||||
eeprom_write_byte((EE_ADDR)temp++, rx_tx_addr[0]);
|
eeprom_write_byte((EE_ADDR)temp++, rx_tx_addr[0]);
|
||||||
eeprom_write_byte((EE_ADDR)temp++, rx_tx_addr[1]);
|
eeprom_write_byte((EE_ADDR)temp++, rx_tx_addr[1]);
|
||||||
eeprom_write_byte((EE_ADDR)temp++, rx_tx_addr[2]);
|
eeprom_write_byte((EE_ADDR)temp++, rx_tx_addr[2]);
|
||||||
eeprom_write_byte((EE_ADDR)temp++, frskyx_rx_finetune);
|
eeprom_write_byte((EE_ADDR)temp++, frsky_rx_finetune);
|
||||||
for (ch = 0; ch < 47; ch++)
|
for (ch = 0; ch < 47; ch++)
|
||||||
eeprom_write_byte((EE_ADDR)temp++, hopping_frequency[ch]);
|
eeprom_write_byte((EE_ADDR)temp++, hopping_frequency[ch]);
|
||||||
BIND_DONE;
|
BIND_DONE;
|
||||||
}
|
}
|
||||||
frskyx_rx_strobe_rx();
|
frsky_rx_strobe_rx();
|
||||||
}
|
}
|
||||||
return 1000;
|
return 1000;
|
||||||
|
|
||||||
case FRSKYX_RX_DATA:
|
case FRSKY_RX_DATA:
|
||||||
if (len >= packet_length) {
|
if (len >= packet_length) {
|
||||||
CC2500_ReadData(packet, packet_length);
|
CC2500_ReadData(packet, packet_length);
|
||||||
if (packet[1] == rx_tx_addr[0] && packet[2] == rx_tx_addr[1] && packet[6] == rx_tx_addr[2] && frskyx_rx_check_crc()) {
|
if (packet[1] == rx_tx_addr[0] && packet[2] == rx_tx_addr[1] && packet[6] == rx_tx_addr[2] && frskyx_rx_check_crc()) {
|
||||||
@ -335,14 +335,14 @@ uint16_t FrSkyX_Rx_callback()
|
|||||||
else
|
else
|
||||||
RX_RSSI += 128;
|
RX_RSSI += 128;
|
||||||
// hop to next channel
|
// hop to next channel
|
||||||
frskyx_rx_chanskip = ((packet[4] & 0xC0) >> 6) | ((packet[5] & 0x3F) << 2);
|
frsky_rx_chanskip = ((packet[4] & 0xC0) >> 6) | ((packet[5] & 0x3F) << 2);
|
||||||
hopping_frequency_no = (hopping_frequency_no + frskyx_rx_chanskip) % 47;
|
hopping_frequency_no = (hopping_frequency_no + frsky_rx_chanskip) % 47;
|
||||||
frskyx_rx_set_channel(hopping_frequency_no);
|
frsky_rx_set_channel(hopping_frequency_no);
|
||||||
if(packet[7] == 0 && telemetry_link == 0) { // standard packet, send channels to TX
|
if(packet[7] == 0 && telemetry_link == 0) { // standard packet, send channels to TX
|
||||||
frskyx_rx_build_telemetry_packet();
|
frsky_rx_build_telemetry_packet();
|
||||||
telemetry_link = 1;
|
telemetry_link = 1;
|
||||||
}
|
}
|
||||||
frskyx_rx_data_started = 1;
|
frsky_rx_data_started = 1;
|
||||||
read_retry = 0;
|
read_retry = 0;
|
||||||
pps_counter++;
|
pps_counter++;
|
||||||
}
|
}
|
||||||
@ -358,9 +358,9 @@ uint16_t FrSkyX_Rx_callback()
|
|||||||
|
|
||||||
// skip channel if no packet received in time
|
// skip channel if no packet received in time
|
||||||
if (read_retry++ >= 9) {
|
if (read_retry++ >= 9) {
|
||||||
hopping_frequency_no = (hopping_frequency_no + frskyx_rx_chanskip) % 47;
|
hopping_frequency_no = (hopping_frequency_no + frsky_rx_chanskip) % 47;
|
||||||
frskyx_rx_set_channel(hopping_frequency_no);
|
frsky_rx_set_channel(hopping_frequency_no);
|
||||||
if(frskyx_rx_data_started)
|
if(frsky_rx_data_started)
|
||||||
read_retry = 0;
|
read_retry = 0;
|
||||||
else
|
else
|
||||||
read_retry = -50; // retry longer until first packet is catched
|
read_retry = -50; // retry longer until first packet is catched
|
@ -81,7 +81,7 @@ enum PROTOCOLS
|
|||||||
PROTO_ZSX = 52, // =>NRF24L01
|
PROTO_ZSX = 52, // =>NRF24L01
|
||||||
PROTO_FLYZONE = 53, // =>A7105
|
PROTO_FLYZONE = 53, // =>A7105
|
||||||
PROTO_SCANNER = 54, // =>CC2500
|
PROTO_SCANNER = 54, // =>CC2500
|
||||||
PROTO_FRSKYX_RX = 55, // =>CC2500
|
PROTO_FRSKY_RX = 55, // =>CC2500
|
||||||
PROTO_AFHDS2A_RX= 56, // =>A7105
|
PROTO_AFHDS2A_RX= 56, // =>A7105
|
||||||
PROTO_XN297DUMP = 63, // =>NRF24L01
|
PROTO_XN297DUMP = 63, // =>NRF24L01
|
||||||
};
|
};
|
||||||
@ -290,7 +290,7 @@ enum TRAXXAS
|
|||||||
{
|
{
|
||||||
RX6519 = 0,
|
RX6519 = 0,
|
||||||
};
|
};
|
||||||
enum FRSKYX_RX
|
enum FRSKY_RX
|
||||||
{
|
{
|
||||||
FRSKYX_FCC = 0,
|
FRSKYX_FCC = 0,
|
||||||
FRSKYX_LBT
|
FRSKYX_LBT
|
||||||
@ -594,7 +594,7 @@ enum {
|
|||||||
#define AFHDS2A_EEPROM_OFFSET 50 // RX ID, 4 bytes per model id, end is 50+64=114
|
#define AFHDS2A_EEPROM_OFFSET 50 // RX ID, 4 bytes per model id, end is 50+64=114
|
||||||
#define BUGS_EEPROM_OFFSET 114 // RX ID, 2 bytes per model id, end is 114+32=146
|
#define BUGS_EEPROM_OFFSET 114 // RX ID, 2 bytes per model id, end is 114+32=146
|
||||||
#define BUGSMINI_EEPROM_OFFSET 146 // RX ID, 2 bytes per model id, end is 146+32=178
|
#define BUGSMINI_EEPROM_OFFSET 146 // RX ID, 2 bytes per model id, end is 146+32=178
|
||||||
#define FRSKYX_RX_EEPROM_OFFSET 178 // (3) TX ID + (1) freq_tune + (47) channels, 51 bytes, end is 178+51=229
|
#define FRSKY_RX_EEPROM_OFFSET 178 // (3) TX ID + (1) freq_tune + (47) channels, 51 bytes, end is 178+51=229
|
||||||
#define AFHDS2A_RX_EEPROM_OFFSET 229 // (4) TX ID + (16) channels, 20 bytes, end is 229+20=249
|
#define AFHDS2A_RX_EEPROM_OFFSET 229 // (4) TX ID + (16) channels, 20 bytes, end is 229+20=249
|
||||||
#define AFHDS2A_EEPROM_OFFSET2 249 // RX ID, 4 bytes per model id, end is 249+192=441
|
#define AFHDS2A_EEPROM_OFFSET2 249 // RX ID, 4 bytes per model id, end is 249+192=441
|
||||||
//#define CONFIG_EEPROM_OFFSET 441 // Current configuration of the multimodule
|
//#define CONFIG_EEPROM_OFFSET 441 // Current configuration of the multimodule
|
||||||
@ -812,7 +812,7 @@ Serial: 100000 Baud 8e2 _ xxxx xxxx p --
|
|||||||
RED_SLOW 1
|
RED_SLOW 1
|
||||||
sub_protocol==TRAXXAS
|
sub_protocol==TRAXXAS
|
||||||
RX6519 0
|
RX6519 0
|
||||||
sub_protocol==FRSKYX_RX
|
sub_protocol==FRSKY_RX
|
||||||
FCC 0
|
FCC 0
|
||||||
LBT 1
|
LBT 1
|
||||||
|
|
||||||
|
@ -668,7 +668,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_FRSKYX_RX) || (protocol == PROTO_SCANNER) || (protocol==PROTO_FRSKYD) || (protocol==PROTO_BAYANG) || (protocol==PROTO_NCC1701) || (protocol==PROTO_BUGS) || (protocol==PROTO_BUGSMINI) || (protocol==PROTO_HUBSAN) || (protocol==PROTO_AFHDS2A) || (protocol==PROTO_FRSKYX) || (protocol==PROTO_DSM) || (protocol==PROTO_CABELL) || (protocol==PROTO_HITEC))
|
if( (protocol == PROTO_FRSKY_RX) || (protocol == PROTO_SCANNER) || (protocol==PROTO_FRSKYD) || (protocol==PROTO_BAYANG) || (protocol==PROTO_NCC1701) || (protocol==PROTO_BUGS) || (protocol==PROTO_BUGSMINI) || (protocol==PROTO_HUBSAN) || (protocol==PROTO_AFHDS2A) || (protocol==PROTO_FRSKYX) || (protocol==PROTO_DSM) || (protocol==PROTO_CABELL) || (protocol==PROTO_HITEC))
|
||||||
#endif
|
#endif
|
||||||
if(IS_DISABLE_TELEM_off && !(protocol==PROTO_XN297DUMP))
|
if(IS_DISABLE_TELEM_off && !(protocol==PROTO_XN297DUMP))
|
||||||
TelemetryUpdate();
|
TelemetryUpdate();
|
||||||
@ -1086,12 +1086,12 @@ static void protocol_init()
|
|||||||
remote_callback = Scanner_callback;
|
remote_callback = Scanner_callback;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#if defined(FRSKYX_RX_CC2500_INO)
|
#if defined(FRSKY_RX_CC2500_INO)
|
||||||
case PROTO_FRSKYX_RX:
|
case PROTO_FRSKY_RX:
|
||||||
PE1_off;
|
PE1_off;
|
||||||
PE2_on; //antenna RF2
|
PE2_on; //antenna RF2
|
||||||
next_callback = initFrSkyX_Rx();
|
next_callback = initFrSky_Rx();
|
||||||
remote_callback = FrSkyX_Rx_callback;
|
remote_callback = FrSky_Rx_callback;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
@ -226,7 +226,7 @@ static void multi_send_status()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined (FRSKYX_RX_TELEMETRY) || defined (AFHDS2A_RX_TELEMETRY)
|
#if defined (FRSKY_RX_TELEMETRY) || defined (AFHDS2A_RX_TELEMETRY)
|
||||||
void receiver_channels_frame()
|
void receiver_channels_frame()
|
||||||
{
|
{
|
||||||
uint16_t len = packet_in[3] * 11; // 11 bit per channel
|
uint16_t len = packet_in[3] * 11; // 11 bit per channel
|
||||||
@ -861,8 +861,8 @@ void TelemetryUpdate()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined (FRSKYX_RX_TELEMETRY) || defined(AFHDS2A_RX_TELEMETRY)
|
#if defined (FRSKY_RX_TELEMETRY) || defined(AFHDS2A_RX_TELEMETRY)
|
||||||
if (telemetry_link && (protocol == PROTO_FRSKYX_RX || protocol == PROTO_AFHDS2A_RX))
|
if (telemetry_link && (protocol == PROTO_FRSKY_RX || protocol == PROTO_AFHDS2A_RX))
|
||||||
{
|
{
|
||||||
receiver_channels_frame();
|
receiver_channels_frame();
|
||||||
telemetry_link = 0;
|
telemetry_link = 0;
|
||||||
|
@ -194,7 +194,7 @@
|
|||||||
#undef HITEC_CC2500_INO
|
#undef HITEC_CC2500_INO
|
||||||
#undef XN297L_CC2500_EMU
|
#undef XN297L_CC2500_EMU
|
||||||
#undef SCANNER_CC2500_INO
|
#undef SCANNER_CC2500_INO
|
||||||
#undef FRSKYX_RX_CC2500_INO
|
#undef FRSKY_RX_CC2500_INO
|
||||||
#endif
|
#endif
|
||||||
#ifndef NRF24L01_INSTALLED
|
#ifndef NRF24L01_INSTALLED
|
||||||
#undef BAYANG_NRF24L01_INO
|
#undef BAYANG_NRF24L01_INO
|
||||||
@ -253,8 +253,8 @@
|
|||||||
#undef MULTI_TELEMETRY
|
#undef MULTI_TELEMETRY
|
||||||
#undef SCANNER_TELEMETRY
|
#undef SCANNER_TELEMETRY
|
||||||
#undef SCANNER_CC2500_INO
|
#undef SCANNER_CC2500_INO
|
||||||
#undef FRSKYX_RX_TELEMETRY
|
#undef FRSKY_RX_TELEMETRY
|
||||||
#undef FRSKYX_RX_CC2500_INO
|
#undef FRSKY_RX_CC2500_INO
|
||||||
#undef AFHDS2A_RX_TELEMETRY
|
#undef AFHDS2A_RX_TELEMETRY
|
||||||
#undef AFHDS2A_RX_A7105_INO
|
#undef AFHDS2A_RX_A7105_INO
|
||||||
#else
|
#else
|
||||||
@ -265,9 +265,9 @@
|
|||||||
#undef SCANNER_TELEMETRY
|
#undef SCANNER_TELEMETRY
|
||||||
#undef SCANNER_CC2500_INO
|
#undef SCANNER_CC2500_INO
|
||||||
#endif
|
#endif
|
||||||
#if not defined(FRSKYX_RX_CC2500_INO) || not defined(FRSKYX_RX_TELEMETRY)
|
#if not defined(FRSKY_RX_CC2500_INO) || not defined(FRSKY_RX_TELEMETRY)
|
||||||
#undef FRSKYX_RX_TELEMETRY
|
#undef FRSKY_RX_TELEMETRY
|
||||||
#undef FRSKYX_RX_CC2500_INO
|
#undef FRSKY_RX_CC2500_INO
|
||||||
#endif
|
#endif
|
||||||
#if not defined(AFHDS2A_RX_A7105_INO) || not defined(AFHDS2A_RX_TELEMETRY)
|
#if not defined(AFHDS2A_RX_A7105_INO) || not defined(AFHDS2A_RX_TELEMETRY)
|
||||||
#undef AFHDS2A_RX_TELEMETRY
|
#undef AFHDS2A_RX_TELEMETRY
|
||||||
@ -309,7 +309,7 @@
|
|||||||
#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(BUGS_HUB_TELEMETRY) && not defined(NCC1701_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) && not defined(SCANNER_TELEMETRY) && not defined(FRSKYX_RX_TELEMETRY)
|
#if not defined(DSM_TELEMETRY) && not defined(SPORT_TELEMETRY) && not defined(HUB_TELEMETRY) && not defined(HUBSAN_HUB_TELEMETRY) && not defined(BUGS_HUB_TELEMETRY) && not defined(NCC1701_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) && not defined(SCANNER_TELEMETRY) && not defined(FRSKY_RX_TELEMETRY)
|
||||||
#undef TELEMETRY
|
#undef TELEMETRY
|
||||||
#undef INVERT_TELEMETRY
|
#undef INVERT_TELEMETRY
|
||||||
#endif
|
#endif
|
||||||
|
@ -176,7 +176,7 @@
|
|||||||
#define FRSKYD_CC2500_INO
|
#define FRSKYD_CC2500_INO
|
||||||
#define FRSKYV_CC2500_INO
|
#define FRSKYV_CC2500_INO
|
||||||
#define FRSKYX_CC2500_INO
|
#define FRSKYX_CC2500_INO
|
||||||
#define FRSKYX_RX_CC2500_INO
|
#define FRSKY_RX_CC2500_INO
|
||||||
#define HITEC_CC2500_INO
|
#define HITEC_CC2500_INO
|
||||||
#define SCANNER_CC2500_INO
|
#define SCANNER_CC2500_INO
|
||||||
#define SFHSS_CC2500_INO
|
#define SFHSS_CC2500_INO
|
||||||
@ -288,7 +288,7 @@
|
|||||||
#define HITEC_HUB_TELEMETRY // Use FrSkyD Hub format to send basic telemetry to the radios which can decode it like er9x, ersky9x and OpenTX
|
#define HITEC_HUB_TELEMETRY // Use FrSkyD Hub format to send basic telemetry to the radios which can decode it like er9x, ersky9x and OpenTX
|
||||||
#define HITEC_FW_TELEMETRY // Under development: Forward received telemetry packets to be decoded by ersky9x and OpenTX
|
#define HITEC_FW_TELEMETRY // Under development: Forward received telemetry packets to be decoded by ersky9x and OpenTX
|
||||||
#define SCANNER_TELEMETRY // Forward spectrum scanner data to TX
|
#define SCANNER_TELEMETRY // Forward spectrum scanner data to TX
|
||||||
#define FRSKYX_RX_TELEMETRY // Forward channels data to TX
|
#define FRSKY_RX_TELEMETRY // Forward channels data to TX
|
||||||
#define AFHDS2A_RX_TELEMETRY // Forward channels data to TX
|
#define AFHDS2A_RX_TELEMETRY // Forward channels data to TX
|
||||||
|
|
||||||
/****************************/
|
/****************************/
|
||||||
@ -545,7 +545,7 @@ const PPM_Parameters PPM_prot[14*NBR_BANKS]= {
|
|||||||
CH_8
|
CH_8
|
||||||
EU_16
|
EU_16
|
||||||
EU_8
|
EU_8
|
||||||
PROTO_FRSKYX_RX
|
PROTO_FRSKY_RX
|
||||||
FRSKYX_FCC
|
FRSKYX_FCC
|
||||||
FRSKYX_LBT
|
FRSKYX_LBT
|
||||||
PROTO_FY326
|
PROTO_FY326
|
||||||
|
Loading…
x
Reference in New Issue
Block a user