mirror of
https://github.com/pascallanger/DIY-Multiprotocol-TX-Module.git
synced 2025-02-10 13:38:12 +00:00
Small tweaks
This commit is contained in:
parent
9b499ab7d1
commit
5cf2bf2cf5
@ -183,7 +183,7 @@ static void __attribute__((unused)) FrSkyX_build_packet()
|
|||||||
packet[9+i+1]=(((chan_0>>8) & 0x0F)|(chan_1 << 4));
|
packet[9+i+1]=(((chan_0>>8) & 0x0F)|(chan_1 << 4));
|
||||||
packet[9+i+2]=chan_1>>4;
|
packet[9+i+2]=chan_1>>4;
|
||||||
}
|
}
|
||||||
if(sub_protocol & 0x01 ) // in X8 mode send only 8ch every 9ms
|
if(sub_protocol & 0x01 ) //In X8 mode send only 8ch every 9ms
|
||||||
chan_offset = 0 ;
|
chan_offset = 0 ;
|
||||||
else
|
else
|
||||||
chan_offset^=0x08;
|
chan_offset^=0x08;
|
||||||
@ -192,7 +192,7 @@ static void __attribute__((unused)) FrSkyX_build_packet()
|
|||||||
uint8_t limit = (sub_protocol & 2 ) ? 31 : 28 ;
|
uint8_t limit = (sub_protocol & 2 ) ? 31 : 28 ;
|
||||||
for (uint8_t i=22;i<limit;i++)
|
for (uint8_t i=22;i<limit;i++)
|
||||||
packet[i]=0;
|
packet[i]=0;
|
||||||
packet[21] = FrSkyX_RX_Seq << 4;//TX=8 at startup
|
packet[21] = FrSkyX_RX_Seq << 4; //TX=8 at startup
|
||||||
#ifdef SPORT_SEND
|
#ifdef SPORT_SEND
|
||||||
if (FrSkyX_TX_IN_Seq!=0xFF)
|
if (FrSkyX_TX_IN_Seq!=0xFF)
|
||||||
{//RX has replied at least once
|
{//RX has replied at least once
|
||||||
@ -201,7 +201,7 @@ static void __attribute__((unused)) FrSkyX_build_packet()
|
|||||||
//debugln("Init");
|
//debugln("Init");
|
||||||
FrSkyX_TX_Seq = 0 ;
|
FrSkyX_TX_Seq = 0 ;
|
||||||
for(uint8_t i=0;i<4;i++)
|
for(uint8_t i=0;i<4;i++)
|
||||||
FrSkyX_TX_Frames[i].count=0; // discard frames in current output buffer
|
FrSkyX_TX_Frames[i].count=0; //Discard frames in current output buffer
|
||||||
}
|
}
|
||||||
else if (FrSkyX_TX_IN_Seq & 0x04)
|
else if (FrSkyX_TX_IN_Seq & 0x04)
|
||||||
{//Retransmit the requested packet
|
{//Retransmit the requested packet
|
||||||
@ -242,7 +242,7 @@ static void __attribute__((unused)) FrSkyX_build_packet()
|
|||||||
debugln("Ok buf:%d",used);
|
debugln("Ok buf:%d",used);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FrSkyX_TX_Seq = ( FrSkyX_TX_Seq + 1 ) & 0x03 ; // Next iteration send next packet
|
FrSkyX_TX_Seq = ( FrSkyX_TX_Seq + 1 ) & 0x03 ; //Next iteration send next packet
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{//Not in sequence somehow, transmit what the receiver wants but why not asking for retransmit...
|
{//Not in sequence somehow, transmit what the receiver wants but why not asking for retransmit...
|
||||||
@ -316,21 +316,22 @@ uint16_t ReadFrSkyX()
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
packet_count++;
|
packet_count++;
|
||||||
|
//debugln("M %d",packet_count);
|
||||||
// restart sequence on missed packet - might need count or timeout instead of one missed
|
// restart sequence on missed packet - might need count or timeout instead of one missed
|
||||||
if(packet_count>100)
|
if(packet_count>100)
|
||||||
{//~1sec
|
{//~1sec
|
||||||
FrSkyX_TX_Seq = 0x08 ; // Request init
|
FrSkyX_TX_Seq = 0x08 ; //Request init
|
||||||
FrSkyX_TX_IN_Seq = 0xFF ; // No sequence received yet
|
FrSkyX_TX_IN_Seq = 0xFF ; //No sequence received yet
|
||||||
#ifdef SPORT_SEND
|
#ifdef SPORT_SEND
|
||||||
for(uint8_t i=0;i<4;i++)
|
for(uint8_t i=0;i<4;i++)
|
||||||
FrSkyX_TX_Frames[i].count=0; // discard frames in current output buffer
|
FrSkyX_TX_Frames[i].count=0; //Discard frames in current output buffer
|
||||||
#endif
|
#endif
|
||||||
packet_count=0;
|
packet_count=0;
|
||||||
#if defined TELEMETRY
|
#if defined TELEMETRY
|
||||||
telemetry_lost=1;
|
telemetry_lost=1;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
CC2500_Strobe(CC2500_SFRX); //flush the RXFIFO
|
CC2500_Strobe(CC2500_SFRX); //Flush the RXFIFO
|
||||||
}
|
}
|
||||||
FrSkyX_build_packet();
|
FrSkyX_build_packet();
|
||||||
state = FRSKY_DATA1;
|
state = FRSKY_DATA1;
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
#define VERSION_MAJOR 1
|
#define VERSION_MAJOR 1
|
||||||
#define VERSION_MINOR 3
|
#define VERSION_MINOR 3
|
||||||
#define VERSION_REVISION 0
|
#define VERSION_REVISION 0
|
||||||
#define VERSION_PATCH_LEVEL 27
|
#define VERSION_PATCH_LEVEL 28
|
||||||
|
|
||||||
//******************
|
//******************
|
||||||
// Protocols
|
// Protocols
|
||||||
|
@ -609,7 +609,7 @@ void loop()
|
|||||||
{ //If at least 1ms is available update values
|
{ //If at least 1ms is available update values
|
||||||
count=0;
|
count=0;
|
||||||
Update_All();
|
Update_All();
|
||||||
#if defined(STM32_BOARD) && defined(DEBUG_SERIAL)
|
#ifdef DEBUG_SERIAL
|
||||||
if(TIMER2_BASE->SR & TIMER_SR_CC1IF )
|
if(TIMER2_BASE->SR & TIMER_SR_CC1IF )
|
||||||
debugln("Long update");
|
debugln("Long update");
|
||||||
#endif
|
#endif
|
||||||
@ -2161,8 +2161,10 @@ static uint32_t random_id(uint16_t address, uint8_t create_new)
|
|||||||
else
|
else
|
||||||
RX_MISSED_BUFF_on; // Notify that rx_buff is good
|
RX_MISSED_BUFF_on; // Notify that rx_buff is good
|
||||||
}
|
}
|
||||||
|
#ifdef DEBUG_SERIAL
|
||||||
else
|
else
|
||||||
debugln("RX frame too short");
|
debugln("RX frame too short");
|
||||||
|
#endif
|
||||||
discard_frame=true;
|
discard_frame=true;
|
||||||
#ifdef STM32_BOARD
|
#ifdef STM32_BOARD
|
||||||
TIMER2_BASE->DIER &= ~TIMER_DIER_CC2IE; // Disable Timer2/Comp2 interrupt
|
TIMER2_BASE->DIER &= ~TIMER_DIER_CC2IE; // Disable Timer2/Comp2 interrupt
|
||||||
|
@ -80,7 +80,7 @@ static void multi_send_header(uint8_t type, uint8_t len)
|
|||||||
Serial_write(len);
|
Serial_write(len);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void telemetry_set_input_sync(uint16_t refreshRate)
|
static void telemetry_set_input_sync(uint16_t refreshRate)
|
||||||
{
|
{
|
||||||
#ifdef MULTI_SYNC
|
#ifdef MULTI_SYNC
|
||||||
#if defined(STM32_BOARD) && defined(DEBUG_PIN)
|
#if defined(STM32_BOARD) && defined(DEBUG_PIN)
|
||||||
|
@ -225,7 +225,7 @@
|
|||||||
//FrSkyX specific setting
|
//FrSkyX specific setting
|
||||||
//-----------------------
|
//-----------------------
|
||||||
//EU LBT setting: if commented the TX will not check if a channel is busy before transmitting.
|
//EU LBT setting: if commented the TX will not check if a channel is busy before transmitting.
|
||||||
//!!!Work in progress!!! it's currently known to cause telemerty issues. Enable only if you know what you are doing.
|
//!!! Work in progress !!! it's currently known to cause telemerty issues. Enable only if you know what you are doing.
|
||||||
//#define FRSKYX_LBT
|
//#define FRSKYX_LBT
|
||||||
|
|
||||||
//DSM specific settings
|
//DSM specific settings
|
||||||
@ -283,7 +283,8 @@
|
|||||||
//Send to OpenTX the current protocol and subprotocol names. Comment to disable.
|
//Send to OpenTX the current protocol and subprotocol names. Comment to disable.
|
||||||
#define MULTI_NAMES
|
#define MULTI_NAMES
|
||||||
//Sync OpenTX frames with the current protocol timing. This feature is only available on the STM32 module. Comment to disable.
|
//Sync OpenTX frames with the current protocol timing. This feature is only available on the STM32 module. Comment to disable.
|
||||||
#define MULTI_SYNC
|
//!!! Work in progress !!! Do not enable for internal module
|
||||||
|
//#define MULTI_SYNC
|
||||||
|
|
||||||
//Comment a line to disable a specific protocol telemetry
|
//Comment a line to disable a specific protocol telemetry
|
||||||
#define DSM_TELEMETRY // Forward received telemetry packet directly to TX to be decoded by er9x, erskyTX and OpenTX
|
#define DSM_TELEMETRY // Forward received telemetry packet directly to TX to be decoded by er9x, erskyTX and OpenTX
|
||||||
|
Loading…
x
Reference in New Issue
Block a user