mirror of
https://github.com/pascallanger/DIY-Multiprotocol-TX-Module.git
synced 2025-02-11 00:28:14 +00:00
FrSkyX: improve SPort to RX code
This commit is contained in:
parent
272d2be3ae
commit
3f652fa06c
@ -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 82
|
#define VERSION_PATCH_LEVEL 83
|
||||||
|
|
||||||
//******************
|
//******************
|
||||||
// Protocols
|
// Protocols
|
||||||
|
@ -1792,13 +1792,20 @@ void update_serial_data()
|
|||||||
#define BYTE_STUFF 0x7D
|
#define BYTE_STUFF 0x7D
|
||||||
#define STUFF_MASK 0x20
|
#define STUFF_MASK 0x20
|
||||||
//debug("SPort_in: ");
|
//debug("SPort_in: ");
|
||||||
|
boolean sport_valid=false;
|
||||||
|
for(uint8_t i=28;i<28+7;i++)
|
||||||
|
if(rx_ok_buff[i]!=0) sport_valid=true; //Check that the payload is not full of 0
|
||||||
|
if(rx_ok_buff[27]&0x1F > 0x1B) //Check 1st byte validity
|
||||||
|
sport_valid=false;
|
||||||
|
if(sport_valid)
|
||||||
|
{
|
||||||
SportData[SportTail]=0x7E;
|
SportData[SportTail]=0x7E;
|
||||||
SportTail = (SportTail+1) & (MAX_SPORT_BUFFER-1);
|
SportTail = (SportTail+1) & (MAX_SPORT_BUFFER-1);
|
||||||
SportData[SportTail]=rx_ok_buff[27]&0x1F;
|
SportData[SportTail]=rx_ok_buff[27]&0x1F;
|
||||||
SportTail = (SportTail+1) & (MAX_SPORT_BUFFER-1);
|
SportTail = (SportTail+1) & (MAX_SPORT_BUFFER-1);
|
||||||
for(uint8_t i=28;i<28+7;i++)
|
for(uint8_t i=28;i<28+7;i++)
|
||||||
{
|
{
|
||||||
if(rx_ok_buff[i]==BYTE_STUFF)
|
if( (rx_ok_buff[i]==BYTE_STUFF) || (rx_ok_buff[i]==0x7E) )
|
||||||
{//stuff
|
{//stuff
|
||||||
SportData[SportTail]=BYTE_STUFF;
|
SportData[SportTail]=BYTE_STUFF;
|
||||||
SportTail = (SportTail+1) & (MAX_SPORT_BUFFER-1);
|
SportTail = (SportTail+1) & (MAX_SPORT_BUFFER-1);
|
||||||
@ -1821,6 +1828,7 @@ void update_serial_data()
|
|||||||
debugln("Low buf=%d,h=%d,t=%d",used,SportHead,SportTail);
|
debugln("Low buf=%d,h=%d,t=%d",used,SportHead,SportTail);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif //SPORT_SEND
|
#endif //SPORT_SEND
|
||||||
#ifdef HOTT_FW_TELEMETRY
|
#ifdef HOTT_FW_TELEMETRY
|
||||||
if(protocol==PROTO_HOTT && rx_len==28)
|
if(protocol==PROTO_HOTT && rx_len==28)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user