From 2ffa3a36eab1f4dfef90627efdd7ddc1ff3ccf1a Mon Sep 17 00:00:00 2001 From: guido Date: Fri, 9 Oct 2020 15:13:27 +0200 Subject: [PATCH] Add simplified VOX. --- QCX-SSB.ino | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/QCX-SSB.ino b/QCX-SSB.ino index 87602d5..44ea10e 100644 --- a/QCX-SSB.ino +++ b/QCX-SSB.ino @@ -4086,9 +4086,25 @@ void loop() //for(;micros() < next;); next = micros() + 16; // sync every 1000000/62500=16ms (or later if missed) } // #endif //SIMPLE_RX - + + vox = 1; //int16_t x = 0; lcd.setCursor(15, 1); lcd.print('V'); + +#define SIMPLE_VOX 1 +#ifdef SIMPLE_VOX + uint16_t cnt = 0; // ensures that hilbert transform buffer is refreshed after a vox trigger before new trigger is given + for(; !digitalRead(BUTTONS);){ + ssb((analogSampleMic() - 512) >> MIC_ATTEN); cnt++; + if((tx) && (cnt > 32)){ + cnt = 0; + switch_rxtx(1); + for(; tx && !digitalRead(BUTTONS); ) wdt_reset(); // while in tx triggered by vox + switch_rxtx(0); + } + wdt_reset(); + } +#else // SIMPLE_VOX uint16_t cnt = 0; // ensures that hilbert transform buffer is refreshed after a vox trigger before new trigger is given //uint32_t next = 0; for(; !digitalRead(BUTTONS);){ // while in VOX mode @@ -4115,14 +4131,15 @@ void loop() if((_amp > vox_thresh) && (cnt > 32)){ // workaround for RX noise leakage to AREF cnt = 0; switch_rxtx(1); - vox = 1; tx = 255; //kick + tx = 255; //kick for(; tx && !digitalRead(BUTTONS); ) wdt_reset(); // while in tx triggered by vox switch_rxtx(0); - vox = 0; continue; // skip the rest for the moment } wdt_reset(); } +#endif + vox = 0; } lcd.setCursor(15, 1); lcd.print('R'); break;