diff --git a/QCX-SSB.ino b/QCX-SSB.ino index 9493c55..92c8351 100644 --- a/QCX-SSB.ino +++ b/QCX-SSB.ino @@ -4,7 +4,7 @@ // // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -#define VERSION "1.02q" +#define VERSION "1.02r" // Configuration switches; remove/add a double-slash at line-start to enable/disable a feature; to save space disable e.g. CAT, DIAG, KEYER #define DIAG 1 // Hardware diagnostics on startup (only disable when your rig is working) @@ -27,7 +27,6 @@ //#define CAT_STREAMING 1 // Extended CAT support: audio streaming over CAT, once enabled and triggered with CAT cmd, 7.812ksps 8-bit unsigned audio is sent over UART. The ";" is omited in the data-stream, and only sent to indicate the beginning and end of a CAT cmd. #define CW_DECODER 1 // CW decoder #define TX_ENABLE 1 // Disable this for RX only (no transmit), e.g. to support uSDX for kids idea: https://groups.io/g/ucx/topic/81030243#6276 -#define TX_DELAY 1 // Enables a delay in the actual transmission to allow relay-switching to be completed before the power is applied #define KEY_CLICK 1 // Reduce key clicks by envelope shaping #define SEMI_QSK 1 // Just after keying the transmitter, keeps the RX muted for a short amount of time in the anticipation for continued keying #define RIT_ENABLE 1 // Receive-In-Transit alternates the receiving frequency with an user-defined offset to compensate for any necessary tuning needed on receive @@ -42,8 +41,9 @@ //#define TESTBENCH 1 // Tests RX chain by injection of sine wave, measurements results are sent over serial //#define CW_FREQS_QRP 1 // Defaults to CW QRP frequencies when changing bands //#define CW_FREQS_FISTS 1 // Defaults to CW FISTS frequencies when changing bands -//#define CW_MESSAGE 1 // Transmits pre-defined CW messages on-demand (double-click left button) +#define CW_MESSAGE 1 // Transmits pre-defined CW messages on-demand (double-click left button) //#define CW_MESSAGE_EXT 1 // Additional CW messages +//#define TX_DELAY 1 // Enables a delay in the actual transmission to allow relay-switching to be completed before the power is applied (see also NTX, PTX definitions below for GPIO that can switch relay/PA) // QCX pin defintions #define LCD_D4 0 //PD0 (pin 2) @@ -214,6 +214,7 @@ static uint8_t practice = false; // Practice mode volatile uint8_t cat_active = 0; volatile uint32_t rxend_event = 0; +volatile uint8_t vox = 0; #include #include @@ -270,15 +271,15 @@ public: // LCD1602 display in 4-bit mode, RS is pull-up and kept low when idle // There are two drawbacks when continuous LCD writes happen: 1. noise is leaking via the AREF pull-ups into the receiver 2. serial data cannot be received. void pre(){ #ifdef _SERIAL - if(cat_active){ Serial.flush(); for(; millis() < rxend_event;)wdt_reset(); PORTC |= 1<<2; DDRC |= 1<<2; } UCSR0B &= ~((1< TX vox_tx = 1; switch_rxtx(255); + //for(;(tx);) wdt_reset(); // while in tx (workaround for RFI feedback related issue) //delay(100); tx = 255; } } else if(!tx){ // VOX activated, no audio detected -> RX @@ -4934,7 +4935,7 @@ void loop() } else #endif //CW_DECODER - if(!semi_qsk_timeout) + if((!semi_qsk_timeout) && (!vox_tx)) smeter(); } @@ -5006,34 +5007,29 @@ void loop() } else { #endif //KEYER -// #define DAH_AS_KEY 1 #ifdef TX_ENABLE -#ifdef DAH_AS_KEY - if(!_digitalRead(DIT) || ((mode == CW) && (!_digitalRead(DAH))) ){ // PTT/DIT keys transmitter, for CW also DAH -#else - if(!_digitalRead(DIT) ){ // PTT/DIT keys transmitter -#endif + uint8_t pin = ((mode == CW) && (keyer_swap)) ? DAH : DIT; + if(!vox_tx) // ONLY if VOX not active, then check DIT/DAH (fix for VOX to prevent RFI feedback through EMI on DIT or DAH line) + if(!_digitalRead(pin)){ // PTT/DIT keys transmitter #ifdef CW_MESSAGE - cw_msg_event = 0; // clear cw message event + cw_msg_event = 0; // clear cw message event #endif //CW_MESSAGE switch_rxtx(1); -#ifdef DAH_AS_KEY - for(; !_digitalRead(DIT) || ((mode == CW) && (!_digitalRead(DAH)));){ // until released -#else - for(; !_digitalRead(DIT) ;){ // until released -#endif + do { wdt_reset(); + delay((mode == CW) ? 10 : 100); // keep the tx keyed for a while before sensing (helps against RFI issues on DAH/DAH line) #ifdef SWR_METER if(smeter > 0 && mode == CW && millis() >= stimer) { readSWR(); stimer = millis() + 500; } #endif if(inv ^ _digitalRead(BUTTONS)) break; // break if button is pressed (to prevent potential lock-up) - } + } while(!_digitalRead(pin)); // until released switch_rxtx(0); } #endif //TX_ENABLE #ifdef KEYER } #endif //KEYER + #ifdef SEMI_QSK if((semi_qsk_timeout) && (millis() > semi_qsk_timeout)){ switch_rxtx(0); } // delayed QSK RX #endif diff --git a/README.md b/README.md index d549d3b..bca4c86 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ pe1nnz@amsat.org ## Revision History: | Rev. | Date | Features | | ----- | ---------- | ------------------------------------------------------------------- | -| [R1.02q] | 2021-04-04 | TX quality improvements, single encoder/button-only control option, 16MHz Arduino Uno/Nano support, CW Messages. | +| [R1.02r] | 2021-04-05 | TX quality improvements, better robustness against RFI feedback, fix VOX issue, single encoder/button-only control option, 16MHz Arduino Uno/Nano support, CW Messages. | | [R1.02n] | 2021-02-22 | Key click reduction, TX bandwidth control, OLED fixes, CAT remote control features including RX audio streaming. | | [R1.02m] | 2021-01-27 | CW support, TS480 CAT support, RX quality improvments, semi-QSK, PA PTT out with TX-delay, VFO-A/B/RIT, LPF switching, backlight saving, 160m. | | [R1.02j] | 2020-10-10 | Integrated SDR receiver, CW decoder, DSP filters, AGC, NR, ATT, experimental modes CW, AM, FM, quick menu, persistent settings, improved SSB TX quality. LCD fix, selectable CW pitch. | @@ -333,7 +333,7 @@ Linear Data Manual, 1988. [Ghetto-class-E-later-publication]: http://www.iw3sgt.it/IW3SGT_PRJ/IW3SGT_AMP_LF/ClassDEF1.pdf -[R1.02q]: https://github.com/threeme3/QCX-SSB/tree/ca3a66c178d7062aa337eb3ac6b892b6cec95740 +[R1.02r]: [R1.02n]: https://github.com/threeme3/QCX-SSB/tree/5ac4204fd00c18e3b8cca13e32249dda6aeb6629