Got the 5 second "DSP status menu" working. Got comms between the IOP
and the Raduino working again. Now implements a wrapper around all IOP<=>Raduino comms (IOP prefix, CAT prefix...)
This commit is contained in:
parent
681e01d019
commit
2f8fe7fb4c
@ -61,13 +61,13 @@ void iopSendMode(char cw_mode, char is_usb, char digi_mode, char is_test)
|
||||
byte mode;
|
||||
|
||||
if (cw_mode > 0)
|
||||
mode = MODE_CW;
|
||||
mode = RIG_MODE_CW;
|
||||
else if (digi_mode > 0)
|
||||
mode = MODE_DIGI;
|
||||
mode = RIG_MODE_DIGI;
|
||||
else if (is_test)
|
||||
mode = MODE_TEST;
|
||||
mode = RIG_MODE_TEST;
|
||||
else
|
||||
mode = MODE_SSB;
|
||||
mode = RIG_MODE_SSB;
|
||||
sendIOPModeCommand(mode);
|
||||
}
|
||||
|
||||
@ -810,12 +810,25 @@ byte rxBufferCheckCount = 0;
|
||||
//Prevent Stack Overflow
|
||||
byte isProcessCheck_Cat = 0;
|
||||
|
||||
char iopStatusWindow[4] = " "; // may need to move this if it's not visible to ubitx_lcd_1602
|
||||
|
||||
// KC4UPR - these are used to delay the display of the Smeter, if the
|
||||
// IOP status has recently been displayed, to give time to see it.
|
||||
// Put these here because of how Arduino IDE puts .ino files together.
|
||||
#define SMETER_DELAY_TIME 5000
|
||||
bool displaySmeter = true;
|
||||
int delaySmeter;
|
||||
|
||||
//fromType normal : 0, TX : 1, CW_STRAIGHT : 2, CW_PADDLE : 3, CW_AUTOMODE : 4
|
||||
//if cw mode, no delay
|
||||
void Check_Cat(byte fromType)
|
||||
{
|
||||
byte i;
|
||||
|
||||
static PrefixID readPrefix;
|
||||
static uint8_t readLength;
|
||||
static IOPMessage msg;
|
||||
|
||||
//Check Serial Port Buffer
|
||||
if (Serial.available() == 0)
|
||||
{
|
||||
@ -823,7 +836,9 @@ void Check_Cat(byte fromType)
|
||||
rxBufferCheckCount = 0;
|
||||
return;
|
||||
}
|
||||
else if (Serial.available() < 5)
|
||||
// KC4UPR - IOP update: changed this to 6 characters, because we're going to have a
|
||||
// first character which defines if this is CAT or IOP.
|
||||
else if (Serial.available() < 6) //5)
|
||||
{
|
||||
//First Arrived
|
||||
if (rxBufferCheckCount == 0)
|
||||
@ -837,7 +852,7 @@ void Check_Cat(byte fromType)
|
||||
for (i = 0; i < Serial.available(); i++)
|
||||
rxBufferCheckCount = Serial.read();
|
||||
|
||||
rxBufferCheckCount = 0;
|
||||
rxBufferCheckCount = 0;
|
||||
}
|
||||
else if (rxBufferCheckCount < Serial.available()) //increase buffer count, slow arrived
|
||||
{
|
||||
@ -848,103 +863,133 @@ void Check_Cat(byte fromType)
|
||||
}
|
||||
|
||||
//Arived CAT DATA
|
||||
for (i = 0; i < 5; i++)
|
||||
CAT_BUFF[i] = Serial.read();
|
||||
// KC4UPR - IOP update - 6 characters; first character determines mode (CAT or IOP)
|
||||
for (i = 0; i < 6; i++) { //5; i++)
|
||||
if (i == 0) {
|
||||
byte first = Serial.read();
|
||||
readPrefix = byteToPrefix(first);
|
||||
readLength = byteToLength(first);
|
||||
} else {
|
||||
CAT_BUFF[i-1] = Serial.read();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// KC4UPR: I don't understand why this is here or how/when it will ever get called, but I will leave
|
||||
// it alone for now.
|
||||
if (isProcessCheck_Cat == 1)
|
||||
return;
|
||||
|
||||
isProcessCheck_Cat = 1;
|
||||
isProcessCheck_Cat = 1;
|
||||
|
||||
//reference : http://www.ka7oei.com/ft817_meow.html
|
||||
switch(CAT_BUFF[4])
|
||||
{
|
||||
//The stability has not been verified and there seems to be no need. so i remarked codes,
|
||||
//if you need, unmark lines
|
||||
/*
|
||||
case 0x00 : //Lock On
|
||||
if (isDialLock == 1) //This command returns 00 if it was unlocked, and F0 if already locked.
|
||||
CAT_BUFF[0] = 0xF0;
|
||||
else {
|
||||
CAT_BUFF[0] = 0x00;
|
||||
setDialLock(1, fromType);
|
||||
}
|
||||
Serial.write(CAT_BUFF[0]); //Time
|
||||
if (readPrefix == IOP_PREFIX) {
|
||||
recvIOPMessage(msg, CAT_BUFF, 5); // not super robust... if IOP ever sends more than a 5 (6) byte message
|
||||
// following assumes it's a status message, 4 chars (including trailing null, which I'm ignoring...
|
||||
switch(msg.id) {
|
||||
case IOP_SSB_STATUS_MSG:
|
||||
case IOP_DIGI_STATUS_MSG:
|
||||
case IOP_CW_STATUS_MSG:
|
||||
case IOP_TEST_STATUS_MSG:
|
||||
iopStatusWindow[0] = msg.data[0];
|
||||
iopStatusWindow[1] = msg.data[1];
|
||||
iopStatusWindow[2] = msg.data[2];
|
||||
displaySmeter = false;
|
||||
delaySmeter = millis() + SMETER_DELAY_TIME;
|
||||
break;
|
||||
}
|
||||
|
||||
} else if (readPrefix == CAT_PREFIX) {
|
||||
|
||||
//reference : http://www.ka7oei.com/ft817_meow.html
|
||||
switch(CAT_BUFF[4])
|
||||
{
|
||||
//The stability has not been verified and there seems to be no need. so i remarked codes,
|
||||
//if you need, unmark lines
|
||||
/*
|
||||
case 0x00 : //Lock On
|
||||
if (isDialLock == 1) //This command returns 00 if it was unlocked, and F0 if already locked.
|
||||
CAT_BUFF[0] = 0xF0;
|
||||
else {
|
||||
CAT_BUFF[0] = 0x00;
|
||||
setDialLock(1, fromType);
|
||||
}
|
||||
Serial.write(CAT_BUFF[0]); //Time
|
||||
break;
|
||||
case 0x80 : //Lock Off
|
||||
if (isDialLock == 0) //This command returns 00 if the '817 was already locked, and F0 (HEX) if already unlocked.
|
||||
CAT_BUFF[0] = 0xF0;
|
||||
else {
|
||||
CAT_BUFF[0] = 0x00;
|
||||
setDialLock(0, fromType);
|
||||
}
|
||||
Serial.write(CAT_BUFF[0]); //Time
|
||||
break;
|
||||
*/
|
||||
|
||||
case 0x01 : //Set Frequency
|
||||
CatSetFreq(fromType);
|
||||
break;
|
||||
case 0x80 : //Lock Off
|
||||
if (isDialLock == 0) //This command returns 00 if the '817 was already locked, and F0 (HEX) if already unlocked.
|
||||
CAT_BUFF[0] = 0xF0;
|
||||
else {
|
||||
CAT_BUFF[0] = 0x00;
|
||||
setDialLock(0, fromType);
|
||||
}
|
||||
Serial.write(CAT_BUFF[0]); //Time
|
||||
|
||||
case 0x02 : //Split On
|
||||
case 0x82: //Split Off
|
||||
CatSetSplit(CAT_BUFF[4] == 0x02);
|
||||
break;
|
||||
*/
|
||||
|
||||
case 0x01 : //Set Frequency
|
||||
CatSetFreq(fromType);
|
||||
break;
|
||||
|
||||
case 0x02 : //Split On
|
||||
case 0x82: //Split Off
|
||||
CatSetSplit(CAT_BUFF[4] == 0x02);
|
||||
break;
|
||||
|
||||
case 0x03 : //Read Frequency and mode
|
||||
CatGetFreqMode(frequency);
|
||||
break;
|
||||
|
||||
case 0x07 : //Set Operating Mode
|
||||
CatSetMode(CAT_BUFF[0], fromType);
|
||||
break;
|
||||
|
||||
case 0x08 : //Set PTT_ON
|
||||
case 0x88: //Set PTT Off
|
||||
CatSetPTT(CAT_BUFF[4] == 0x08, fromType);
|
||||
break;
|
||||
|
||||
case 0x81: //Toggle VFO
|
||||
CatVFOToggle(true, fromType);
|
||||
break;
|
||||
|
||||
case 0xDB: //Read uBITX EEPROM Data
|
||||
ReadEEPRom(); //Call by uBITX Manager Program
|
||||
break;
|
||||
case 0xBB: //Read FT-817 EEPROM Data (for comfirtable)
|
||||
ReadEEPRom_FT817();
|
||||
break;
|
||||
|
||||
case 0xDC: //Write uBITX EEPROM Data
|
||||
WriteEEPRom(); //Call by uBITX Manager Program
|
||||
break;
|
||||
case 0xBC: //Write FT-817 EEPROM Data (for comfirtable)
|
||||
WriteEEPRom_FT817(fromType);
|
||||
break;
|
||||
|
||||
case 0xDD: //Read uBITX ADC Data
|
||||
ReadADCValue(); //Call by uBITX Manager Program
|
||||
break;
|
||||
|
||||
case 0xDE: //IF-Shift Control by CAT
|
||||
SetIFSValue(); //
|
||||
break;
|
||||
|
||||
case 0xE7 : //Read RX Status
|
||||
CatRxStatus();
|
||||
break;
|
||||
case 0xF7: //Read TX Status
|
||||
CatTxStatus();
|
||||
break;
|
||||
default:
|
||||
/*
|
||||
char buff[16];
|
||||
sprintf(buff, "DEFAULT : %x", CAT_BUFF[4]);
|
||||
printLine2(buff);
|
||||
*/
|
||||
Serial.write(ACK);
|
||||
break;
|
||||
} //end of switch
|
||||
|
||||
case 0x03 : //Read Frequency and mode
|
||||
CatGetFreqMode(frequency);
|
||||
break;
|
||||
|
||||
case 0x07 : //Set Operating Mode
|
||||
CatSetMode(CAT_BUFF[0], fromType);
|
||||
break;
|
||||
|
||||
case 0x08 : //Set PTT_ON
|
||||
case 0x88: //Set PTT Off
|
||||
CatSetPTT(CAT_BUFF[4] == 0x08, fromType);
|
||||
break;
|
||||
|
||||
case 0x81: //Toggle VFO
|
||||
CatVFOToggle(true, fromType);
|
||||
break;
|
||||
|
||||
case 0xDB: //Read uBITX EEPROM Data
|
||||
ReadEEPRom(); //Call by uBITX Manager Program
|
||||
break;
|
||||
case 0xBB: //Read FT-817 EEPROM Data (for comfirtable)
|
||||
ReadEEPRom_FT817();
|
||||
break;
|
||||
|
||||
case 0xDC: //Write uBITX EEPROM Data
|
||||
WriteEEPRom(); //Call by uBITX Manager Program
|
||||
break;
|
||||
case 0xBC: //Write FT-817 EEPROM Data (for comfirtable)
|
||||
WriteEEPRom_FT817(fromType);
|
||||
break;
|
||||
|
||||
case 0xDD: //Read uBITX ADC Data
|
||||
ReadADCValue(); //Call by uBITX Manager Program
|
||||
break;
|
||||
|
||||
case 0xDE: //IF-Shift Control by CAT
|
||||
SetIFSValue(); //
|
||||
break;
|
||||
|
||||
case 0xE7 : //Read RX Status
|
||||
CatRxStatus();
|
||||
break;
|
||||
case 0xF7: //Read TX Status
|
||||
CatTxStatus();
|
||||
break;
|
||||
default:
|
||||
/*
|
||||
char buff[16];
|
||||
sprintf(buff, "DEFAULT : %x", CAT_BUFF[4]);
|
||||
printLine2(buff);
|
||||
*/
|
||||
Serial.write(ACK);
|
||||
break;
|
||||
} //end of switch
|
||||
}
|
||||
|
||||
isProcessCheck_Cat = 0;
|
||||
}
|
||||
|
@ -518,8 +518,6 @@ void updateDisplay() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
char line2Buffer[17];
|
||||
//KD8CEC 200Hz ST
|
||||
//L14.150 200Hz ST
|
||||
@ -674,13 +672,18 @@ void updateLine2Buffer(char displayType)
|
||||
|
||||
if (isStepKhz == 0)
|
||||
{
|
||||
line2Buffer[11] = 'H';
|
||||
line2Buffer[12] = 'z';
|
||||
// KC4UPR: Getting rid of the "Hz" to unclutter the top line.
|
||||
line2Buffer[11] = ' '; //'H';
|
||||
line2Buffer[12] = ' '; //'z';
|
||||
}
|
||||
|
||||
line2Buffer[13] = ' ';
|
||||
|
||||
//Check CW Key cwKeyType = 0; //0: straight, 1 : iambica, 2: iambicb
|
||||
//line2Buffer[13] = ' ';
|
||||
|
||||
// KC4UPR: Replacing these all with IOP status
|
||||
line2Buffer[13] = iopStatusWindow[0];
|
||||
line2Buffer[14] = iopStatusWindow[1];
|
||||
line2Buffer[15] = iopStatusWindow[2];
|
||||
/* //Check CW Key cwKeyType = 0; //0: straight, 1 : iambica, 2: iambicb
|
||||
if (sdrModeOn == 1)
|
||||
{
|
||||
line2Buffer[13] = 'S';
|
||||
@ -701,7 +704,7 @@ void updateLine2Buffer(char displayType)
|
||||
{
|
||||
line2Buffer[14] = 'I';
|
||||
line2Buffer[15] = 'B';
|
||||
}
|
||||
} */
|
||||
}
|
||||
}
|
||||
|
||||
@ -745,8 +748,14 @@ void idle_process()
|
||||
}
|
||||
}
|
||||
|
||||
if (!displaySmeter) {
|
||||
if (delaySmeter < millis()) {
|
||||
displaySmeter = true;
|
||||
}
|
||||
}
|
||||
|
||||
//S-Meter Display
|
||||
if (((displayOption1 & 0x08) == 0x08 && (sdrModeOn == 0)) && (++checkCountSMeter > SMeterLatency))
|
||||
if (((displayOption1 & 0x08) == 0x08 && (sdrModeOn == 0)) && (++checkCountSMeter > SMeterLatency) && displaySmeter)
|
||||
{
|
||||
int newSMeter;
|
||||
|
||||
|
@ -996,7 +996,7 @@ void menuSelectMode(int btn){
|
||||
|
||||
// modify if two-tone test mode is set
|
||||
} else if (isTest > 0) {
|
||||
selectModeType += 5;
|
||||
selectModeType += 6;
|
||||
}
|
||||
} else if (cwMode == 1) {
|
||||
selectModeType = 2; // CWL
|
||||
|
Loading…
x
Reference in New Issue
Block a user