Raduino: Disabled CAT in the Raduino main loop. Fixed some split freq setting via I2C. TeensyDSP: Added a Keyer. Works ok, but I have to disable ADC during transmit (or all of CW?) in order to keep the timing good... need to use interrupts and/or continuous ADC at some point. Added the MD CAT command, and fixed other CAT commands. Split seems to work, but don't do split when using the keyer! Halted the Raduino.

This commit is contained in:
Rob French 2021-02-11 23:55:41 -06:00
parent 814fe6c733
commit d2213e34ff
8 changed files with 127 additions and 23 deletions

View File

@ -339,12 +339,12 @@ byte delay_background(unsigned delayTime, byte fromType){ //fromType : 4 autoCWK
//Check PTT while auto Sending
autoSendPTTCheck();
Check_Cat(3);
//Check_Cat(3);
}
else
{
//Background Work
Check_Cat(fromType);
//Check_Cat(fromType);
}
}
@ -806,7 +806,7 @@ void checkButton(){
//wait for the button to go up again
while(keyStatus == getBtnStatus()) {
delay(10);
Check_Cat(0);
//Check_Cat(0);
}
//delay(50);//debounce
}
@ -825,7 +825,7 @@ void checkButton(){
//wait for the button to go up again
while(btnDown()) {
delay(10);
Check_Cat(0);
//Check_Cat(0);
}
//delay(50);//debounce
}
@ -1402,7 +1402,8 @@ void setup()
//printLineF(1, FIRMWARE_VERSION_INFO);
DisplayVersionInfo(FIRMWARE_VERSION_INFO);
Init_Cat(38400, SERIAL_8N1);
//Init_Cat(38400, SERIAL_8N1);
Serial.begin(38400);
initSettings();
initPorts();
@ -1504,13 +1505,14 @@ void loop(){
// controlAutoCW();
// KC4UPR: Note, implementation below leaves no manual way to abort TX due to CAT. May
// want to add in a way to interrupt CAT transmission with a PTT/CW event.
if (!txCAT) {
if (cwMode == 0)
//if (!txCAT) {
if (cwMode == 0) {
checkPTT();
else
} else {
cwKeyer();
}
checkButton();
}
//}
//cwKeyer();
@ -1532,7 +1534,7 @@ void loop(){
} //end of check TX Status
//we check CAT after the encoder as it might put the radio into TX
Check_Cat(inTx? 1 : 0);
//Check_Cat(inTx? 1 : 0);
//for SEND SW Serial
#ifdef USE_SW_SERIAL

View File

@ -373,8 +373,10 @@ void updateRaduinoFromState(UBitxRigState& r) {
vfoActive = rigState.flags & UBITX_VFOB_FLAG ? VFO_B : VFO_A;
if (vfoActive == VFO_A) {
if (rigState.vfo[0] != frequency) {
setFrequency(rigState.vfo[0]);
} else if (vfoActive == VFO_B) {
setFrequency(rigState.vfo[0]);
}
} else if (vfoActive == VFO_B) {
if (rigState.vfo[1] != frequency) {
setFrequency(rigState.vfo[1]);
}
}

View File

@ -7,10 +7,20 @@
UBitxTR TR(DSP);
void UBitxTR::update(bool cw) {
void UBitxTR::update(bool cw, bool extKey) {
updateKey();
if (cw) {
if ((keyEnable && keyDown) || extKey) {
setTX();
} else {
setRX();
}
return;
}
updatePTT();
updateVOX();
updateKey();
if (isTX) {
// If we are currently transmitting, then ANY T/R release (key

View File

@ -87,8 +87,12 @@ class UBitxTR {
* @param cw
* True if CW mode is currently active; false otherwise.
* Different/faster logic is used in CW mode.
*
* @param extKey
* True if an external keying signal (ie. CW keyer) is
* currently active (ie. key down).
*/
void update(bool cw = false);
void update(bool cw = false, bool extKey = false);
void end() {
}

View File

@ -138,17 +138,17 @@ TS590Error TS590Command::theError = NoError;
void TS590_FR::handleCommand(const char* cmd) {
if (strlen(cmd) == 3) {
switch (cmd[2]) {
case 0:
case '0':
rig()->selectVFOA(true);
rig()->splitOff(true);
break;
case 1:
case '1':
rig()->selectVFOB(true);
rig()->splitOff(true);
break;
case 2:
case '2':
// TODO: Need to add something for channel mode.
break;
@ -175,7 +175,7 @@ void TS590_FR::sendResponse(const char* cmd) {
void TS590_FT::handleCommand(const char* cmd) {
if (strlen(cmd) == 3) {
switch (cmd[2]) {
case 0:
case '0':
if (rig()->isVFOA()) {
rig()->splitOff(true);
} else if (rig()->isVFOB()) {
@ -185,7 +185,7 @@ void TS590_FT::handleCommand(const char* cmd) {
}
break;
case 1:
case '1':
if (rig()->isVFOA()) {
rig()->splitOn(true);
} else if (rig()->isVFOB()) {
@ -215,16 +215,76 @@ void TS590_FT::sendResponse(const char* cmd) {
/**********************************************************************/
void TS590_MD::handleCommand(const char* cmd) {
if (strlen(cmd) == 3) {
switch (cmd[2]) {
case '0': // None (setting failure)
case '4': // FM - not supported
case '5': // AM - not supported
case '6': // FSK - not supported
case '8': // None (setting failure)
case '9': // FSK-R - not supported
setProcessError();
break;
case '1': // LSB
rig()->selectLSB(true);
rig()->cwOff(true);
break;
case '2': // USB
rig()->selectUSB(true);
rig()->cwOff(true);
break;
case '3': // CW
rig()->selectUSB(true);
rig()->cwOn(true);
break;
case '7': // CW-R
rig()->selectLSB(true);
rig()->cwOn(true);
break;
default:
setSyntaxError();
}
} else {
setSyntaxError();
}
}
void TS590_MD::sendResponse(const char* cmd) {
if (rig()->isCW()) {
if (rig()->isUSB()) {
ts590SendCommand("MD3");
} else {
ts590SendCommand("MD7");
}
} else {
if (rig()->isUSB()) {
ts590SendCommand("MD2");
} else {
ts590SendCommand("MD1");
}
}
}
/**********************************************************************/
TS590_FA cmdFA;
TS590_FB cmdFB;
TS590_FR cmdFR;
TS590_FT cmdFT;
TS590_MD cmdMD;
TS590Command* catCommands[] = {
&cmdFA,
&cmdFB,
&cmdFR,
&cmdFT
&cmdFT,
&cmdMD
};
int numCatCommands = sizeof(catCommands) / sizeof(catCommands[0]);

View File

@ -148,6 +148,18 @@ class TS590_FT : public TS590Command {
/**********************************************************************/
/*!
* @brief CAT command for setting the mode.
*/
class TS590_MD : public TS590Command {
public:
TS590_MD(): TS590Command("MD") {}
virtual void handleCommand(const char* cmd);
virtual void sendResponse(const char* cmd);
};
/**********************************************************************/
class UBitxTS590 {
public:
UBitxTS590(TS590Command** cmds, int len): commands(cmds), numCommands(len) {}

View File

@ -10,6 +10,7 @@ KD8CEC, Ian Lee
#include <Arduino.h>
#include "Debug.h"
#include "DSP.h"
#include "Keyer.h"
#include "Nextion.h"
#include "Rig.h"
#include "RigState.h"

View File

@ -540,6 +540,13 @@ void loop()
return;
}
// If CW mode, we need to update keying a lot...
if (Rig.isCW()) {
if (Rig.isCW()) Keyer.doPaddles();
TR.update(Rig.isCW(), Keyer.isDown());
//if (TR.transmitting()) return;
}
// Start out by forwarding any data sitting in the RX buffer. We will
// do this as often as possible.
forwardData();
@ -550,11 +557,13 @@ void loop()
sinceFrameMillis = 0;
// Update each of the subsystems, beginning with CAT control.
TS590.update();
TR.update();
TS590.update();
TR.update(Rig.isCW(), Keyer.isDown());
Rig.update();
DSP.update();
//if (Rig.isCW()) return;
#ifdef DEBUG
// For debugging, output some debug info every 1.0" (40 frames @ 40 Hz).
frameCounter++;
@ -676,6 +685,8 @@ void loop()
forwardData();
}
if (Rig.isCW()) return; // In CW, the ADC measurement messes with the timing. So need to use interrupts on the Keyer, and/or continuous ADC.
if (sinceADCMillis > adcIntervalMillis) {
// Do stuff that we do once per ADC interval--ADC colllection.
// TODO: debug output (frame skipping / utilization).
@ -692,6 +703,8 @@ void loop()
//forwardData();
}
//if (Rig.isCW()) return;
// Check Response Command
if (responseCommand > 0 && sinceForward > LAST_TIME_INTERVAL)
{