mirror of
https://github.com/pascallanger/DIY-Multiprotocol-TX-Module.git
synced 2025-07-01 10:17:53 +00:00
PPM mode FrSkyX to FrSkyD
If TELEMETRY_FRSKYX_TO_FRSKYD is defined in PPM mode FrSkyX simple telemetry will be sent using FrSkyD format: RX_RSSI, RX_Batt, TX_RSSI, TX_LQI
This commit is contained in:
parent
6dfd54b8be
commit
31ff27b1d3
@ -404,9 +404,6 @@ uint16_t initAFHDS2A()
|
||||
rx_id[i]=eeprom_read_byte((EE_ADDR)(addr+i));
|
||||
}
|
||||
hopping_frequency_no = 0;
|
||||
#if defined(AFHDS2A_FW_TELEMETRY) || defined(AFHDS2A_HUB_TELEMETRY)
|
||||
init_frskyd_link_telemetry();
|
||||
#endif
|
||||
return 50000;
|
||||
}
|
||||
#endif
|
||||
|
@ -376,9 +376,6 @@ uint16_t initBUGSMINI()
|
||||
armed = 0;
|
||||
arm_flags = BUGSMINI_FLAG_DISARM; // initial value from captures
|
||||
arm_channel_previous = BUGSMINI_CH_SW_ARM;
|
||||
#ifdef BUGS_HUB_TELEMETRY
|
||||
init_frskyd_link_telemetry();
|
||||
#endif
|
||||
return BUGSMINI_INITIAL_WAIT;
|
||||
}
|
||||
|
||||
|
@ -352,10 +352,6 @@ uint16_t initBAYANG(void)
|
||||
BAYANG_initialize_txid();
|
||||
BAYANG_init();
|
||||
packet_count=0;
|
||||
#ifdef BAYANG_HUB_TELEMETRY
|
||||
init_frskyd_link_telemetry();
|
||||
telemetry_lost=1; // do not send telemetry to TX right away until we have a TX_RSSI value to prevent warning message...
|
||||
#endif
|
||||
return BAYANG_INITIAL_WAIT+BAYANG_PACKET_PERIOD;
|
||||
}
|
||||
|
||||
|
@ -457,9 +457,6 @@ uint16_t initBUGS(void)
|
||||
armed = 0;
|
||||
arm_flags = BUGS_FLAG_DISARM; // initial value from captures
|
||||
arm_channel_previous = BUGS_CH_SW_ARM;
|
||||
#ifdef BUGS_HUB_TELEMETRY
|
||||
init_frskyd_link_telemetry();
|
||||
#endif
|
||||
|
||||
return 10000;
|
||||
}
|
||||
|
@ -430,10 +430,6 @@ uint16_t initCABELL(void)
|
||||
else
|
||||
bind_counter = CABELL_BIND_COUNT;
|
||||
CABELL_init();
|
||||
#if defined CABELL_HUB_TELEMETRY
|
||||
init_frskyd_link_telemetry();
|
||||
telemetry_lost=1; // do not send telemetry to TX right away until we have a TX_RSSI value to prevent warning message...
|
||||
#endif
|
||||
|
||||
packet_period = CABELL_PACKET_PERIOD;
|
||||
|
||||
|
@ -97,9 +97,6 @@ uint16_t initFrSky_2way()
|
||||
{
|
||||
Frsky_init_hop();
|
||||
packet_count=0;
|
||||
#if defined TELEMETRY
|
||||
init_frskyd_link_telemetry();
|
||||
#endif
|
||||
if(IS_BIND_IN_PROGRESS)
|
||||
{
|
||||
frsky2way_init(1);
|
||||
|
@ -392,10 +392,6 @@ uint16_t initHITEC()
|
||||
rx_tx_addr[3]=0x6A;
|
||||
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
|
||||
#if defined(HITEC_HUB_TELEMETRY)
|
||||
if(sub_protocol==OPT_HUB)
|
||||
init_frskyd_link_telemetry();
|
||||
#endif
|
||||
phase = HITEC_START;
|
||||
return 10000;
|
||||
}
|
||||
|
@ -465,9 +465,6 @@ uint16_t initHubsan()
|
||||
}
|
||||
packet_count=0;
|
||||
bind_phase=0;
|
||||
#ifdef HUBSAN_HUB_TELEMETRY
|
||||
init_frskyd_link_telemetry();
|
||||
#endif
|
||||
return 10000;
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
||||
#define VERSION_MAJOR 1
|
||||
#define VERSION_MINOR 3
|
||||
#define VERSION_REVISION 0
|
||||
#define VERSION_PATCH_LEVEL 13
|
||||
#define VERSION_PATCH_LEVEL 14
|
||||
|
||||
//******************
|
||||
// Protocols
|
||||
@ -607,7 +607,7 @@ enum {
|
||||
16 channels serial protocol
|
||||
***************************
|
||||
Serial: 100000 Baud 8e2 _ xxxx xxxx p --
|
||||
Total of 26 bytes for protocol V1, variable length for protocol V2
|
||||
Total of 26 bytes for protocol V1, variable length 27..36 for protocol V2
|
||||
Stream[0] = header
|
||||
0x55 sub_protocol values are 0..31 Stream contains channels
|
||||
0x54 sub_protocol values are 32..63 Stream contains channels
|
||||
@ -836,7 +836,7 @@ Serial: 100000 Baud 8e2 _ xxxx xxxx p --
|
||||
Future_Use => 0x04 0= , 1=
|
||||
Disable_Telemetry => 0x02 0=enable, 1=disable
|
||||
Disable_CH_Mapping => 0x01 0=enable, 1=disable
|
||||
Stream[27.. 36] = between 0 and 9 bytes for additional protocol data
|
||||
Stream[27.. 35] = between 0 and 9 bytes for additional protocol data
|
||||
*/
|
||||
/*
|
||||
Multimodule Status
|
||||
|
@ -937,8 +937,7 @@ static void protocol_init()
|
||||
#endif
|
||||
tx_pause();
|
||||
pass=0;
|
||||
telemetry_link=0;
|
||||
telemetry_lost=1;
|
||||
init_frskyd_link_telemetry();
|
||||
#ifdef BASH_SERIAL
|
||||
TIMSK0 = 0 ; // Stop all timer 0 interrupts
|
||||
#ifdef INVERT_SERIAL
|
||||
@ -1883,10 +1882,16 @@ void pollBoot()
|
||||
#if defined(TELEMETRY)
|
||||
void PPM_Telemetry_serial_init()
|
||||
{
|
||||
if( (protocol==PROTO_FRSKYD) || (protocol==PROTO_HUBSAN) || (protocol==PROTO_AFHDS2A) || (protocol==PROTO_BAYANG)|| (protocol==PROTO_NCC1701) || (protocol==PROTO_CABELL) || (protocol==PROTO_HITEC) || (protocol==PROTO_BUGS) || (protocol==PROTO_BUGSMINI))
|
||||
if( (protocol==PROTO_FRSKYD) || (protocol==PROTO_HUBSAN) || (protocol==PROTO_AFHDS2A) || (protocol==PROTO_BAYANG)|| (protocol==PROTO_NCC1701) || (protocol==PROTO_CABELL) || (protocol==PROTO_HITEC) || (protocol==PROTO_BUGS) || (protocol==PROTO_BUGSMINI)
|
||||
#ifdef TELEMETRY_FRSKYX_TO_FRSKYD
|
||||
|| (protocol==PROTO_FRSKYX)
|
||||
#endif
|
||||
)
|
||||
initTXSerial( SPEED_9600 ) ;
|
||||
#ifndef TELEMETRY_FRSKYX_TO_FRSKYD
|
||||
if(protocol==PROTO_FRSKYX)
|
||||
initTXSerial( SPEED_57600 ) ;
|
||||
#endif
|
||||
if(protocol==PROTO_DSM)
|
||||
initTXSerial( SPEED_125K ) ;
|
||||
}
|
||||
@ -2028,14 +2033,14 @@ static uint32_t random_id(uint16_t address, uint8_t create_new)
|
||||
#endif
|
||||
{
|
||||
#if defined STM32_BOARD
|
||||
TIMER2_BASE->CCR2=TIMER2_BASE->CNT + 300; // Next byte should show up within 15us=1.5 byte
|
||||
TIMER2_BASE->CCR2=TIMER2_BASE->CNT + 360; // Next byte should show up within 18??s=1.5 byte
|
||||
TIMER2_BASE->SR = 0x1E5F & ~TIMER_SR_CC2IF; // Clear Timer2/Comp2 interrupt flag
|
||||
TIMER2_BASE->DIER |= TIMER_DIER_CC2IE; // Enable Timer2/Comp2 interrupt
|
||||
#else
|
||||
TX_RX_PAUSE_on;
|
||||
tx_pause();
|
||||
cli(); // Disable global int due to RW of 16 bits registers
|
||||
OCR1B = TCNT1 + 300; // Next byte should show up within 15us=1.5 byte
|
||||
OCR1B = TCNT1 + 360; // Next byte should show up within 18??s=1.5 byte
|
||||
sei(); // Enable global int
|
||||
TIFR1 = OCF1B_bm ; // clear OCR1B match flag
|
||||
SET_TIMSK1_OCIE1B ; // enable interrupt on compare B match
|
||||
@ -2054,10 +2059,10 @@ static uint32_t random_id(uint16_t address, uint8_t create_new)
|
||||
{
|
||||
rx_buff[rx_idx++]=UDR0; // Store received byte
|
||||
#if defined STM32_BOARD
|
||||
TIMER2_BASE->CCR2=TIMER2_BASE->CNT + 300; // Next byte should show up within 15us=1.5 byte
|
||||
TIMER2_BASE->CCR2=TIMER2_BASE->CNT + 360; // Next byte should show up within 18??s=1.5 byte
|
||||
#else
|
||||
cli(); // Disable global int due to RW of 16 bits registers
|
||||
OCR1B = TCNT1 + 300; // Next byte should show up within 15us=1.5 byte
|
||||
OCR1B = TCNT1 + 360; // Next byte should show up within 18??s=1.5 byte
|
||||
sei(); // Enable global int
|
||||
#endif
|
||||
}
|
||||
|
@ -269,9 +269,6 @@ uint16_t initNCC(void)
|
||||
hopping_frequency_no=4; // start with bind
|
||||
NCC_init();
|
||||
phase=NCC_BIND_TX1;
|
||||
#ifdef NCC1701_HUB_TELEMETRY
|
||||
init_frskyd_link_telemetry();
|
||||
#endif
|
||||
return 10000;
|
||||
}
|
||||
|
||||
|
@ -369,7 +369,13 @@ void frsky_check_telemetry(uint8_t *packet_in,uint8_t len)
|
||||
RX_RSSI=packet_in[4] & 0x7F ;
|
||||
else
|
||||
RxBt = (packet_in[4]<<1) + 1 ;
|
||||
|
||||
#if defined(TELEMETRY_FRSKYX_TO_FRSKYD) && defined(ENABLE_PPM)
|
||||
if(mode_select != MODE_SERIAL)
|
||||
{//PPM
|
||||
v_lipo1=RxBt;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
//Save outgoing telemetry sequence
|
||||
FrSkyX_TX_IN_Seq=packet_in[5] >> 4;
|
||||
|
||||
@ -447,6 +453,7 @@ void init_frskyd_link_telemetry()
|
||||
{
|
||||
telemetry_link=0;
|
||||
telemetry_counter=0;
|
||||
telemetry_lost=1;
|
||||
v_lipo1=0;
|
||||
v_lipo2=0;
|
||||
RX_RSSI=0;
|
||||
@ -467,8 +474,7 @@ void frsky_link_frame()
|
||||
telemetry_link |= 2 ; // Send hub if available
|
||||
}
|
||||
else
|
||||
if (protocol==PROTO_HUBSAN||protocol==PROTO_AFHDS2A||protocol==PROTO_BAYANG||protocol==PROTO_NCC1701||protocol==PROTO_CABELL||protocol==PROTO_HITEC||protocol==PROTO_BUGS||protocol==PROTO_BUGSMINI)
|
||||
{
|
||||
{//PROTO_HUBSAN, PROTO_AFHDS2A, PROTO_BAYANG, PROTO_NCC1701, PROTO_CABELL, PROTO_HITEC, PROTO_BUGS, PROTO_BUGSMINI, PROTO_FRSKYX
|
||||
frame[1] = v_lipo1;
|
||||
frame[2] = v_lipo2;
|
||||
frame[3] = RX_RSSI;
|
||||
@ -794,7 +800,7 @@ void TelemetryUpdate()
|
||||
return;
|
||||
}
|
||||
#ifdef MULTI_SYNC
|
||||
else if ( (now - lastInputSync) > INPUT_SYNC_TIME)
|
||||
if ( (now - lastInputSync) > INPUT_SYNC_TIME)
|
||||
{
|
||||
mult_send_inputsync();
|
||||
lastInputSync = now;
|
||||
@ -804,7 +810,11 @@ void TelemetryUpdate()
|
||||
#endif
|
||||
|
||||
#if defined SPORT_TELEMETRY
|
||||
if (protocol==PROTO_FRSKYX)
|
||||
if (protocol==PROTO_FRSKYX
|
||||
#ifdef TELEMETRY_FRSKYX_TO_FRSKYD
|
||||
&& mode_select==MODE_SERIAL
|
||||
#endif
|
||||
)
|
||||
{ // FrSkyX
|
||||
for(;;)
|
||||
{ //Empty buffer
|
||||
@ -870,8 +880,9 @@ void TelemetryUpdate()
|
||||
}
|
||||
#endif
|
||||
|
||||
if((telemetry_link & 1 )&& protocol != PROTO_FRSKYX)
|
||||
if( telemetry_link & 1 )
|
||||
{ // FrSkyD + Hubsan + AFHDS2A + Bayang + Cabell + Hitec + Bugs + BugsMini + NCC1701
|
||||
// FrSkyX telemetry if in PPM
|
||||
frsky_link_frame();
|
||||
return;
|
||||
}
|
||||
|
@ -258,26 +258,27 @@
|
||||
|
||||
//Comment to invert the polarity of the output telemetry serial signal.
|
||||
//This function takes quite some flash space and processor power on an atmega.
|
||||
//For OpenTX it must be uncommented.
|
||||
//On a 9XR_PRO running ersky9x both commented and uncommented will work depending on the radio setting Invert COM1 under the Telemetry menu.
|
||||
//On other addon/replacement boards like the 9xtreme board or the Ar9x board running ersky9x, you need to uncomment the line below.
|
||||
//For a Taranis/T16 with an external module it must be uncommented. For a T16 internal module it must be commented.
|
||||
//A 9XR_PRO running erskyTX will work with both commented and uncommented depending on the radio setting Invert COM1 under the Telemetry menu.
|
||||
//On other addon/replacement boards like the 9xtreme board or the Ar9x board running erskyTX, you need to uncomment the line below.
|
||||
//For er9x it depends if you have an inveter mod or not on the telemetry pin. If you don't have an inverter comment this line.
|
||||
//=>OpenTX 2.3.2 with a STM32 or OrangeRX module this setting can be ignored.
|
||||
#define INVERT_TELEMETRY
|
||||
|
||||
//Uncomment if you don't want to send Multi status telemetry frames (Protocol available, Bind in progress, version...)
|
||||
//Use with er9x/erksy9x, for OpenTX MULTI_TELEMETRY below is preferred instead
|
||||
//Use with er9x/erskyTX, for OpenTX MULTI_TELEMETRY below is preferred instead
|
||||
//#define MULTI_STATUS
|
||||
|
||||
//Sends Multi status and allow OpenTX to autodetect the telemetry format. Comment to disable.
|
||||
//Supported by OpenTX version 2.2 RC9 and newer. NOT supported by er9x/ersky9x use MULTI_STATUS instead.
|
||||
//Supported by OpenTX version 2.2 RC9 and newer. NOT supported by er9x/erskyTX use MULTI_STATUS instead.
|
||||
#define MULTI_TELEMETRY
|
||||
//Sync OpenTX frames with the current protocol timing. This feature is only available on the STM32 module. Comment to disable.
|
||||
#define MULTI_SYNC
|
||||
|
||||
//Comment a line to disable a specific protocol telemetry
|
||||
#define DSM_TELEMETRY // Forward received telemetry packet directly to TX to be decoded by er9x, ersky9x and OpenTX
|
||||
#define SPORT_TELEMETRY // Use FrSkyX format to send telemetry to TX
|
||||
#define AFHDS2A_FW_TELEMETRY // Forward received telemetry packet directly to TX to be decoded by ersky9x and OpenTX
|
||||
#define DSM_TELEMETRY // Forward received telemetry packet directly to TX to be decoded by er9x, erskyTX and OpenTX
|
||||
#define SPORT_TELEMETRY // Use FrSkyX format to send/receive telemetry
|
||||
#define AFHDS2A_FW_TELEMETRY // Forward received telemetry packet directly to TX to be decoded by erskyTX and OpenTX
|
||||
#define AFHDS2A_HUB_TELEMETRY // Use FrSkyD Hub format to send basic telemetry to TX like er9x
|
||||
#define HUB_TELEMETRY // Use FrSkyD Hub format to send telemetry to TX
|
||||
#define BAYANG_HUB_TELEMETRY // Use FrSkyD Hub format to send telemetry to TX
|
||||
@ -285,8 +286,8 @@
|
||||
#define HUBSAN_HUB_TELEMETRY // Use FrSkyD Hub format to send telemetry to TX
|
||||
#define NCC1701_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 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_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 // Under development: Forward received telemetry packets to be decoded by erskyTX and OpenTX
|
||||
#define SCANNER_TELEMETRY // Forward spectrum scanner data to TX
|
||||
#define FRSKYX_RX_TELEMETRY // Forward channels data to TX
|
||||
#define AFHDS2A_RX_TELEMETRY // Forward channels data to TX
|
||||
@ -340,6 +341,10 @@
|
||||
// The default value is 16 to receive all possible channels but you might want to filter some "bad" channels from the PPM frame like the ones above 6 on the Walkera PL0811.
|
||||
#define MAX_PPM_CHANNELS 16
|
||||
|
||||
/** Telemetry **/
|
||||
//Send simple FrSkyX telemetry using the FrSkyD telemetry format
|
||||
#define TELEMETRY_FRSKYX_TO_FRSKYD
|
||||
|
||||
/** Rotary Switch Protocol Selector Settings **/
|
||||
//The table below indicates which protocol to run when a specific position on the rotary switch has been selected.
|
||||
//All fields and values are explained below. Everything is configurable from here like in the Serial mode.
|
||||
|
Loading…
x
Reference in New Issue
Block a user