Updates to be compatible with iopcomm.h/iopcomm.cpp, and with the new
two-tone test mode.
This commit is contained in:
parent
c8b2110052
commit
681e01d019
@ -32,6 +32,8 @@
|
|||||||
|
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
|
#include <iopcomm.h>
|
||||||
|
|
||||||
#include "ubitx.h"
|
#include "ubitx.h"
|
||||||
|
|
||||||
//for broken protocol
|
//for broken protocol
|
||||||
@ -48,55 +50,25 @@
|
|||||||
#define CAT_MODE_FMN 0x88
|
#define CAT_MODE_FMN 0x88
|
||||||
|
|
||||||
#define ACK 0
|
#define ACK 0
|
||||||
// KC4UPR--uBITX IOP: prefixes to determine "mode" of serial transmission
|
|
||||||
#define CAT_PREFIX 0xC0
|
|
||||||
#define IOP_PREFIX 0xD0
|
|
||||||
#define EEPROM_READ_PREFIX 0xE0
|
|
||||||
#define EEPROM_WRITE_PREFIX 0xF0
|
|
||||||
|
|
||||||
#define IOP_MODE_COMMAND 0x00
|
|
||||||
#define IOP_START_TX_COMMAND 0x01
|
|
||||||
#define IOP_STOP_TX_COMMAND 0x02
|
|
||||||
#define IOP_MODE_SSB 0x00
|
|
||||||
#define IOP_MODE_DIGI 0x01
|
|
||||||
#define IOP_MODE_CW 0x02
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* KC4UPR - IOP update, 2020-05-03
|
* KC4UPR - IOP update, 2020-05-03
|
||||||
*
|
*
|
||||||
* Send the current mode to the I/O Processor.
|
* Send the current mode to the I/O Processor.
|
||||||
*
|
|
||||||
* NOTE: Not yet called from CAT, only from menu...
|
|
||||||
*/
|
*/
|
||||||
void iopSendMode(char cw_mode, char is_usb, char digi_mode)
|
void iopSendMode(char cw_mode, char is_usb, char digi_mode, char is_test)
|
||||||
{
|
{
|
||||||
byte mode;
|
byte mode;
|
||||||
|
|
||||||
Serial.write(IOP_PREFIX | 2);
|
|
||||||
Serial.write(IOP_MODE_COMMAND);
|
|
||||||
if (cw_mode > 0)
|
if (cw_mode > 0)
|
||||||
mode = IOP_MODE_CW;
|
mode = MODE_CW;
|
||||||
else if (digi_mode > 0)
|
else if (digi_mode > 0)
|
||||||
mode = IOP_MODE_DIGI;
|
mode = MODE_DIGI;
|
||||||
|
else if (is_test)
|
||||||
|
mode = MODE_TEST;
|
||||||
else
|
else
|
||||||
mode = IOP_MODE_SSB;
|
mode = MODE_SSB;
|
||||||
Serial.write(mode);
|
sendIOPModeCommand(mode);
|
||||||
}
|
|
||||||
|
|
||||||
// Used to tell the IOP that we're transmitting, when it came via
|
|
||||||
// CAT (otherwise, IOP is the one who tells Raduino to start TX!).
|
|
||||||
void iopStartTx()
|
|
||||||
{
|
|
||||||
Serial.write(IOP_PREFIX | 1);
|
|
||||||
Serial.write(IOP_START_TX_COMMAND);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Used to tell the IOP to stop transmitting, when it came via
|
|
||||||
// CAT (otherwise, IOP is the one who tells Raduino to stop TX!).
|
|
||||||
void iopStopTx()
|
|
||||||
{
|
|
||||||
Serial.write(IOP_PREFIX | 1);
|
|
||||||
Serial.write(IOP_STOP_TX_COMMAND);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int skipTimeCount = 0;
|
unsigned int skipTimeCount = 0;
|
||||||
@ -111,7 +83,7 @@ void SendCatData(byte sendCount)
|
|||||||
//
|
//
|
||||||
// NOTE: Need to do some error checking at some point to ensure we don't
|
// NOTE: Need to do some error checking at some point to ensure we don't
|
||||||
// try to send more than 15 bytes!!!
|
// try to send more than 15 bytes!!!
|
||||||
Serial.write(CAT_PREFIX | sendCount);
|
Serial.write(prefixAndLengthToByte(CAT_PREFIX, sendCount));
|
||||||
|
|
||||||
for (byte i = 0; i < sendCount; i++)
|
for (byte i = 0; i < sendCount; i++)
|
||||||
Serial.write(CAT_BUFF[i]);
|
Serial.write(CAT_BUFF[i]);
|
||||||
@ -236,7 +208,7 @@ void CatSetPTT(boolean isPTTOn, byte fromType)
|
|||||||
txCAT = true;
|
txCAT = true;
|
||||||
|
|
||||||
// KC4UPR - added the next line to tell the IOP we're transmitting
|
// KC4UPR - added the next line to tell the IOP we're transmitting
|
||||||
iopStartTx();
|
sendIOPStartTxCommand();
|
||||||
|
|
||||||
startTx(TX_SSB, 1);
|
startTx(TX_SSB, 1);
|
||||||
//Exit menu, Memory Keyer... ETC
|
//Exit menu, Memory Keyer... ETC
|
||||||
@ -252,7 +224,7 @@ void CatSetPTT(boolean isPTTOn, byte fromType)
|
|||||||
if (inTx)
|
if (inTx)
|
||||||
{
|
{
|
||||||
// KC4UPR - added the next line to tell the IOP we're not transmitting
|
// KC4UPR - added the next line to tell the IOP we're not transmitting
|
||||||
iopStopTx();
|
sendIOPStopTxCommand();
|
||||||
|
|
||||||
stopTx();
|
stopTx();
|
||||||
txCAT = false;
|
txCAT = false;
|
||||||
@ -281,21 +253,33 @@ void CatSetMode(byte tmpMode, byte fromType)
|
|||||||
|
|
||||||
if (!inTx)
|
if (!inTx)
|
||||||
{
|
{
|
||||||
if (tmpMode == CAT_MODE_CW)
|
switch(tmpMode) {
|
||||||
{
|
case CAT_MODE_CW:
|
||||||
cwMode = 1;
|
cwMode = 2; // should be CWU
|
||||||
}
|
break;
|
||||||
else if (tmpMode == CAT_MODE_USB)
|
|
||||||
{
|
|
||||||
cwMode = 0;
|
|
||||||
isUSB = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
cwMode = 0;
|
|
||||||
isUSB = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
case CAT_MODE_CWR:
|
||||||
|
cwMode = 1; // should be CWL
|
||||||
|
break;
|
||||||
|
|
||||||
|
case CAT_MODE_USB:
|
||||||
|
cwMode = 0;
|
||||||
|
digiMode = 0;
|
||||||
|
isUSB = true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case CAT_MODE_LSB:
|
||||||
|
cwMode = 0;
|
||||||
|
digiMode = 0;
|
||||||
|
isUSB = false;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case CAT_MODE_DIG:
|
||||||
|
cwMode = 0;
|
||||||
|
digiMode = 1;
|
||||||
|
isUSB = true; // DGU - but need to eventually use the FT-817 customization
|
||||||
|
}
|
||||||
|
iopSendMode(cwMode, isUSB, digiMode, isTest);
|
||||||
setFrequency(frequency);
|
setFrequency(frequency);
|
||||||
updateDisplay();
|
updateDisplay();
|
||||||
}
|
}
|
||||||
@ -318,7 +302,7 @@ void ReadEEPRom() //for remove warnings.
|
|||||||
// KC4UPR--uBITX IOP: Adding an additional byte at the beginning that
|
// KC4UPR--uBITX IOP: Adding an additional byte at the beginning that
|
||||||
// indicates that this is a "Memory Manager mode" transmission.
|
// indicates that this is a "Memory Manager mode" transmission.
|
||||||
// Then we repeat some of the CAT_BUFF data.
|
// Then we repeat some of the CAT_BUFF data.
|
||||||
Serial.write(EEPROM_READ_PREFIX);
|
Serial.write(prefixAndLengthToByte(RAD_EEPROM_READ_PREFIX, 5));
|
||||||
Serial.write(CAT_BUFF[0]);
|
Serial.write(CAT_BUFF[0]);
|
||||||
Serial.write(CAT_BUFF[1]);
|
Serial.write(CAT_BUFF[1]);
|
||||||
Serial.write(CAT_BUFF[2]);
|
Serial.write(CAT_BUFF[2]);
|
||||||
@ -371,7 +355,7 @@ void WriteEEPRom(void) //for remove warning
|
|||||||
// indicates that this is a "Memory Manager mode" transmission.
|
// indicates that this is a "Memory Manager mode" transmission.
|
||||||
//
|
//
|
||||||
// Also indicates that we are going to be sending two bytes of data.
|
// Also indicates that we are going to be sending two bytes of data.
|
||||||
Serial.write(EEPROM_WRITE_PREFIX | 2);
|
Serial.write(prefixAndLengthToByte(RAD_EEPROM_WRITE_PREFIX, 2));
|
||||||
|
|
||||||
//Check Checksum
|
//Check Checksum
|
||||||
if (CAT_BUFF[3] != ((CAT_BUFF[0] + CAT_BUFF[1] + CAT_BUFF[2]) % 256))
|
if (CAT_BUFF[3] != ((CAT_BUFF[0] + CAT_BUFF[1] + CAT_BUFF[2]) % 256))
|
||||||
@ -969,4 +953,8 @@ void Init_Cat(long baud, int portConfig)
|
|||||||
{
|
{
|
||||||
Serial.begin(baud, portConfig);
|
Serial.begin(baud, portConfig);
|
||||||
Serial.flush();
|
Serial.flush();
|
||||||
|
|
||||||
|
// At start, immediately send mode to IOP. Currently, IOP has no way to
|
||||||
|
// request the mode.
|
||||||
|
iopSendMode(cwMode, isUSB, digiMode, isTest);
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
//Firmware Version
|
//Firmware Version
|
||||||
//+ : This symbol identifies the firmware.
|
//+ : This symbol identifies the firmware.
|
||||||
// It was originally called 'CEC V1.072' but it is too long to waste the LCD window.
|
// It was originally called 'CEC V1.072' but it is too long to waste the LCD window.
|
||||||
// I do not want to make this Firmware users's uBITX messy with my callsign.
|
// I do not want to make this Firmware users's uBITX messy with my callsign.
|
||||||
@ -193,6 +193,7 @@ char splitOn = 0; //working split, uses VFO B as the transmit freque
|
|||||||
char keyDown = 0; //in cw mode, denotes the carrier is being transmitted
|
char keyDown = 0; //in cw mode, denotes the carrier is being transmitted
|
||||||
|
|
||||||
char isUSB = 0; //upper sideband was selected, this is reset to the default for the
|
char isUSB = 0; //upper sideband was selected, this is reset to the default for the
|
||||||
|
char isTest = 0; // two-tone test mode
|
||||||
char cwMode = 0; //compatible original source, and extend mode //if cwMode == 0, mode check : isUSB, cwMode > 0, mode Check : cwMode
|
char cwMode = 0; //compatible original source, and extend mode //if cwMode == 0, mode check : isUSB, cwMode > 0, mode Check : cwMode
|
||||||
//iscwMode = 0 : ssbmode, 1 :cwl, 2 : cwu, 3 : cwn (none tx)
|
//iscwMode = 0 : ssbmode, 1 :cwl, 2 : cwu, 3 : cwn (none tx)
|
||||||
char digiMode = 0; // 0: normal uBITX behavior (transmit LSB/USB when PTT is depressed)
|
char digiMode = 0; // 0: normal uBITX behavior (transmit LSB/USB when PTT is depressed)
|
||||||
|
@ -443,6 +443,11 @@ void updateDisplay() {
|
|||||||
strcpy(c, "DGU ");
|
strcpy(c, "DGU ");
|
||||||
else
|
else
|
||||||
strcpy(c, "DGL ");
|
strcpy(c, "DGL ");
|
||||||
|
} else if (isTest == 1) {
|
||||||
|
if (isUSB)
|
||||||
|
strcpy(c, "TTU ");
|
||||||
|
else
|
||||||
|
strcpy(c, "TTL ");
|
||||||
} else {
|
} else {
|
||||||
if (isUSB)
|
if (isUSB)
|
||||||
strcpy(c, "USB ");
|
strcpy(c, "USB ");
|
||||||
|
@ -149,6 +149,7 @@ byte modeToByte(){
|
|||||||
//autoSetModebyFreq : 0
|
//autoSetModebyFreq : 0
|
||||||
//autoSetModebyFreq : 1, if (modValue is not set, set mode by frequency)
|
//autoSetModebyFreq : 1, if (modValue is not set, set mode by frequency)
|
||||||
void byteToMode(byte modeValue, byte autoSetModebyFreq){
|
void byteToMode(byte modeValue, byte autoSetModebyFreq){
|
||||||
|
isTest = false; // test never settable from EEPROM
|
||||||
isUSB = false;
|
isUSB = false;
|
||||||
cwMode = 0;
|
cwMode = 0;
|
||||||
digiMode = 0;
|
digiMode = 0;
|
||||||
@ -181,6 +182,15 @@ void byteToMode(byte modeValue, byte autoSetModebyFreq){
|
|||||||
isUSB = true;
|
isUSB = true;
|
||||||
digiMode = 1;
|
digiMode = 1;
|
||||||
break;
|
break;
|
||||||
|
/*
|
||||||
|
case 8: // TTL
|
||||||
|
isUSB = false;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 9: // TTU
|
||||||
|
isUSB = true;
|
||||||
|
break;
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* if (modeValue == 4) {
|
/* if (modeValue == 4) {
|
||||||
@ -973,7 +983,7 @@ void menuSelectMode(int btn){
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//LSB, USB, CWL, CWU, DGL, DGU
|
//LSB, USB, CWL, CWU, DGL, DGU, TTL, TTU
|
||||||
if (cwMode == 0) {
|
if (cwMode == 0) {
|
||||||
if (isUSB == 0) {
|
if (isUSB == 0) {
|
||||||
selectModeType = 0; // LSB
|
selectModeType = 0; // LSB
|
||||||
@ -983,6 +993,10 @@ void menuSelectMode(int btn){
|
|||||||
// modify if digital mode is set
|
// modify if digital mode is set
|
||||||
if (digiMode > 0) {
|
if (digiMode > 0) {
|
||||||
selectModeType += (3 + digiMode);
|
selectModeType += (3 + digiMode);
|
||||||
|
|
||||||
|
// modify if two-tone test mode is set
|
||||||
|
} else if (isTest > 0) {
|
||||||
|
selectModeType += 5;
|
||||||
}
|
}
|
||||||
} else if (cwMode == 1) {
|
} else if (cwMode == 1) {
|
||||||
selectModeType = 2; // CWL
|
selectModeType = 2; // CWL
|
||||||
@ -999,29 +1013,30 @@ void menuSelectMode(int btn){
|
|||||||
selectModeType = 3;*/
|
selectModeType = 3;*/
|
||||||
|
|
||||||
beforeMode = selectModeType;
|
beforeMode = selectModeType;
|
||||||
selectModeType = getValueByKnob(11, selectModeType, 0, 5, 1, " LSB USB CWL CWU DGL DGU ", 4); //3 : Select Mode, targetValue, minKnobValue, maxKnobValue, stepSize
|
selectModeType = getValueByKnob(11, selectModeType, 0, 7, 1, " LSB USB CWL CWU DGL DGU TTL TTU", 4); //3 : Select Mode, targetValue, minKnobValue, maxKnobValue, stepSize
|
||||||
|
|
||||||
if (beforeMode != selectModeType)
|
if (beforeMode != selectModeType)
|
||||||
{
|
{
|
||||||
//printLineF1(F("Changed Mode"));
|
//printLineF1(F("Changed Mode"));
|
||||||
if (selectModeType == 0) {
|
if (selectModeType == 0) {
|
||||||
cwMode = 0; isUSB = 0; digiMode = 0;
|
cwMode = 0; isUSB = 0; digiMode = 0; isTest = 0;
|
||||||
}
|
} else if (selectModeType == 1) {
|
||||||
else if (selectModeType == 1) {
|
cwMode = 0; isUSB = 1; digiMode = 0; isTest = 0;
|
||||||
cwMode = 0; isUSB = 1; digiMode = 0;
|
} else if (selectModeType == 2) {
|
||||||
}
|
cwMode = 1; digiMode = 0; isTest = 0;
|
||||||
else if (selectModeType == 2) {
|
} else if (selectModeType == 3) {
|
||||||
cwMode = 1; digiMode = 0;
|
cwMode = 2; digiMode = 0; isTest = 0;
|
||||||
}
|
|
||||||
else if (selectModeType == 3) {
|
|
||||||
cwMode = 2; digiMode = 0;
|
|
||||||
} else if (selectModeType == 4) {
|
} else if (selectModeType == 4) {
|
||||||
cwMode = 0; isUSB = 0; digiMode = 1;
|
cwMode = 0; isUSB = 0; digiMode = 1; isTest = 0;
|
||||||
} else if (selectModeType == 5) {
|
} else if (selectModeType == 5) {
|
||||||
cwMode = 0; isUSB = 1; digiMode = 1;
|
cwMode = 0; isUSB = 1; digiMode = 1; isTest = 0;
|
||||||
|
} else if (selectModeType == 6) {
|
||||||
|
cwMode = 0; isUSB = 0; digiMode = 0; isTest = 1;
|
||||||
|
} else if (selectModeType == 7) {
|
||||||
|
cwMode = 0; isUSB = 1; digiMode = 0; isTest = 1;
|
||||||
}
|
}
|
||||||
// KC4UPR: sending mode to IOP
|
// KC4UPR: sending mode to IOP
|
||||||
iopSendMode(cwMode, isUSB, digiMode);
|
iopSendMode(cwMode, isUSB, digiMode, isTest);
|
||||||
|
|
||||||
FrequencyToVFO(1);
|
FrequencyToVFO(1);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user