diff --git a/Multiprotocol/Multiprotocol.h b/Multiprotocol/Multiprotocol.h index a26627b..73be31d 100644 --- a/Multiprotocol/Multiprotocol.h +++ b/Multiprotocol/Multiprotocol.h @@ -19,7 +19,7 @@ #define VERSION_MAJOR 1 #define VERSION_MINOR 3 #define VERSION_REVISION 0 -#define VERSION_PATCH_LEVEL 29 +#define VERSION_PATCH_LEVEL 30 //****************** // Protocols diff --git a/Multiprotocol/Multiprotocol.ino b/Multiprotocol/Multiprotocol.ino index 3299615..c3a51da 100644 --- a/Multiprotocol/Multiprotocol.ino +++ b/Multiprotocol/Multiprotocol.ino @@ -184,7 +184,6 @@ uint8_t packet_in[TELEMETRY_BUFFER_SIZE];//telemetry receiving packets #endif #define INVERT_SERIAL 1 #endif - uint8_t pass = 0; uint8_t telemetry_in_buffer[TELEMETRY_BUFFER_SIZE];//telemetry receiving packets #ifdef BASH_SERIAL // For bit-bashed serial output @@ -583,11 +582,11 @@ void loop() sei(); // Enable global int if((diff&0x8000) && !(next_callback&0x8000)) { // 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. sei(); // Enable global int - debugln("Short CB:%d",next_callback); - } +*/ } else { if(IS_RX_FLAG_on || IS_PPM_FLAG_on) @@ -607,6 +606,11 @@ void loop() { if(diff>900*2) { //If at least 1ms is available update values + if((diff&0x8000) && !(next_callback&0x8000)) + {//should never be here + debugln("Strange"); + break; + } count=0; Update_All(); #ifdef DEBUG_SERIAL @@ -952,7 +956,6 @@ static void protocol_init() multi_protocols_index = 0xFF; #endif tx_pause(); - pass=0; init_frskyd_link_telemetry(); #ifdef BASH_SERIAL TIMSK0 = 0 ; // Stop all timer 0 interrupts diff --git a/Multiprotocol/Telemetry.ino b/Multiprotocol/Telemetry.ino index 1813fe2..c4939bb 100644 --- a/Multiprotocol/Telemetry.ino +++ b/Multiprotocol/Telemetry.ino @@ -31,13 +31,10 @@ uint8_t RetrySequence ; #endif // MULTI_TELEMETRY/MULTI_STATUS #if defined SPORT_TELEMETRY - #define SPORT_TIME 12000 //12ms #define FRSKY_SPORT_PACKET_SIZE 8 #define FX_BUFFERS 4 - uint32_t last = 0; - uint8_t sport_counter=0; uint8_t RxBt = 0; - uint8_t sport = 0; + uint8_t Sport_Data = 0; uint8_t pktx1[FRSKY_SPORT_PACKET_SIZE*FX_BUFFERS]; // Store for out of sequence packet @@ -64,7 +61,6 @@ uint8_t RetrySequence ; #define STUFF_MASK 0x20 #define MAX_PKTX 10 uint8_t pktx[MAX_PKTX]; -uint8_t indx; uint8_t frame[18]; #if ( defined(MULTI_TELEMETRY) || defined(MULTI_STATUS) ) @@ -688,7 +684,9 @@ void sportIdle() void sportSendFrame() { + static uint8_t sport_counter=0; uint8_t i; + sport_counter = (sport_counter + 1) %36; if(telemetry_lost) { @@ -725,14 +723,14 @@ void sportSendFrame() frame[4] = RxBt;//a1; break; default: - if(sport) + if(Sport_Data) { for (i=0;i= FRSKY_SPORT_PACKET_SIZE) {//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 ; for ( i = 0 ; i < FRSKY_SPORT_PACKET_SIZE ; i++ ) pktx1[dest++] = pktx[i] ; // Triple buffer - sport += 1 ;//ok to send + Sport_Data += 1 ;//ok to send } // else // {