Few changes...

This commit is contained in:
pascallanger 2019-11-02 18:13:47 +01:00
parent 815cf4fd99
commit e6e4d33847
3 changed files with 20 additions and 18 deletions

View File

@ -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 29 #define VERSION_PATCH_LEVEL 30
//****************** //******************
// Protocols // Protocols

View File

@ -184,7 +184,6 @@ uint8_t packet_in[TELEMETRY_BUFFER_SIZE];//telemetry receiving packets
#endif #endif
#define INVERT_SERIAL 1 #define INVERT_SERIAL 1
#endif #endif
uint8_t pass = 0;
uint8_t telemetry_in_buffer[TELEMETRY_BUFFER_SIZE];//telemetry receiving packets uint8_t telemetry_in_buffer[TELEMETRY_BUFFER_SIZE];//telemetry receiving packets
#ifdef BASH_SERIAL #ifdef BASH_SERIAL
// For bit-bashed serial output // For bit-bashed serial output
@ -583,11 +582,11 @@ void loop()
sei(); // Enable global int sei(); // Enable global int
if((diff&0x8000) && !(next_callback&0x8000)) if((diff&0x8000) && !(next_callback&0x8000))
{ // Negative result=callback should already have been called... { // Negative result=callback should already have been called...
cli(); // Disable global int due to RW of 16 bits registers debugln("Short CB:%d",next_callback);
/* cli(); // Disable global int due to RW of 16 bits registers
OCR1A=TCNT1; // Use "now" as new sync point. OCR1A=TCNT1; // Use "now" as new sync point.
sei(); // Enable global int sei(); // Enable global int
debugln("Short CB:%d",next_callback); */ }
}
else else
{ {
if(IS_RX_FLAG_on || IS_PPM_FLAG_on) if(IS_RX_FLAG_on || IS_PPM_FLAG_on)
@ -607,6 +606,11 @@ void loop()
{ {
if(diff>900*2) if(diff>900*2)
{ //If at least 1ms is available update values { //If at least 1ms is available update values
if((diff&0x8000) && !(next_callback&0x8000))
{//should never be here
debugln("Strange");
break;
}
count=0; count=0;
Update_All(); Update_All();
#ifdef DEBUG_SERIAL #ifdef DEBUG_SERIAL
@ -952,7 +956,6 @@ static void protocol_init()
multi_protocols_index = 0xFF; multi_protocols_index = 0xFF;
#endif #endif
tx_pause(); tx_pause();
pass=0;
init_frskyd_link_telemetry(); init_frskyd_link_telemetry();
#ifdef BASH_SERIAL #ifdef BASH_SERIAL
TIMSK0 = 0 ; // Stop all timer 0 interrupts TIMSK0 = 0 ; // Stop all timer 0 interrupts

View File

@ -31,13 +31,10 @@ uint8_t RetrySequence ;
#endif // MULTI_TELEMETRY/MULTI_STATUS #endif // MULTI_TELEMETRY/MULTI_STATUS
#if defined SPORT_TELEMETRY #if defined SPORT_TELEMETRY
#define SPORT_TIME 12000 //12ms
#define FRSKY_SPORT_PACKET_SIZE 8 #define FRSKY_SPORT_PACKET_SIZE 8
#define FX_BUFFERS 4 #define FX_BUFFERS 4
uint32_t last = 0;
uint8_t sport_counter=0;
uint8_t RxBt = 0; uint8_t RxBt = 0;
uint8_t sport = 0; uint8_t Sport_Data = 0;
uint8_t pktx1[FRSKY_SPORT_PACKET_SIZE*FX_BUFFERS]; uint8_t pktx1[FRSKY_SPORT_PACKET_SIZE*FX_BUFFERS];
// Store for out of sequence packet // Store for out of sequence packet
@ -64,7 +61,6 @@ uint8_t RetrySequence ;
#define STUFF_MASK 0x20 #define STUFF_MASK 0x20
#define MAX_PKTX 10 #define MAX_PKTX 10
uint8_t pktx[MAX_PKTX]; uint8_t pktx[MAX_PKTX];
uint8_t indx;
uint8_t frame[18]; uint8_t frame[18];
#if ( defined(MULTI_TELEMETRY) || defined(MULTI_STATUS) ) #if ( defined(MULTI_TELEMETRY) || defined(MULTI_STATUS) )
@ -688,7 +684,9 @@ void sportIdle()
void sportSendFrame() void sportSendFrame()
{ {
static uint8_t sport_counter=0;
uint8_t i; uint8_t i;
sport_counter = (sport_counter + 1) %36; sport_counter = (sport_counter + 1) %36;
if(telemetry_lost) if(telemetry_lost)
{ {
@ -725,14 +723,14 @@ void sportSendFrame()
frame[4] = RxBt;//a1; frame[4] = RxBt;//a1;
break; break;
default: default:
if(sport) if(Sport_Data)
{ {
for (i=0;i<FRSKY_SPORT_PACKET_SIZE;i++) for (i=0;i<FRSKY_SPORT_PACKET_SIZE;i++)
frame[i]=pktx1[i]; frame[i]=pktx1[i];
sport -- ; Sport_Data -- ;
if ( sport ) if ( Sport_Data )
{ {
uint8_t j = sport * FRSKY_SPORT_PACKET_SIZE ; uint8_t j = Sport_Data * FRSKY_SPORT_PACKET_SIZE ;
for (i=0;i<j;i++) for (i=0;i<j;i++)
pktx1[i] = pktx1[i+FRSKY_SPORT_PACKET_SIZE] ; pktx1[i] = pktx1[i+FRSKY_SPORT_PACKET_SIZE] ;
} }
@ -749,6 +747,7 @@ void sportSendFrame()
void proces_sport_data(uint8_t data) void proces_sport_data(uint8_t data)
{ {
static uint8_t pass = 0, indx = 0;
switch (pass) switch (pass)
{ {
case 0: case 0:
@ -779,13 +778,13 @@ void proces_sport_data(uint8_t data)
} // end switch } // end switch
if (indx >= FRSKY_SPORT_PACKET_SIZE) if (indx >= FRSKY_SPORT_PACKET_SIZE)
{//8 bytes no crc {//8 bytes no crc
if ( sport < FX_BUFFERS ) if ( Sport_Data < FX_BUFFERS )
{ {
uint8_t dest = sport * FRSKY_SPORT_PACKET_SIZE ; uint8_t dest = Sport_Data * FRSKY_SPORT_PACKET_SIZE ;
uint8_t i ; uint8_t i ;
for ( i = 0 ; i < FRSKY_SPORT_PACKET_SIZE ; i++ ) for ( i = 0 ; i < FRSKY_SPORT_PACKET_SIZE ; i++ )
pktx1[dest++] = pktx[i] ; // Triple buffer pktx1[dest++] = pktx[i] ; // Triple buffer
sport += 1 ;//ok to send Sport_Data += 1 ;//ok to send
} }
// else // else
// { // {