Successful communication between Raduino and IOP. Digi modes working.
Have a high-pitched whine in RX audio, however (IOP problem, not Raduino).
This commit is contained in:
parent
7ba147b06d
commit
c8b2110052
@ -54,30 +54,49 @@
|
|||||||
#define EEPROM_READ_PREFIX 0xE0
|
#define EEPROM_READ_PREFIX 0xE0
|
||||||
#define EEPROM_WRITE_PREFIX 0xF0
|
#define EEPROM_WRITE_PREFIX 0xF0
|
||||||
|
|
||||||
#define IOP_MODE_COMMAND 0x00
|
#define IOP_MODE_COMMAND 0x00
|
||||||
#define IOP_MODE_SSB 0x01
|
#define IOP_START_TX_COMMAND 0x01
|
||||||
#define IOP_MODE_DIGI 0x02
|
#define IOP_STOP_TX_COMMAND 0x02
|
||||||
#define IOP_MODE_CW 0x03
|
#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: This all needs to be expanded to include digital...
|
|
||||||
*
|
|
||||||
* NOTE: Not yet called from CAT, only from menu...
|
* NOTE: Not yet called from CAT, only from menu...
|
||||||
*/
|
*/
|
||||||
void iopSendMode(char is_cw, char is_usb)
|
void iopSendMode(char cw_mode, char is_usb, char digi_mode)
|
||||||
{
|
{
|
||||||
byte mode;
|
byte mode;
|
||||||
|
|
||||||
Serial.write(IOP_PREFIX | 2);
|
Serial.write(IOP_PREFIX | 2);
|
||||||
Serial.write(IOP_MODE_COMMAND);
|
Serial.write(IOP_MODE_COMMAND);
|
||||||
if (is_cw)
|
if (cw_mode > 0)
|
||||||
mode = IOP_MODE_CW;
|
mode = IOP_MODE_CW;
|
||||||
|
else if (digi_mode > 0)
|
||||||
|
mode = IOP_MODE_DIGI;
|
||||||
else
|
else
|
||||||
mode = IOP_MODE_SSB;
|
mode = IOP_MODE_SSB;
|
||||||
|
Serial.write(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;
|
||||||
@ -202,7 +221,8 @@ void CatSetSplit(boolean isSplit) //for remove warning messages
|
|||||||
|
|
||||||
void CatSetPTT(boolean isPTTOn, byte fromType)
|
void CatSetPTT(boolean isPTTOn, byte fromType)
|
||||||
{
|
{
|
||||||
//
|
// KC4UPR - so I think this means, that if we're currently processing a CW keyer (auto/manual),
|
||||||
|
// not to accept a CAT command in the middle of it.
|
||||||
if ((!inTx) && (fromType == 2 || fromType == 3)) {
|
if ((!inTx) && (fromType == 2 || fromType == 3)) {
|
||||||
Serial.write(ACK);
|
Serial.write(ACK);
|
||||||
return;
|
return;
|
||||||
@ -215,6 +235,9 @@ void CatSetPTT(boolean isPTTOn, byte fromType)
|
|||||||
{
|
{
|
||||||
txCAT = true;
|
txCAT = true;
|
||||||
|
|
||||||
|
// KC4UPR - added the next line to tell the IOP we're transmitting
|
||||||
|
iopStartTx();
|
||||||
|
|
||||||
startTx(TX_SSB, 1);
|
startTx(TX_SSB, 1);
|
||||||
//Exit menu, Memory Keyer... ETC
|
//Exit menu, Memory Keyer... ETC
|
||||||
if (isCWAutoMode > 0) {
|
if (isCWAutoMode > 0) {
|
||||||
@ -228,6 +251,9 @@ void CatSetPTT(boolean isPTTOn, byte fromType)
|
|||||||
{
|
{
|
||||||
if (inTx)
|
if (inTx)
|
||||||
{
|
{
|
||||||
|
// KC4UPR - added the next line to tell the IOP we're not transmitting
|
||||||
|
iopStopTx();
|
||||||
|
|
||||||
stopTx();
|
stopTx();
|
||||||
txCAT = false;
|
txCAT = false;
|
||||||
}
|
}
|
||||||
|
@ -310,8 +310,8 @@ extern void printLineF(char linenmbr, const __FlashStringHelper *c);
|
|||||||
extern void printLineFromEEPRom(char linenmbr, char lcdColumn, byte eepromStartIndex, byte eepromEndIndex, char offsetType);
|
extern void printLineFromEEPRom(char linenmbr, char lcdColumn, byte eepromStartIndex, byte eepromEndIndex, char offsetType);
|
||||||
extern byte delay_background(unsigned delayTime, byte fromType);
|
extern byte delay_background(unsigned delayTime, byte fromType);
|
||||||
extern int btnDown(void);
|
extern int btnDown(void);
|
||||||
extern char c[30];
|
extern char c[40];
|
||||||
extern char b[30];
|
extern char b[40];
|
||||||
extern int enc_read(void);
|
extern int enc_read(void);
|
||||||
extern void si5351bx_init(void);
|
extern void si5351bx_init(void);
|
||||||
extern void si5351bx_setfreq(uint8_t clknum, uint32_t fout);
|
extern void si5351bx_setfreq(uint8_t clknum, uint32_t fout);
|
||||||
|
@ -191,10 +191,15 @@ boolean txCAT = false; //turned on if the transmitting due to a CAT comma
|
|||||||
char inTx = 0; //it is set to 1 if in transmit mode (whatever the reason : cw, ptt or cat)
|
char inTx = 0; //it is set to 1 if in transmit mode (whatever the reason : cw, ptt or cat)
|
||||||
char splitOn = 0; //working split, uses VFO B as the transmit frequency
|
char splitOn = 0; //working split, uses VFO B as the transmit frequency
|
||||||
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 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)
|
||||||
|
// 1: user-defined digital mode via USB audio input; DTU (default) USB if isUSB; DTL LSB if !isUSB
|
||||||
|
// Effect of non-zero digiMode on ubitx software: should disable the physical PTT inputs (front/back),
|
||||||
|
// but might need to consider physical PTT as a way to stop CAT-based transmission. Also affects the mode
|
||||||
|
// info sent to the IOP.
|
||||||
|
|
||||||
//frequency when it crosses the frequency border of 10 MHz
|
//frequency when it crosses the frequency border of 10 MHz
|
||||||
byte menuOn = 0; //set to 1 when the menu is being displayed, if a menu item sets it to zero, the menu is exited
|
byte menuOn = 0; //set to 1 when the menu is being displayed, if a menu item sets it to zero, the menu is exited
|
||||||
|
@ -282,7 +282,7 @@ void LCD_CreateChar(uint8_t location, uint8_t charmap[])
|
|||||||
//SWR GRAPH, DrawMeter and drawingMeter Logic function by VK2ETA
|
//SWR GRAPH, DrawMeter and drawingMeter Logic function by VK2ETA
|
||||||
#define OPTION_SKINNYBARS
|
#define OPTION_SKINNYBARS
|
||||||
|
|
||||||
char c[30], b[30];
|
char c[40], b[40];
|
||||||
char printBuff[2][17]; //mirrors what is showing on the two lines of the display
|
char printBuff[2][17]; //mirrors what is showing on the two lines of the display
|
||||||
|
|
||||||
|
|
||||||
@ -438,10 +438,17 @@ void updateDisplay() {
|
|||||||
else {
|
else {
|
||||||
if (cwMode == 0)
|
if (cwMode == 0)
|
||||||
{
|
{
|
||||||
if (isUSB)
|
if (digiMode == 1) {
|
||||||
strcpy(c, "USB ");
|
if (isUSB)
|
||||||
else
|
strcpy(c, "DGU ");
|
||||||
strcpy(c, "LSB ");
|
else
|
||||||
|
strcpy(c, "DGL ");
|
||||||
|
} else {
|
||||||
|
if (isUSB)
|
||||||
|
strcpy(c, "USB ");
|
||||||
|
else
|
||||||
|
strcpy(c, "LSB ");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (cwMode == 1)
|
else if (cwMode == 1)
|
||||||
{
|
{
|
||||||
|
@ -131,9 +131,9 @@ byte modeToByte(){
|
|||||||
if (cwMode == 0)
|
if (cwMode == 0)
|
||||||
{
|
{
|
||||||
if (isUSB)
|
if (isUSB)
|
||||||
return 3;
|
return 3 + (digiMode > 0 ? 3 + digiMode : 0);
|
||||||
else
|
else
|
||||||
return 2;
|
return 2 + (digiMode > 0 ? 3 + digiMode : 0);
|
||||||
}
|
}
|
||||||
else if (cwMode == 1)
|
else if (cwMode == 1)
|
||||||
{
|
{
|
||||||
@ -149,20 +149,56 @@ 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){
|
||||||
if (modeValue == 4)
|
isUSB = false;
|
||||||
cwMode = 1;
|
cwMode = 0;
|
||||||
else if (modeValue == 5)
|
digiMode = 0;
|
||||||
cwMode = 2;
|
|
||||||
else
|
if (autoSetModebyFreq == 1 && (modeValue == 0)) {
|
||||||
{
|
isUSB = (frequency > 10000000l) ? true : false;
|
||||||
|
} else {
|
||||||
|
switch(modeValue) {
|
||||||
|
// LSB by default, so we can skip this case
|
||||||
|
//case 2: // LSB
|
||||||
|
//break;
|
||||||
|
|
||||||
|
case 3: // USB
|
||||||
|
isUSB = true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 4: // CWL
|
||||||
|
cwMode = 1;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 5: // CWU
|
||||||
|
cwMode = 2;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 6: // DGL
|
||||||
|
digiMode = 1;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 7: // DGU
|
||||||
|
isUSB = true;
|
||||||
|
digiMode = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* if (modeValue == 4) {
|
||||||
|
cwMode = 1; digiMode = 0;
|
||||||
|
} else if (modeValue == 5) {
|
||||||
|
cwMode = 2; digiMode = 0;
|
||||||
|
} else {
|
||||||
cwMode = 0;
|
cwMode = 0;
|
||||||
if (modeValue == 3)
|
if (modeValue == 3) {
|
||||||
isUSB = 1;
|
isUSB = 1; digiMode = 0;
|
||||||
|
} else if (modeValue == 6) {
|
||||||
|
isUSB =
|
||||||
|
}
|
||||||
else if (autoSetModebyFreq == 1 && (modeValue == 0))
|
else if (autoSetModebyFreq == 1 && (modeValue == 0))
|
||||||
isUSB = (frequency > 10000000l) ? true : false;
|
isUSB = (frequency > 10000000l) ? true : false;
|
||||||
else
|
else
|
||||||
isUSB = 0;
|
isUSB = 0;
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -651,12 +687,19 @@ int getValueByKnob(int valueType, int targetValue, int minKnobValue, int maxKnob
|
|||||||
moveDetectStep = 0;
|
moveDetectStep = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
strcpy(b, displayTitle);
|
|
||||||
|
|
||||||
if (valueType == 11) //Mode Select
|
if (valueType == 11) //Mode Select
|
||||||
{
|
{
|
||||||
b[targetValue * 4] = '>';
|
int tmpCol = targetValue * 4;
|
||||||
}
|
if (tmpCol >= 16) {
|
||||||
|
tmpCol -= 16;
|
||||||
|
strcpy(b, &displayTitle[16]);
|
||||||
|
} else {
|
||||||
|
strcpy(b, displayTitle);
|
||||||
|
}
|
||||||
|
b[tmpCol] = '>';
|
||||||
|
} else {
|
||||||
|
strcpy(b, displayTitle);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
else if (valueType == 4) //CW Key Type Select
|
else if (valueType == 4) //CW Key Type Select
|
||||||
{
|
{
|
||||||
@ -668,8 +711,6 @@ int getValueByKnob(int valueType, int targetValue, int minKnobValue, int maxKnob
|
|||||||
strcat(b, "IAMBICB");
|
strcat(b, "IAMBICB");
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
else
|
|
||||||
{
|
|
||||||
strcat(b, ":");
|
strcat(b, ":");
|
||||||
itoa(targetValue,c, 10);
|
itoa(targetValue,c, 10);
|
||||||
strcat(b, c);
|
strcat(b, c);
|
||||||
@ -932,36 +973,55 @@ void menuSelectMode(int btn){
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//LSB, USB, CWL, CWU
|
//LSB, USB, CWL, CWU, DGL, DGU
|
||||||
if (cwMode == 0 && isUSB == 0)
|
if (cwMode == 0) {
|
||||||
|
if (isUSB == 0) {
|
||||||
|
selectModeType = 0; // LSB
|
||||||
|
} else {
|
||||||
|
selectModeType = 1; // USB
|
||||||
|
}
|
||||||
|
// modify if digital mode is set
|
||||||
|
if (digiMode > 0) {
|
||||||
|
selectModeType += (3 + digiMode);
|
||||||
|
}
|
||||||
|
} else if (cwMode == 1) {
|
||||||
|
selectModeType = 2; // CWL
|
||||||
|
} else {
|
||||||
|
selectModeType = 3; // CWU
|
||||||
|
}
|
||||||
|
/*if (cwMode == 0 && isUSB == 0)
|
||||||
selectModeType = 0;
|
selectModeType = 0;
|
||||||
else if (cwMode == 0 && isUSB == 1)
|
else if (cwMode == 0 && isUSB == 1)
|
||||||
selectModeType = 1;
|
selectModeType = 1;
|
||||||
else if (cwMode == 1)
|
else if (cwMode == 1)
|
||||||
selectModeType = 2;
|
selectModeType = 2;
|
||||||
else
|
else
|
||||||
selectModeType = 3;
|
selectModeType = 3;*/
|
||||||
|
|
||||||
beforeMode = selectModeType;
|
beforeMode = selectModeType;
|
||||||
selectModeType = getValueByKnob(11, selectModeType, 0, 3, 1, " LSB USB CWL CWU", 4); //3 : Select Mode, targetValue, minKnobValue, maxKnobValue, stepSize
|
selectModeType = getValueByKnob(11, selectModeType, 0, 5, 1, " LSB USB CWL CWU DGL DGU ", 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;
|
cwMode = 0; isUSB = 0; digiMode = 0;
|
||||||
}
|
}
|
||||||
else if (selectModeType == 1) {
|
else if (selectModeType == 1) {
|
||||||
cwMode = 0; isUSB = 1;
|
cwMode = 0; isUSB = 1; digiMode = 0;
|
||||||
}
|
}
|
||||||
else if (selectModeType == 2) {
|
else if (selectModeType == 2) {
|
||||||
cwMode = 1;
|
cwMode = 1; digiMode = 0;
|
||||||
}
|
}
|
||||||
else if (selectModeType == 3) {
|
else if (selectModeType == 3) {
|
||||||
cwMode = 2;
|
cwMode = 2; digiMode = 0;
|
||||||
|
} else if (selectModeType == 4) {
|
||||||
|
cwMode = 0; isUSB = 0; digiMode = 1;
|
||||||
|
} else if (selectModeType == 5) {
|
||||||
|
cwMode = 0; isUSB = 1; digiMode = 1;
|
||||||
}
|
}
|
||||||
// KC4UPR: sending mode to IOP
|
// KC4UPR: sending mode to IOP
|
||||||
iopSendMode(cwMode, isUSB);
|
iopSendMode(cwMode, isUSB, digiMode);
|
||||||
|
|
||||||
FrequencyToVFO(1);
|
FrequencyToVFO(1);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user