From db442d81dd0661ea29b1e71d96b2ba95b54afee5 Mon Sep 17 00:00:00 2001 From: pascallanger Date: Mon, 11 Nov 2019 19:15:39 +0100 Subject: [PATCH] Fix all compilation issues (?) --- Multiprotocol/AFHDS2A_a7105.ino | 4 ++- Multiprotocol/ASSAN_nrf24l01.ino | 4 ++- Multiprotocol/BUGSMINI_nrf24l01.ino | 4 ++- Multiprotocol/Bayang_nrf24l01.ino | 4 ++- Multiprotocol/Bugs_a7105.ino | 4 ++- Multiprotocol/CABELL_nrf224l01.ino | 4 ++- Multiprotocol/CFlie_nrf24l01.ino | 4 ++- Multiprotocol/CG023_nrf24l01.ino | 4 ++- Multiprotocol/CX10_nrf24l01.ino | 4 ++- Multiprotocol/Corona_cc2500.ino | 4 ++- Multiprotocol/DM002_nrf24l01.ino | 4 ++- Multiprotocol/DSM_cyrf6936.ino | 4 ++- Multiprotocol/Devo_cyrf6936.ino | 4 ++- Multiprotocol/E01X_nrf24l01.ino | 4 ++- Multiprotocol/ESky150_nrf24l01.ino | 4 ++- Multiprotocol/ESky_nrf24l01.ino | 4 ++- Multiprotocol/FQ777_nrf24l01.ino | 4 ++- Multiprotocol/FY326_nrf24l01.ino | 4 ++- Multiprotocol/FlySky_a7105.ino | 4 ++- Multiprotocol/Flyzone_a7105.ino | 4 ++- Multiprotocol/FrSkyD_cc2500.ino | 4 ++- Multiprotocol/FrSkyV_cc2500.ino | 4 ++- Multiprotocol/FrSkyX_cc2500.ino | 4 ++- Multiprotocol/GD00X_nrf24l01.ino | 4 ++- Multiprotocol/GW008_nrf24l01.ino | 4 ++- Multiprotocol/H8_3D_nrf24l01.ino | 4 ++- Multiprotocol/HOTT_cc2500.ino | 4 ++- Multiprotocol/Hisky_nrf24l01.ino | 8 +++-- Multiprotocol/Hitec_cc2500.ino | 4 ++- Multiprotocol/Hontai_nrf24l01.ino | 4 ++- Multiprotocol/Hubsan_a7105.ino | 2 ++ Multiprotocol/J6Pro_cyrf6936.ino | 4 ++- Multiprotocol/KF606_nrf24l01.ino | 4 ++- Multiprotocol/KN_nrf24l01.ino | 4 ++- Multiprotocol/MJXQ_nrf24l01.ino | 4 ++- Multiprotocol/MT99xx_nrf24l01.ino | 4 ++- Multiprotocol/Multiprotocol.h | 2 +- Multiprotocol/Multiprotocol.ino | 32 +++++++++--------- Multiprotocol/NCC1701_nrf24l01.ino | 4 ++- Multiprotocol/POTENSIC_nrf24l01.ino | 4 ++- Multiprotocol/Q303_nrf24l01.ino | 4 ++- Multiprotocol/Redpine_cc2500.ino | 4 ++- Multiprotocol/SFHSS_cc2500.ino | 4 ++- Multiprotocol/SHENQI_nrf24l01.ino | 6 ++-- Multiprotocol/SLT_nrf24l01.ino | 4 ++- Multiprotocol/Symax_nrf24l01.ino | 4 ++- Multiprotocol/TRAXXAS_cyrf6936.ino | 4 ++- Multiprotocol/Telemetry.ino | 51 +++++++++++++---------------- Multiprotocol/V2X2_nrf24l01.ino | 4 ++- Multiprotocol/V761_nrf24l01.ino | 4 ++- Multiprotocol/V911S_nrf24l01.ino | 4 ++- Multiprotocol/Validate.h | 10 ++++-- Multiprotocol/WFLY_cyrf6936.ino | 4 ++- Multiprotocol/WK2x01_cyrf6936.ino | 4 ++- Multiprotocol/YD717_nrf24l01.ino | 4 ++- Multiprotocol/ZSX_nrf24l01.ino | 4 ++- 56 files changed, 204 insertions(+), 103 deletions(-) diff --git a/Multiprotocol/AFHDS2A_a7105.ino b/Multiprotocol/AFHDS2A_a7105.ino index 066de4655..e0e224a46 100644 --- a/Multiprotocol/AFHDS2A_a7105.ino +++ b/Multiprotocol/AFHDS2A_a7105.ino @@ -321,7 +321,9 @@ uint16_t ReadAFHDS2A() packet_type = AFHDS2A_PACKET_STICKS; phase = AFHDS2A_DATA; case AFHDS2A_DATA: - telemetry_set_input_sync(3850); + #ifdef MULTI_SYNC + telemetry_set_input_sync(3850); + #endif AFHDS2A_build_packet(packet_type); if((A7105_ReadReg(A7105_00_MODE) & 0x01)) // Check if something has been received... data_rx=0; diff --git a/Multiprotocol/ASSAN_nrf24l01.ino b/Multiprotocol/ASSAN_nrf24l01.ino index ce1648de4..cd02334ff 100644 --- a/Multiprotocol/ASSAN_nrf24l01.ino +++ b/Multiprotocol/ASSAN_nrf24l01.ino @@ -127,7 +127,9 @@ uint16_t ASSAN_callback() phase=ASSAN_DATA2; return 2000; case ASSAN_DATA2: - telemetry_set_input_sync(12000); + #ifdef MULTI_SYNC + telemetry_set_input_sync(12000); + #endif case ASSAN_DATA3: ASSAN_send_packet(); phase++; // DATA 3 or 4 diff --git a/Multiprotocol/BUGSMINI_nrf24l01.ino b/Multiprotocol/BUGSMINI_nrf24l01.ino index 8672a4e9f..a8ba47acc 100644 --- a/Multiprotocol/BUGSMINI_nrf24l01.ino +++ b/Multiprotocol/BUGSMINI_nrf24l01.ino @@ -299,7 +299,9 @@ uint16_t BUGSMINI_callback() phase = BUGSMINI_BIND1; return BUGSMINI_PACKET_INTERVAL - BUGSMINI_WRITE_WAIT; case BUGSMINI_DATA1: - telemetry_set_input_sync(BUGSMINI_PACKET_INTERVAL); + #ifdef MULTI_SYNC + telemetry_set_input_sync(BUGSMINI_PACKET_INTERVAL); + #endif if( NRF24L01_ReadReg(NRF24L01_07_STATUS) & _BV(NRF24L01_07_RX_DR)) { // RX fifo data ready => read only 12 bytes to not overwrite channel change flag XN297_ReadPayload(packet, 12); diff --git a/Multiprotocol/Bayang_nrf24l01.ino b/Multiprotocol/Bayang_nrf24l01.ino index 4d57e1b2b..244bf3d16 100644 --- a/Multiprotocol/Bayang_nrf24l01.ino +++ b/Multiprotocol/Bayang_nrf24l01.ino @@ -284,7 +284,9 @@ uint16_t BAYANG_callback() { if(packet_count==0) { - telemetry_set_input_sync((option & BAYANG_OPTION_FLAG_TELEMETRY)?5*BAYANG_PACKET_PERIOD:2*BAYANG_PACKET_PERIOD); + #ifdef MULTI_SYNC + telemetry_set_input_sync((option & BAYANG_OPTION_FLAG_TELEMETRY)?5*BAYANG_PACKET_PERIOD:2*BAYANG_PACKET_PERIOD); + #endif BAYANG_send_packet(0); } packet_count++; diff --git a/Multiprotocol/Bugs_a7105.ino b/Multiprotocol/Bugs_a7105.ino index 00f667ba5..6c4c7711a 100644 --- a/Multiprotocol/Bugs_a7105.ino +++ b/Multiprotocol/Bugs_a7105.ino @@ -385,7 +385,9 @@ uint16_t ReadBUGS(void) break; case BUGS_DATA_1: - telemetry_set_input_sync(BUGS_PACKET_PERIOD); + #ifdef MULTI_SYNC + telemetry_set_input_sync(BUGS_PACKET_PERIOD); + #endif A7105_SetPower(); BUGS_build_packet(0); A7105_WriteReg(A7105_03_FIFOI, BUGS_FIFO_SIZE_TX); diff --git a/Multiprotocol/CABELL_nrf224l01.ino b/Multiprotocol/CABELL_nrf224l01.ino index 1b7e4bfad..3f9c927ac 100644 --- a/Multiprotocol/CABELL_nrf224l01.ino +++ b/Multiprotocol/CABELL_nrf224l01.ino @@ -406,7 +406,9 @@ uint16_t CABELL_callback() if (IS_BIND_DONE) { CABELL_send_packet(0); // packet_period is set/adjusted in CABELL_send_packet - telemetry_set_input_sync(packet_period); + #ifdef MULTI_SYNC + telemetry_set_input_sync(packet_period); + #endif return packet_period; } else if (bind_counter == 0) diff --git a/Multiprotocol/CFlie_nrf24l01.ino b/Multiprotocol/CFlie_nrf24l01.ino index 9efa1cbf7..4978be84c 100644 --- a/Multiprotocol/CFlie_nrf24l01.ino +++ b/Multiprotocol/CFlie_nrf24l01.ino @@ -781,7 +781,9 @@ static uint16_t cflie_callback() break; case CFLIE_DATA: - telemetry_set_input_sync(CFLIE_PACKET_PERIOD); + #ifdef MULTI_SYNC + telemetry_set_input_sync(CFLIE_PACKET_PERIOD); + #endif // if (Model.proto_opts[PROTOOPTS_TELEMETRY] == TELEM_ON_CRTPLOG) { // update_telemetry_crtplog(); // } else if (Model.proto_opts[PROTOOPTS_TELEMETRY] == TELEM_ON_ACKPKT) { diff --git a/Multiprotocol/CG023_nrf24l01.ino b/Multiprotocol/CG023_nrf24l01.ino index beb667c57..7d6b260a1 100644 --- a/Multiprotocol/CG023_nrf24l01.ino +++ b/Multiprotocol/CG023_nrf24l01.ino @@ -139,7 +139,9 @@ uint16_t CG023_callback() { if(IS_BIND_DONE) { - telemetry_set_input_sync(packet_period); + #ifdef MULTI_SYNC + telemetry_set_input_sync(packet_period); + #endif CG023_send_packet(0); } else diff --git a/Multiprotocol/CX10_nrf24l01.ino b/Multiprotocol/CX10_nrf24l01.ino index 96a7cc29a..b6c57185f 100644 --- a/Multiprotocol/CX10_nrf24l01.ino +++ b/Multiprotocol/CX10_nrf24l01.ino @@ -229,7 +229,9 @@ uint16_t CX10_callback() } break; case CX10_DATA: - telemetry_set_input_sync(packet_period); + #ifdef MULTI_SYNC + telemetry_set_input_sync(packet_period); + #endif CX10_Write_Packet(0); break; } diff --git a/Multiprotocol/Corona_cc2500.ino b/Multiprotocol/Corona_cc2500.ino index aba044607..9bbcc3adc 100644 --- a/Multiprotocol/Corona_cc2500.ino +++ b/Multiprotocol/Corona_cc2500.ino @@ -258,7 +258,9 @@ static uint16_t __attribute__((unused)) CORONA_build_packet() uint16_t ReadCORONA() { - telemetry_set_input_sync(22000); + #ifdef MULTI_SYNC + telemetry_set_input_sync(22000); + #endif // Tune frequency if it has been changed if ( prev_option != option ) { diff --git a/Multiprotocol/DM002_nrf24l01.ino b/Multiprotocol/DM002_nrf24l01.ino index f31939793..a565640c7 100644 --- a/Multiprotocol/DM002_nrf24l01.ino +++ b/Multiprotocol/DM002_nrf24l01.ino @@ -114,7 +114,9 @@ uint16_t DM002_callback() { if(IS_BIND_DONE) { - telemetry_set_input_sync(DM002_PACKET_PERIOD); + #ifdef MULTI_SYNC + telemetry_set_input_sync(DM002_PACKET_PERIOD); + #endif DM002_send_packet(0); } else diff --git a/Multiprotocol/DSM_cyrf6936.ino b/Multiprotocol/DSM_cyrf6936.ino index 0fb52b9f8..36da8289c 100644 --- a/Multiprotocol/DSM_cyrf6936.ino +++ b/Multiprotocol/DSM_cyrf6936.ino @@ -455,7 +455,9 @@ uint16_t ReadDsm() DSM_set_sop_data_crc(); return 10000; case DSM_CH1_WRITE_A: - telemetry_set_input_sync(11000); // Always request 11ms spacing even if we don't use half of it in 22ms mode + #ifdef MULTI_SYNC + telemetry_set_input_sync(11000); // Always request 11ms spacing even if we don't use half of it in 22ms mode + #endif case DSM_CH1_WRITE_B: case DSM_CH2_WRITE_A: case DSM_CH2_WRITE_B: diff --git a/Multiprotocol/Devo_cyrf6936.ino b/Multiprotocol/Devo_cyrf6936.ino index 60ec4cf08..de0a38428 100644 --- a/Multiprotocol/Devo_cyrf6936.ino +++ b/Multiprotocol/Devo_cyrf6936.ino @@ -272,7 +272,9 @@ uint16_t devo_callback() static uint8_t txState=0; if (txState == 0) { - telemetry_set_input_sync(2400); + #ifdef MULTI_SYNC + telemetry_set_input_sync(2400); + #endif txState = 1; DEVO_BuildPacket(); CYRF_WriteDataPacket(packet); diff --git a/Multiprotocol/E01X_nrf24l01.ino b/Multiprotocol/E01X_nrf24l01.ino index 7a37daf0e..91fbf7223 100644 --- a/Multiprotocol/E01X_nrf24l01.ino +++ b/Multiprotocol/E01X_nrf24l01.ino @@ -288,7 +288,9 @@ uint16_t E01X_callback() } else { - telemetry_set_input_sync(packet_period); + #ifdef MULTI_SYNC + telemetry_set_input_sync(packet_period); + #endif E01X_send_packet(0); } return packet_period; diff --git a/Multiprotocol/ESky150_nrf24l01.ino b/Multiprotocol/ESky150_nrf24l01.ino index fe4da38c4..b00fee0c4 100644 --- a/Multiprotocol/ESky150_nrf24l01.ino +++ b/Multiprotocol/ESky150_nrf24l01.ino @@ -152,7 +152,9 @@ uint16_t ESKY150_callback() { if(IS_BIND_DONE) { - telemetry_set_input_sync(ESKY150_SENDING_PACKET_PERIOD); + #ifdef MULTI_SYNC + telemetry_set_input_sync(ESKY150_SENDING_PACKET_PERIOD); + #endif ESKY150_send_packet(); } else diff --git a/Multiprotocol/ESky_nrf24l01.ino b/Multiprotocol/ESky_nrf24l01.ino index 672ad96aa..fdf761396 100644 --- a/Multiprotocol/ESky_nrf24l01.ino +++ b/Multiprotocol/ESky_nrf24l01.ino @@ -136,7 +136,9 @@ uint16_t ESKY_callback() { if(IS_BIND_DONE) { - telemetry_set_input_sync(ESKY_PACKET_PERIOD); + #ifdef MULTI_SYNC + telemetry_set_input_sync(ESKY_PACKET_PERIOD); + #endif ESKY_send_packet(0); } else diff --git a/Multiprotocol/FQ777_nrf24l01.ino b/Multiprotocol/FQ777_nrf24l01.ino index 86a5dfe65..8bc75260d 100644 --- a/Multiprotocol/FQ777_nrf24l01.ino +++ b/Multiprotocol/FQ777_nrf24l01.ino @@ -189,7 +189,9 @@ uint16_t FQ777_callback() } else { - telemetry_set_input_sync(FQ777_PACKET_PERIOD); + #ifdef MULTI_SYNC + telemetry_set_input_sync(FQ777_PACKET_PERIOD); + #endif FQ777_send_packet(0); } return FQ777_PACKET_PERIOD; diff --git a/Multiprotocol/FY326_nrf24l01.ino b/Multiprotocol/FY326_nrf24l01.ino index eb98853df..3e7723f7d 100644 --- a/Multiprotocol/FY326_nrf24l01.ino +++ b/Multiprotocol/FY326_nrf24l01.ino @@ -188,7 +188,9 @@ uint16_t FY326_callback() return FY326_PACKET_CHKTIME; break; case FY326_DATA: - telemetry_set_input_sync(FY326_PACKET_PERIOD); + #ifdef MULTI_SYNC + telemetry_set_input_sync(FY326_PACKET_PERIOD); + #endif FY326_send_packet(0); break; } diff --git a/Multiprotocol/FlySky_a7105.ino b/Multiprotocol/FlySky_a7105.ino index 657734abf..799f499d0 100644 --- a/Multiprotocol/FlySky_a7105.ino +++ b/Multiprotocol/FlySky_a7105.ino @@ -168,7 +168,9 @@ uint16_t ReadFlySky() } else { - telemetry_set_input_sync(packet_period); + #ifdef MULTI_SYNC + telemetry_set_input_sync(packet_period); + #endif flysky_build_packet(0); A7105_WriteData(21, hopping_frequency[hopping_frequency_no & 0x0F]); A7105_SetPower(); diff --git a/Multiprotocol/Flyzone_a7105.ino b/Multiprotocol/Flyzone_a7105.ino index 063d41b3b..d54f79568 100644 --- a/Multiprotocol/Flyzone_a7105.ino +++ b/Multiprotocol/Flyzone_a7105.ino @@ -55,7 +55,9 @@ uint16_t ReadFlyzone() if(phase>19) { phase=0; - telemetry_set_input_sync(20*1500); + #ifdef MULTI_SYNC + telemetry_set_input_sync(20*1500); + #endif flyzone_build_packet(); A7105_WriteData(8, hopping_frequency[0]); A7105_SetPower(); diff --git a/Multiprotocol/FrSkyD_cc2500.ino b/Multiprotocol/FrSkyD_cc2500.ino index ceb415f4a..49a5aade7 100644 --- a/Multiprotocol/FrSkyD_cc2500.ino +++ b/Multiprotocol/FrSkyD_cc2500.ino @@ -153,7 +153,9 @@ uint16_t ReadFrSky_2way() { if (state == FRSKY_DATA1) { - telemetry_set_input_sync(9000); + #ifdef MULTI_SYNC + telemetry_set_input_sync(9000); + #endif len = CC2500_ReadReg(CC2500_3B_RXBYTES | CC2500_READ_BURST) & 0x7F; if (len && len<=(0x11+3))// 20bytes { diff --git a/Multiprotocol/FrSkyV_cc2500.ino b/Multiprotocol/FrSkyV_cc2500.ino index 2d1903069..8b0afcb64 100644 --- a/Multiprotocol/FrSkyV_cc2500.ino +++ b/Multiprotocol/FrSkyV_cc2500.ino @@ -117,7 +117,9 @@ uint16_t ReadFRSKYV() { if(IS_BIND_DONE) { // Normal operation - telemetry_set_input_sync(9006); + #ifdef MULTI_SYNC + telemetry_set_input_sync(9006); + #endif uint8_t chan = FRSKYV_calc_channel(); CC2500_Strobe(CC2500_SIDLE); if (option != prev_option) diff --git a/Multiprotocol/FrSkyX_cc2500.ino b/Multiprotocol/FrSkyX_cc2500.ino index 754b29d83..4a1be4425 100644 --- a/Multiprotocol/FrSkyX_cc2500.ino +++ b/Multiprotocol/FrSkyX_cc2500.ino @@ -304,7 +304,9 @@ uint16_t ReadFrSkyX() state++; //FRSKY_DATA1 break; case FRSKY_DATA5: - telemetry_set_input_sync(9000); + #ifdef MULTI_SYNC + telemetry_set_input_sync(9000); + #endif #if defined TELEMETRY telemetry_link=1; //Send telemetry out anyway #endif diff --git a/Multiprotocol/GD00X_nrf24l01.ino b/Multiprotocol/GD00X_nrf24l01.ino index ca1a64d9f..d4f7f7bc2 100644 --- a/Multiprotocol/GD00X_nrf24l01.ino +++ b/Multiprotocol/GD00X_nrf24l01.ino @@ -208,7 +208,9 @@ uint16_t GD00X_callback() if(--bind_counter==0) BIND_DONE; GD00X_send_packet(); - telemetry_set_input_sync(packet_period); + #ifdef MULTI_SYNC + telemetry_set_input_sync(packet_period); + #endif return packet_period; } diff --git a/Multiprotocol/GW008_nrf24l01.ino b/Multiprotocol/GW008_nrf24l01.ino index 84669eb39..c0a0339f1 100644 --- a/Multiprotocol/GW008_nrf24l01.ino +++ b/Multiprotocol/GW008_nrf24l01.ino @@ -139,7 +139,9 @@ uint16_t GW008_callback() return 5000; break; case GW008_DATA: - telemetry_set_input_sync(GW008_PACKET_PERIOD); + #ifdef MULTI_SYNC + telemetry_set_input_sync(GW008_PACKET_PERIOD); + #endif GW008_send_packet(0); break; } diff --git a/Multiprotocol/H8_3D_nrf24l01.ino b/Multiprotocol/H8_3D_nrf24l01.ino index 14f9fe546..9eef089fa 100644 --- a/Multiprotocol/H8_3D_nrf24l01.ino +++ b/Multiprotocol/H8_3D_nrf24l01.ino @@ -178,7 +178,9 @@ uint16_t H8_3D_callback() { if(IS_BIND_DONE) { - telemetry_set_input_sync(packet_period); + #ifdef MULTI_SYNC + telemetry_set_input_sync(packet_period); + #endif H8_3D_send_packet(0); } else diff --git a/Multiprotocol/HOTT_cc2500.ino b/Multiprotocol/HOTT_cc2500.ino index 0d7498fad..c7cc5bac9 100644 --- a/Multiprotocol/HOTT_cc2500.ino +++ b/Multiprotocol/HOTT_cc2500.ino @@ -275,7 +275,9 @@ uint16_t ReadHOTT() /* Work cycle: 10ms */ case HOTT_DATA1: //TX - telemetry_set_input_sync(HOTT_PACKET_PERIOD); + #ifdef MULTI_SYNC + telemetry_set_input_sync(HOTT_PACKET_PERIOD); + #endif HOTT_tune_freq(); HOTT_tune_chan_fast(); HOTT_data_packet(); diff --git a/Multiprotocol/Hisky_nrf24l01.ino b/Multiprotocol/Hisky_nrf24l01.ino index 504842be6..6cb501579 100644 --- a/Multiprotocol/Hisky_nrf24l01.ino +++ b/Multiprotocol/Hisky_nrf24l01.ino @@ -151,7 +151,9 @@ uint16_t hisky_cb() phase=6; break; case 7: // build packet - telemetry_set_input_sync(5000); + #ifdef MULTI_SYNC + telemetry_set_input_sync(5000); + #endif #ifdef FAILSAFE_ENABLE if(IS_FAILSAFE_VALUES_on && hopping_frequency_no==0) { // send failsafe every 100ms @@ -218,7 +220,9 @@ uint16_t hisky_cb() break; case 7: //Build normal packet - telemetry_set_input_sync(9000); + #ifdef MULTI_SYNC + telemetry_set_input_sync(9000); + #endif build_ch_data(); break; case 8: diff --git a/Multiprotocol/Hitec_cc2500.ino b/Multiprotocol/Hitec_cc2500.ino index f28f5f6fc..f3800744d 100644 --- a/Multiprotocol/Hitec_cc2500.ino +++ b/Multiprotocol/Hitec_cc2500.ino @@ -259,7 +259,9 @@ uint16_t ReadHITEC() case HITEC_PREP: if ( prev_option == option ) { // No user frequency change - telemetry_set_input_sync(HITEC_PACKET_PERIOD); + #ifdef MULTI_SYNC + telemetry_set_input_sync(HITEC_PACKET_PERIOD); + #endif HITEC_change_chan_fast(); hopping_frequency_no++; if(hopping_frequency_no>=rf_ch_num) diff --git a/Multiprotocol/Hontai_nrf24l01.ino b/Multiprotocol/Hontai_nrf24l01.ino index d7ab69383..b58579571 100644 --- a/Multiprotocol/Hontai_nrf24l01.ino +++ b/Multiprotocol/Hontai_nrf24l01.ino @@ -243,7 +243,9 @@ uint16_t HONTAI_callback() } else { - telemetry_set_input_sync(packet_period); + #ifdef MULTI_SYNC + telemetry_set_input_sync(packet_period); + #endif HONTAI_send_packet(0); } diff --git a/Multiprotocol/Hubsan_a7105.ino b/Multiprotocol/Hubsan_a7105.ino index 014871f10..e0f8b290c 100644 --- a/Multiprotocol/Hubsan_a7105.ino +++ b/Multiprotocol/Hubsan_a7105.ino @@ -376,7 +376,9 @@ uint16_t ReadHubsan() case DATA_4: case DATA_5: if( txState == 0) { // send packet + #ifdef MULTI_SYNC telemetry_set_input_sync(10000); + #endif #ifdef HUBSAN_HUB_TELEMETRY rfMode = A7105_TX; #endif diff --git a/Multiprotocol/J6Pro_cyrf6936.ino b/Multiprotocol/J6Pro_cyrf6936.ino index d6871f5ed..f8e5e5c95 100644 --- a/Multiprotocol/J6Pro_cyrf6936.ino +++ b/Multiprotocol/J6Pro_cyrf6936.ino @@ -201,7 +201,9 @@ uint16_t ReadJ6Pro() cyrf_datainit(); phase = J6PRO_CHAN_1; case J6PRO_CHAN_1: - telemetry_set_input_sync(24550); + #ifdef MULTI_SYNC + telemetry_set_input_sync(24550); + #endif //Keep transmit power updated CYRF_SetPower(0x28); j6pro_build_data_packet(); diff --git a/Multiprotocol/KF606_nrf24l01.ino b/Multiprotocol/KF606_nrf24l01.ino index 9f8a7e196..e50d6a430 100644 --- a/Multiprotocol/KF606_nrf24l01.ino +++ b/Multiprotocol/KF606_nrf24l01.ino @@ -86,7 +86,9 @@ static void __attribute__((unused)) KF606_init() uint16_t KF606_callback() { - telemetry_set_input_sync(KF606_PACKET_PERIOD); + #ifdef MULTI_SYNC + telemetry_set_input_sync(KF606_PACKET_PERIOD); + #endif if(IS_BIND_IN_PROGRESS) if(--bind_counter==0) { diff --git a/Multiprotocol/KN_nrf24l01.ino b/Multiprotocol/KN_nrf24l01.ino index 64cdbc5e6..0a60173b4 100644 --- a/Multiprotocol/KN_nrf24l01.ino +++ b/Multiprotocol/KN_nrf24l01.ino @@ -320,7 +320,9 @@ uint16_t kn_callback() case KN_PHASE_SENDING: if(packet_sent >= packet_count) { - telemetry_set_input_sync(seed); + #ifdef MULTI_SYNC + telemetry_set_input_sync(seed); + #endif packet_sent = 0; hopping_frequency_no++; if(hopping_frequency_no >= KN_RF_CH_COUNT) hopping_frequency_no = 0; diff --git a/Multiprotocol/MJXQ_nrf24l01.ino b/Multiprotocol/MJXQ_nrf24l01.ino index 9140f6de2..3db83c05e 100644 --- a/Multiprotocol/MJXQ_nrf24l01.ino +++ b/Multiprotocol/MJXQ_nrf24l01.ino @@ -328,7 +328,9 @@ uint16_t MJXQ_callback() { if(IS_BIND_DONE) { - telemetry_set_input_sync(MJXQ_PACKET_PERIOD); + #ifdef MULTI_SYNC + telemetry_set_input_sync(MJXQ_PACKET_PERIOD); + #endif MJXQ_send_packet(0); } else diff --git a/Multiprotocol/MT99xx_nrf24l01.ino b/Multiprotocol/MT99xx_nrf24l01.ino index cb38aa81a..80a93e4f5 100644 --- a/Multiprotocol/MT99xx_nrf24l01.ino +++ b/Multiprotocol/MT99xx_nrf24l01.ino @@ -223,7 +223,9 @@ uint16_t MT99XX_callback() { if(IS_BIND_DONE) { - telemetry_set_input_sync(packet_period); + #ifdef MULTI_SYNC + telemetry_set_input_sync(packet_period); + #endif MT99XX_send_packet(); } else diff --git a/Multiprotocol/Multiprotocol.h b/Multiprotocol/Multiprotocol.h index 15a11528c..bbbea78e3 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 43 +#define VERSION_PATCH_LEVEL 44 //****************** // Protocols diff --git a/Multiprotocol/Multiprotocol.ino b/Multiprotocol/Multiprotocol.ino index 789292bc0..2dce2f928 100644 --- a/Multiprotocol/Multiprotocol.ino +++ b/Multiprotocol/Multiprotocol.ino @@ -55,10 +55,12 @@ #include #include HardwareTimer HWTimer2(2); - HardwareTimer HWTimer3(3); + #ifdef ENABLE_SERIAL + HardwareTimer HWTimer3(3); + void ISR_COMPB(); + #endif void PPM_decode(); - void ISR_COMPB(); extern "C" { void __irq_usart2(void); @@ -1876,29 +1878,25 @@ void modules_reset() void init_HWTimer() { HWTimer2.pause(); // Pause the timer2 while we're configuring it - TIMER2_BASE->PSC = 35; // 36-1;for 72 MHZ /0.5sec/(35+1) TIMER2_BASE->ARR = 0xFFFF; // Count until 0xFFFF - HWTimer2.setMode(TIMER_CH1, TIMER_OUTPUT_COMPARE); // Main scheduler - //HWTimer2.setMode(TIMER_CH2, TIMER_OUTPUT_COMPARE); // Serial check - TIMER2_BASE->SR = 0x1E5F & ~TIMER_SR_CC2IF; // Clear Timer2/Comp2 interrupt flag - //HWTimer2.attachInterrupt(TIMER_CH2,ISR_COMPB); // Assign function to Timer2/Comp2 interrupt TIMER2_BASE->DIER &= ~TIMER_DIER_CC2IE; // Disable Timer2/Comp2 interrupt - HWTimer2.refresh(); // Refresh the timer's count, prescale, and overflow HWTimer2.resume(); - HWTimer3.pause(); // Pause the timer3 while we're configuring it - TIMER3_BASE->PSC = 35; // 36-1;for 72 MHZ /0.5sec/(35+1) - TIMER3_BASE->ARR = 0xFFFF; // Count until 0xFFFF - HWTimer3.setMode(TIMER_CH2, TIMER_OUTPUT_COMPARE); // Serial check - TIMER3_BASE->SR = 0x1E5F & ~TIMER_SR_CC2IF; // Clear Timer3/Comp2 interrupt flag - HWTimer3.attachInterrupt(TIMER_CH2,ISR_COMPB); // Assign function to Timer3/Comp2 interrupt - TIMER3_BASE->DIER &= ~TIMER_DIER_CC2IE; // Disable Timer3/Comp2 interrupt - HWTimer3.refresh(); // Refresh the timer's count, prescale, and overflow - HWTimer3.resume(); + #ifdef ENABLE_SERIAL + HWTimer3.pause(); // Pause the timer3 while we're configuring it + TIMER3_BASE->PSC = 35; // 36-1;for 72 MHZ /0.5sec/(35+1) + TIMER3_BASE->ARR = 0xFFFF; // Count until 0xFFFF + HWTimer3.setMode(TIMER_CH2, TIMER_OUTPUT_COMPARE); // Serial check + TIMER3_BASE->SR = 0x1E5F & ~TIMER_SR_CC2IF; // Clear Timer3/Comp2 interrupt flag + HWTimer3.attachInterrupt(TIMER_CH2,ISR_COMPB); // Assign function to Timer3/Comp2 interrupt + TIMER3_BASE->DIER &= ~TIMER_DIER_CC2IE; // Disable Timer3/Comp2 interrupt + HWTimer3.refresh(); // Refresh the timer's count, prescale, and overflow + HWTimer3.resume(); + #endif } #endif diff --git a/Multiprotocol/NCC1701_nrf24l01.ino b/Multiprotocol/NCC1701_nrf24l01.ino index dff58ab42..a9feabfa6 100644 --- a/Multiprotocol/NCC1701_nrf24l01.ino +++ b/Multiprotocol/NCC1701_nrf24l01.ino @@ -197,7 +197,9 @@ uint16_t NCC_callback() phase = NCC_BIND_TX2; return NCC_PACKET_INTERVAL - NCC_WRITE_WAIT; case NCC_TX3: - telemetry_set_input_sync(NCC_PACKET_INTERVAL); + #ifdef MULTI_SYNC + telemetry_set_input_sync(NCC_PACKET_INTERVAL); + #endif if( NRF24L01_ReadReg(NRF24L01_07_STATUS) & _BV(NRF24L01_07_RX_DR)) { // RX fifo data ready NRF24L01_ReadPayload(packet, NCC_RX_PACKET_LEN); diff --git a/Multiprotocol/POTENSIC_nrf24l01.ino b/Multiprotocol/POTENSIC_nrf24l01.ino index 06577abc6..5e4b6ac1a 100644 --- a/Multiprotocol/POTENSIC_nrf24l01.ino +++ b/Multiprotocol/POTENSIC_nrf24l01.ino @@ -109,7 +109,9 @@ uint16_t POTENSIC_callback() BIND_DONE; XN297_SetTXAddr(rx_tx_addr,5); } - telemetry_set_input_sync(POTENSIC_PACKET_PERIOD); + #ifdef MULTI_SYNC + telemetry_set_input_sync(POTENSIC_PACKET_PERIOD); + #endif POTENSIC_send_packet(); return POTENSIC_PACKET_PERIOD; } diff --git a/Multiprotocol/Q303_nrf24l01.ino b/Multiprotocol/Q303_nrf24l01.ino index 93ed15aaa..396e9107c 100644 --- a/Multiprotocol/Q303_nrf24l01.ino +++ b/Multiprotocol/Q303_nrf24l01.ino @@ -355,7 +355,9 @@ uint16_t Q303_callback() { if(IS_BIND_DONE) { - telemetry_set_input_sync(packet_period); + #ifdef MULTI_SYNC + telemetry_set_input_sync(packet_period); + #endif Q303_send_packet(0); } else diff --git a/Multiprotocol/Redpine_cc2500.ino b/Multiprotocol/Redpine_cc2500.ino index 463c31423..6ae5ea7f4 100644 --- a/Multiprotocol/Redpine_cc2500.ino +++ b/Multiprotocol/Redpine_cc2500.ino @@ -125,7 +125,9 @@ static uint16_t ReadREDPINE() } else { - telemetry_set_input_sync(packet_period); + #ifdef MULTI_SYNC + telemetry_set_input_sync(packet_period); + #endif CC2500_SetTxRxMode(TX_EN); REDPINE_set_channel(hopping_frequency_no); CC2500_SetPower(); diff --git a/Multiprotocol/SFHSS_cc2500.ino b/Multiprotocol/SFHSS_cc2500.ino index 95d7066f2..0e0dff518 100644 --- a/Multiprotocol/SFHSS_cc2500.ino +++ b/Multiprotocol/SFHSS_cc2500.ino @@ -235,7 +235,9 @@ uint16_t ReadSFHSS() #define SFHSS_PACKET_PERIOD 6800 #define SFHSS_DATA2_TIMING 1625 // Adjust this value between 1600 and 1650 if your RX(s) are not operating properly case SFHSS_DATA1: - telemetry_set_input_sync(6800); + #ifdef MULTI_SYNC + telemetry_set_input_sync(6800); + #endif SFHSS_build_data_packet(); SFHSS_send_packet(); phase = SFHSS_DATA2; diff --git a/Multiprotocol/SHENQI_nrf24l01.ino b/Multiprotocol/SHENQI_nrf24l01.ino index 745ce9b55..dcbc6c83c 100644 --- a/Multiprotocol/SHENQI_nrf24l01.ino +++ b/Multiprotocol/SHENQI_nrf24l01.ino @@ -63,8 +63,10 @@ void SHENQI_send_packet() } else { - if(packet_count==1) - telemetry_set_input_sync(3000+2508+6*1750); + #ifdef MULTI_SYNC + if(packet_count==1) + telemetry_set_input_sync(3000+2508+6*1750); + #endif LT8900_SetAddress(rx_tx_addr,4); packet[1]=255-convert_channel_8b(RUDDER); packet[2]=255-convert_channel_16b_limit(THROTTLE,0x60,0xA0); diff --git a/Multiprotocol/SLT_nrf24l01.ino b/Multiprotocol/SLT_nrf24l01.ino index 693014a91..924aaaa8b 100644 --- a/Multiprotocol/SLT_nrf24l01.ino +++ b/Multiprotocol/SLT_nrf24l01.ino @@ -213,7 +213,9 @@ uint16_t SLT_callback() switch (phase) { case SLT_BUILD: - telemetry_set_input_sync(sub_protocol==SLT_V1?20000:13730); + #ifdef MULTI_SYNC + telemetry_set_input_sync(sub_protocol==SLT_V1?20000:13730); + #endif SLT_build_packet(); phase++; return SLT_TIMING_BUILD; diff --git a/Multiprotocol/Symax_nrf24l01.ino b/Multiprotocol/Symax_nrf24l01.ino index 029e388bd..4bbf645a2 100644 --- a/Multiprotocol/Symax_nrf24l01.ino +++ b/Multiprotocol/Symax_nrf24l01.ino @@ -359,7 +359,9 @@ uint16_t symax_callback() } break; case SYMAX_DATA: - telemetry_set_input_sync(SYMAX_PACKET_PERIOD); + #ifdef MULTI_SYNC + telemetry_set_input_sync(SYMAX_PACKET_PERIOD); + #endif SYMAX_send_packet(0); break; } diff --git a/Multiprotocol/TRAXXAS_cyrf6936.ino b/Multiprotocol/TRAXXAS_cyrf6936.ino index 5ed502acc..c6474a1f5 100644 --- a/Multiprotocol/TRAXXAS_cyrf6936.ino +++ b/Multiprotocol/TRAXXAS_cyrf6936.ino @@ -162,7 +162,9 @@ uint16_t ReadTRAXXAS() TRAXXAS_cyrf_data_config(); phase++; case TRAXXAS_DATA: - telemetry_set_input_sync(13940); + #ifdef MULTI_SYNC + telemetry_set_input_sync(13940); + #endif TRAXXAS_send_data_packet(); break; } diff --git a/Multiprotocol/Telemetry.ino b/Multiprotocol/Telemetry.ino index edc651137..1eb60bdce 100644 --- a/Multiprotocol/Telemetry.ino +++ b/Multiprotocol/Telemetry.ino @@ -76,34 +76,32 @@ static void multi_send_header(uint8_t type, uint8_t len) Serial_write(len); } +#ifdef MULTI_SYNC static void telemetry_set_input_sync(uint16_t refreshRate) { - #ifdef MULTI_SYNC - #if defined(STM32_BOARD) && defined(DEBUG_PIN) - static uint8_t c=0; - if (c++%2==0) - { DEBUG_PIN_on; } - else - { DEBUG_PIN_off; } - #endif - // Only record input Delay after a frame has really been received - // Otherwise protocols with faster refresh rates then the TX sends (e.g. 3ms vs 6ms) will screw up the calcualtion - inputRefreshRate = refreshRate; - if (last_serial_input != 0) - { - cli(); // Disable global int due to RW of 16 bits registers - inputDelay = TCNT1; - sei(); // Enable global int - //inputDelay = (inputDelay - last_serial_input)>>1; - inputDelay -= last_serial_input; - //if(inputDelay & 0x8000) - // inputDelay = inputDelay - 0x8000; - last_serial_input=0; - } - #else - (void)refreshRate; + #if defined(STM32_BOARD) && defined(DEBUG_PIN) + static uint8_t c=0; + if (c++%2==0) + { DEBUG_PIN_on; } + else + { DEBUG_PIN_off; } #endif + // Only record input Delay after a frame has really been received + // Otherwise protocols with faster refresh rates then the TX sends (e.g. 3ms vs 6ms) will screw up the calcualtion + inputRefreshRate = refreshRate; + if (last_serial_input != 0) + { + cli(); // Disable global int due to RW of 16 bits registers + inputDelay = TCNT1; + sei(); // Enable global int + //inputDelay = (inputDelay - last_serial_input)>>1; + inputDelay -= last_serial_input; + //if(inputDelay & 0x8000) + // inputDelay = inputDelay - 0x8000; + last_serial_input=0; + } } +#endif #ifdef MULTI_SYNC static void mult_send_inputsync() @@ -1311,9 +1309,4 @@ ISR(TIMER0_OVF_vect) #endif // BASH_SERIAL -#else -void telemetry_set_input_sync(uint16_t refreshRate) -{ - (void)refreshRate; -} #endif // TELEMETRY diff --git a/Multiprotocol/V2X2_nrf24l01.ino b/Multiprotocol/V2X2_nrf24l01.ino index bce24bdb5..20774dab1 100644 --- a/Multiprotocol/V2X2_nrf24l01.ino +++ b/Multiprotocol/V2X2_nrf24l01.ino @@ -264,7 +264,9 @@ uint16_t ReadV2x2() case V202_DATA: if (packet_sent && NRF24L01_packet_ack() != PKT_ACKED) return V2X2_PACKET_CHKTIME; - telemetry_set_input_sync(V2X2_PACKET_PERIOD); + #ifdef MULTI_SYNC + telemetry_set_input_sync(V2X2_PACKET_PERIOD); + #endif V2X2_send_packet(0); break; } diff --git a/Multiprotocol/V761_nrf24l01.ino b/Multiprotocol/V761_nrf24l01.ino index 4a8e81d51..07bb675df 100644 --- a/Multiprotocol/V761_nrf24l01.ino +++ b/Multiprotocol/V761_nrf24l01.ino @@ -174,7 +174,9 @@ uint16_t V761_callback() } return 15730; case V761_DATA: - telemetry_set_input_sync(V761_PACKET_PERIOD); + #ifdef MULTI_SYNC + telemetry_set_input_sync(V761_PACKET_PERIOD); + #endif V761_send_packet(); break; } diff --git a/Multiprotocol/V911S_nrf24l01.ino b/Multiprotocol/V911S_nrf24l01.ino index 2747c9f2b..25c75dae4 100644 --- a/Multiprotocol/V911S_nrf24l01.ino +++ b/Multiprotocol/V911S_nrf24l01.ino @@ -112,7 +112,9 @@ uint16_t V911S_callback() { if(IS_BIND_DONE) { - telemetry_set_input_sync(V911S_PACKET_PERIOD); + #ifdef MULTI_SYNC + telemetry_set_input_sync(V911S_PACKET_PERIOD); + #endif V911S_send_packet(0); } else diff --git a/Multiprotocol/Validate.h b/Multiprotocol/Validate.h index ea6efe155..4dae8e203 100644 --- a/Multiprotocol/Validate.h +++ b/Multiprotocol/Validate.h @@ -323,6 +323,8 @@ #if not defined(HOTT_FW_TELEMETRY) && not defined(DSM_TELEMETRY) && not defined(SPORT_TELEMETRY) && not defined(HUB_TELEMETRY) && not defined(HUBSAN_HUB_TELEMETRY) && not defined(BUGS_HUB_TELEMETRY) && not defined(NCC1701_HUB_TELEMETRY) && not defined(BAYANG_HUB_TELEMETRY) && not defined(CABELL_HUB_TELEMETRY) && not defined(AFHDS2A_HUB_TELEMETRY) && not defined(AFHDS2A_FW_TELEMETRY) && not defined(MULTI_TELEMETRY) && not defined(MULTI_STATUS) && not defined(HITEC_HUB_TELEMETRY) && not defined(HITEC_FW_TELEMETRY) && not defined(SCANNER_TELEMETRY) && not defined(FRSKY_RX_TELEMETRY) && not defined(AFHDS2A_RX_TELEMETRY) #undef TELEMETRY #undef INVERT_TELEMETRY + #undef MULTI_TELEMETRY + #undef MULTI_STATUS #endif #endif @@ -330,10 +332,12 @@ #define SPORT_SEND #endif +#if not defined(STM32_BOARD) + #undef MULTI_SYNC +#endif + #if not defined(MULTI_TELEMETRY) - #if not defined(STM32_BOARD) - #undef MULTI_SYNC - #endif + #undef MULTI_SYNC #undef MULTI_NAMES #endif diff --git a/Multiprotocol/WFLY_cyrf6936.ino b/Multiprotocol/WFLY_cyrf6936.ino index 62fd66eec..da73c7503 100644 --- a/Multiprotocol/WFLY_cyrf6936.ino +++ b/Multiprotocol/WFLY_cyrf6936.ino @@ -232,7 +232,9 @@ uint16_t ReadWFLY() packet_count=0; phase++; case WFLY_DATA: - telemetry_set_input_sync(5371); + #ifdef MULTI_SYNC + telemetry_set_input_sync(5371); + #endif start=micros(); while ((uint8_t)((uint8_t)micros()-(uint8_t)start) < 200) if((CYRF_ReadRegister(CYRF_02_TX_CTRL) & 0x80) == 0x00) diff --git a/Multiprotocol/WK2x01_cyrf6936.ino b/Multiprotocol/WK2x01_cyrf6936.ino index 748ee8daf..8513464ae 100644 --- a/Multiprotocol/WK2x01_cyrf6936.ino +++ b/Multiprotocol/WK2x01_cyrf6936.ino @@ -435,7 +435,9 @@ uint16_t WK_cb() { if (packet_sent == 0) { - telemetry_set_input_sync(2800); + #ifdef MULTI_SYNC + telemetry_set_input_sync(2800); + #endif packet_sent = 1; if(sub_protocol == WK2801) WK_BuildPacket_2801(); diff --git a/Multiprotocol/YD717_nrf24l01.ino b/Multiprotocol/YD717_nrf24l01.ino index 1fcac9015..959da75f5 100644 --- a/Multiprotocol/YD717_nrf24l01.ino +++ b/Multiprotocol/YD717_nrf24l01.ino @@ -156,7 +156,9 @@ uint16_t yd717_callback() { if(IS_BIND_DONE) { - telemetry_set_input_sync(YD717_PACKET_PERIOD); + #ifdef MULTI_SYNC + telemetry_set_input_sync(YD717_PACKET_PERIOD); + #endif yd717_send_packet(0); } else diff --git a/Multiprotocol/ZSX_nrf24l01.ino b/Multiprotocol/ZSX_nrf24l01.ino index eedd6a19f..a2c974c28 100644 --- a/Multiprotocol/ZSX_nrf24l01.ino +++ b/Multiprotocol/ZSX_nrf24l01.ino @@ -80,7 +80,9 @@ static void __attribute__((unused)) ZSX_init() uint16_t ZSX_callback() { - telemetry_set_input_sync(ZSX_PACKET_PERIOD); + #ifdef MULTI_SYNC + telemetry_set_input_sync(ZSX_PACKET_PERIOD); + #endif if(IS_BIND_IN_PROGRESS) if(--bind_counter==0) {