mirror of
https://github.com/pascallanger/DIY-Multiprotocol-TX-Module.git
synced 2025-03-15 12:59:09 +00:00
FX telemetry
This commit is contained in:
parent
432e2e08a4
commit
0fcb4b7f1a
@ -38,11 +38,18 @@ Multiprotocol is distributed in the hope that it will be useful,
|
|||||||
#define FX9630_BIND_CHANNEL 51
|
#define FX9630_BIND_CHANNEL 51
|
||||||
#define FX9630_PAYLOAD_SIZE 8
|
#define FX9630_PAYLOAD_SIZE 8
|
||||||
#define FX9630_NUM_CHANNELS 3
|
#define FX9630_NUM_CHANNELS 3
|
||||||
|
#define FX9630_WRITE_TIME 500
|
||||||
|
|
||||||
//#define FORCE_FX620_ID
|
//#define FORCE_FX620_ID
|
||||||
//#define FORCE_FX9630_ID
|
//#define FORCE_FX9630_ID
|
||||||
//#define FORCE_QIDI_ID
|
//#define FORCE_QIDI_ID
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
FX_DATA=0,
|
||||||
|
FX_RX,
|
||||||
|
};
|
||||||
|
|
||||||
static void __attribute__((unused)) FX_send_packet()
|
static void __attribute__((unused)) FX_send_packet()
|
||||||
{
|
{
|
||||||
static uint8_t trim_ch = 0;
|
static uint8_t trim_ch = 0;
|
||||||
@ -53,7 +60,6 @@ static void __attribute__((unused)) FX_send_packet()
|
|||||||
XN297_Hopping(hopping_frequency_no++);
|
XN297_Hopping(hopping_frequency_no++);
|
||||||
if(sub_protocol >= FX9630)
|
if(sub_protocol >= FX9630)
|
||||||
{ // FX9630 & FX_Q560 & FX_QF012
|
{ // FX9630 & FX_Q560 & FX_QF012
|
||||||
XN297_SetTXAddr(rx_tx_addr, 4);
|
|
||||||
if (hopping_frequency_no >= FX9630_NUM_CHANNELS)
|
if (hopping_frequency_no >= FX9630_NUM_CHANNELS)
|
||||||
{
|
{
|
||||||
hopping_frequency_no = 0;
|
hopping_frequency_no = 0;
|
||||||
@ -186,7 +192,7 @@ static void __attribute__((unused)) FX_RF_init()
|
|||||||
packet_period = FX620_BIND_PACKET_PERIOD;
|
packet_period = FX620_BIND_PACKET_PERIOD;
|
||||||
packet_length = FX620_PAYLOAD_SIZE;
|
packet_length = FX620_PAYLOAD_SIZE;
|
||||||
}
|
}
|
||||||
else // FX9630 & FX_Q560
|
else // FX9630 & FX_Q560 & FX_QF012
|
||||||
{
|
{
|
||||||
XN297_SetTXAddr((uint8_t *)"\x56\x78\x90\x12", 4);
|
XN297_SetTXAddr((uint8_t *)"\x56\x78\x90\x12", 4);
|
||||||
XN297_RFChannel(FX9630_BIND_CHANNEL);
|
XN297_RFChannel(FX9630_BIND_CHANNEL);
|
||||||
@ -218,7 +224,7 @@ static void __attribute__((unused)) FX_initialize_txid()
|
|||||||
for(uint8_t i=1;i<FX_NUM_CHANNELS;i++)
|
for(uint8_t i=1;i<FX_NUM_CHANNELS;i++)
|
||||||
hopping_frequency[i] = i*10 + hopping_frequency[0];
|
hopping_frequency[i] = i*10 + hopping_frequency[0];
|
||||||
}
|
}
|
||||||
else // FX9630 & FX_Q560
|
else // FX9630 & FX_Q560 & FX_QF012
|
||||||
{
|
{
|
||||||
//??? Need to find out how the first RF channel is calculated ???
|
//??? Need to find out how the first RF channel is calculated ???
|
||||||
hopping_frequency[0] = 0x13;
|
hopping_frequency[0] = 0x13;
|
||||||
@ -242,20 +248,73 @@ static void __attribute__((unused)) FX_initialize_txid()
|
|||||||
|
|
||||||
uint16_t FX_callback()
|
uint16_t FX_callback()
|
||||||
{
|
{
|
||||||
#ifdef MULTI_SYNC
|
#ifdef FX_HUB_TELEMETRY
|
||||||
telemetry_set_input_sync(packet_period);
|
bool rx=false;
|
||||||
#endif
|
|
||||||
if(bind_counter)
|
switch(phase)
|
||||||
if(--bind_counter==0)
|
|
||||||
{
|
{
|
||||||
BIND_DONE;
|
case FX_DATA:
|
||||||
if(sub_protocol == FX620)
|
rx = XN297_IsRX();
|
||||||
{
|
XN297_SetTxRxMode(TXRX_OFF);
|
||||||
XN297_SetTXAddr(rx_tx_addr, 3);
|
#endif
|
||||||
packet_period = FX620_PACKET_PERIOD;
|
#ifdef MULTI_SYNC
|
||||||
}
|
telemetry_set_input_sync(packet_period);
|
||||||
|
#endif
|
||||||
|
if(bind_counter)
|
||||||
|
if(--bind_counter==0)
|
||||||
|
{
|
||||||
|
BIND_DONE;
|
||||||
|
if(sub_protocol == FX620)
|
||||||
|
{
|
||||||
|
XN297_SetTXAddr(rx_tx_addr, 3);
|
||||||
|
packet_period = FX620_PACKET_PERIOD;
|
||||||
|
}
|
||||||
|
else if(sub_protocol >= FX9630)
|
||||||
|
{ // FX9630 & FX_Q560 & FX_QF012
|
||||||
|
XN297_SetTXAddr(rx_tx_addr, 4);
|
||||||
|
#ifdef FX_HUB_TELEMETRY
|
||||||
|
XN297_SetRXAddr(rx_tx_addr,packet_length);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
FX_send_packet();
|
||||||
|
#ifdef FX_HUB_TELEMETRY
|
||||||
|
if(sub_protocol < FX9630)
|
||||||
|
break;
|
||||||
|
if(rx)
|
||||||
|
{
|
||||||
|
debug("RX");
|
||||||
|
if(XN297_ReadPayload(packet_in, packet_length))
|
||||||
|
{//Good CRC
|
||||||
|
telemetry_link = 1;
|
||||||
|
//v_lipo1 = packet_in[1] == 0x03 ? 0x00:0xFF; // low voltage
|
||||||
|
#if 1
|
||||||
|
for(uint8_t i=0; i < packet_length; i++)
|
||||||
|
debug(" %02X", packet_in[i]);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
debugln();
|
||||||
|
}
|
||||||
|
phase++;
|
||||||
|
return FX9630_WRITE_TIME;
|
||||||
|
default: //FX_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++;
|
||||||
|
}
|
||||||
|
debug("%d",count);
|
||||||
|
} */
|
||||||
|
//Switch to RX
|
||||||
|
XN297_SetTxRxMode(TXRX_OFF);
|
||||||
|
XN297_SetTxRxMode(RX_EN);
|
||||||
|
phase = FX_DATA;
|
||||||
|
return packet_period - FX9630_WRITE_TIME;
|
||||||
}
|
}
|
||||||
FX_send_packet();
|
#endif
|
||||||
return packet_period;
|
return packet_period;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -266,6 +325,10 @@ void FX_init()
|
|||||||
FX_RF_init();
|
FX_RF_init();
|
||||||
hopping_frequency_no = 0;
|
hopping_frequency_no = 0;
|
||||||
bind_counter=FX_BIND_COUNT;
|
bind_counter=FX_BIND_COUNT;
|
||||||
|
#ifdef FX_HUB_TELEMETRY
|
||||||
|
RX_RSSI = 100; // Dummy value
|
||||||
|
phase = FX_DATA;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
#define VERSION_MAJOR 1
|
#define VERSION_MAJOR 1
|
||||||
#define VERSION_MINOR 3
|
#define VERSION_MINOR 3
|
||||||
#define VERSION_REVISION 4
|
#define VERSION_REVISION 4
|
||||||
#define VERSION_PATCH_LEVEL 45
|
#define VERSION_PATCH_LEVEL 46
|
||||||
|
|
||||||
#define MODE_SERIAL 0
|
#define MODE_SERIAL 0
|
||||||
|
|
||||||
|
@ -494,6 +494,7 @@
|
|||||||
#undef PROPEL_HUB_TELEMETRY
|
#undef PROPEL_HUB_TELEMETRY
|
||||||
#undef OMP_HUB_TELEMETRY
|
#undef OMP_HUB_TELEMETRY
|
||||||
#undef V761_HUB_TELEMETRY
|
#undef V761_HUB_TELEMETRY
|
||||||
|
#undef FX_HUB_TELEMETRY
|
||||||
#undef KAMTOM_HUB_TELEMETRY
|
#undef KAMTOM_HUB_TELEMETRY
|
||||||
#undef YUXIANG_HUB_TELEMETRY
|
#undef YUXIANG_HUB_TELEMETRY
|
||||||
#undef RLINK_HUB_TELEMETRY
|
#undef RLINK_HUB_TELEMETRY
|
||||||
@ -534,6 +535,9 @@
|
|||||||
#if not defined(V761_NRF24L01_INO)
|
#if not defined(V761_NRF24L01_INO)
|
||||||
#undef V761_HUB_TELEMETRY
|
#undef V761_HUB_TELEMETRY
|
||||||
#endif
|
#endif
|
||||||
|
#if not defined(FX_NRF24L01_INO)
|
||||||
|
#undef FX_HUB_TELEMETRY
|
||||||
|
#endif
|
||||||
#if not defined(KAMTOM_NRF24L01_INO)
|
#if not defined(KAMTOM_NRF24L01_INO)
|
||||||
#undef KAMTOM_HUB_TELEMETRY
|
#undef KAMTOM_HUB_TELEMETRY
|
||||||
#endif
|
#endif
|
||||||
@ -597,7 +601,7 @@
|
|||||||
//protocols using FRSKYD user frames
|
//protocols using FRSKYD user frames
|
||||||
#undef HUB_TELEMETRY
|
#undef HUB_TELEMETRY
|
||||||
#endif
|
#endif
|
||||||
#if not defined(HOTT_FW_TELEMETRY) && 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(RLINK_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) && not defined(AFHDS2A_RX_TELEMETRY) && not defined(BAYANG_RX_TELEMETRY) && not defined(DEVO_HUB_TELEMETRY) && not defined(PROPEL_HUB_TELEMETRY) && not defined(OMP_HUB_TELEMETRY) && not defined(V761_HUB_TELEMETRY) && not defined(KAMTOM_HUB_TELEMETRY) && not defined(YUXIANG_HUB_TELEMETRY) && not defined(WFLY2_HUB_TELEMETRY) && not defined(LOLI_HUB_TELEMETRY) && not defined(MLINK_HUB_TELEMETRY) && not defined(MLINK_FW_TELEMETRY) && not defined(MT99XX_HUB_TELEMETRY) && not defined(MULTI_CONFIG_INO)
|
#if not defined(HOTT_FW_TELEMETRY) && 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(RLINK_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) && not defined(AFHDS2A_RX_TELEMETRY) && not defined(BAYANG_RX_TELEMETRY) && not defined(DEVO_HUB_TELEMETRY) && not defined(PROPEL_HUB_TELEMETRY) && not defined(OMP_HUB_TELEMETRY) && not defined(V761_HUB_TELEMETRY) && not defined(FX_HUB_TELEMETRY) && not defined(KAMTOM_HUB_TELEMETRY) && not defined(YUXIANG_HUB_TELEMETRY) && not defined(WFLY2_HUB_TELEMETRY) && not defined(LOLI_HUB_TELEMETRY) && not defined(MLINK_HUB_TELEMETRY) && not defined(MLINK_FW_TELEMETRY) && not defined(MT99XX_HUB_TELEMETRY) && not defined(MULTI_CONFIG_INO)
|
||||||
#undef TELEMETRY
|
#undef TELEMETRY
|
||||||
#undef INVERT_TELEMETRY
|
#undef INVERT_TELEMETRY
|
||||||
#undef MULTI_TELEMETRY
|
#undef MULTI_TELEMETRY
|
||||||
|
@ -354,14 +354,15 @@
|
|||||||
#define OMP_HUB_TELEMETRY // Use FrSkyD Hub format to send telemetry to TX
|
#define OMP_HUB_TELEMETRY // Use FrSkyD Hub format to send telemetry to TX
|
||||||
#define V761_HUB_TELEMETRY // Use FrSkyD Hub format to send telemetry to TX
|
#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 KAMTOM_HUB_TELEMETRY // Use FrSkyD Hub format to send telemetry to TX
|
||||||
#define YUXIANG_HUB_TELEMETRY
|
#define FX_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 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
|
#define CABELL_HUB_TELEMETRY // Use FrSkyD Hub format to send telemetry to TX
|
||||||
#define RLINK_HUB_TELEMETRY // Use FrSkyD Hub format to send telemetry to TX
|
#define RLINK_HUB_TELEMETRY // Use FrSkyD Hub format to send telemetry to TX
|
||||||
#define WFLY2_HUB_TELEMETRY // Use FrSkyD Hub format to send telemetry to TX
|
#define WFLY2_HUB_TELEMETRY // Use FrSkyD Hub format to send telemetry to TX
|
||||||
#define LOLI_HUB_TELEMETRY // Use FrSkyD Hub format to send telemetry to TX
|
#define LOLI_HUB_TELEMETRY // Use FrSkyD Hub format to send telemetry to TX
|
||||||
#define MT99XX_HUB_TELEMETRY // Use FrSkyD Hub format to send telemetry to TX
|
#define MT99XX_HUB_TELEMETRY // Use FrSkyD Hub format to send telemetry to TX
|
||||||
//#define MLINK_HUB_TELEMETRY // Use FrSkyD Hub format to send telemetry to TX
|
//#define MLINK_HUB_TELEMETRY // Use FrSkyD Hub format to send telemetry to TX
|
||||||
#define MLINK_FW_TELEMETRY // Forward received telemetry packet directly to TX to be decoded by erskyTX and OpenTX
|
#define MLINK_FW_TELEMETRY // Forward received telemetry packet directly to TX to be decoded by erskyTX and OpenTX
|
||||||
//#define HITEC_HUB_TELEMETRY // Use FrSkyD Hub format to send basic telemetry to the radios which can decode it like er9x, erskyTX and OpenTX
|
//#define HITEC_HUB_TELEMETRY // Use FrSkyD Hub format to send basic telemetry to the radios which can decode it like er9x, erskyTX and OpenTX
|
||||||
#define HITEC_FW_TELEMETRY // Forward received telemetry packets to be decoded by erskyTX and OpenTX
|
#define HITEC_FW_TELEMETRY // Forward received telemetry packets to be decoded by erskyTX and OpenTX
|
||||||
|
Loading…
x
Reference in New Issue
Block a user