Added some more debug code. Compiles.

This commit is contained in:
Rob French 2021-01-30 07:49:19 -06:00
parent 091f414409
commit da58606409
2 changed files with 40 additions and 0 deletions

View File

@ -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() {

View File

@ -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) {