diff --git a/TeensyDSP/DSP.cpp b/TeensyDSP/DSP.cpp index 926815d..9d29f06 100644 --- a/TeensyDSP/DSP.cpp +++ b/TeensyDSP/DSP.cpp @@ -66,6 +66,8 @@ void UBitxDSP::begin() { // Rig (Line) Input (RX) audioCtrl.inputSelect(AUDIO_INPUT_LINEIN); audioCtrl.unmuteLineout(); + audioCtrl.lineInLevel(5, 5); // RX, TX + audioCtrl.lineOutLevel(29, 29); //RX, TX // Mic Input (TX) audioCtrl.micGain(0); // TODO: set value @@ -84,6 +86,9 @@ void UBitxDSP::begin() { // USB Output (RX) // Rig (Line) Output (TX) + + // Default to RX. + rx(); } void UBitxDSP::end() { diff --git a/TeensyDSP/TeensyDSP.ino b/TeensyDSP/TeensyDSP.ino index 59edc8f..31c5f68 100644 --- a/TeensyDSP/TeensyDSP.ino +++ b/TeensyDSP/TeensyDSP.ino @@ -445,6 +445,10 @@ const int adcIntervalMillis = ADC_INTERVAL_MS; // MAIN LOOP //====================================================================== +#ifdef DEBUG +int frameCounter = 0; +#endif + void loop() { //char isProcess = 0; // 0: init, 1: complete ADC sampling, 2: complete FFT @@ -469,6 +473,37 @@ void loop() // TODO: debug output (frame skipping / utilization). sinceFrameMillis = 0; +#ifdef DEBUG + // For debugging, output some debug info every 1.0" (40 frames @ 40 Hz). + frameCounter++; + if (frameCounter % 40 == 0) { + Serial.print("DBG: Frame: "); + Serial.print(frameCounter); + if (isTX) { + Serial.print(", Loop State: TX"); + } else { + Serial.print(", Loop State: RX"); + } + if (TR.transmitting()) { + Serial.println(", TR State: TX"); + } else { + Serial.println(", TR State: RX"); + } + Serial.print("DBG: S-Meter Raw: "); + Serial.print(Sensors.sMeterUnscaled()); + Serial.print(", S-Meter Scaled: "); + Serial.println(scaledSMeter); + Serial.print("DBG: VSWR Calc: "); + Serial.print(calcVSWR, 2); + Serial.print(", VSWR Scaled: "); + Serial.print(scaledVSWR); + Serial.print(", FWD PWR: "); + Serial.print(fwdPower, 2); + Serial.print(", REV PWR: "); + Serial.println(revPower, 2); + } +#endif + TR.update(); if (isTX) {