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:
Rob French 2020-05-18 08:15:28 -05:00
parent 681e01d019
commit 2f8fe7fb4c
3 changed files with 160 additions and 106 deletions

View File

@ -61,13 +61,13 @@ void iopSendMode(char cw_mode, char is_usb, char digi_mode, char is_test)
byte mode; byte mode;
if (cw_mode > 0) if (cw_mode > 0)
mode = MODE_CW; mode = RIG_MODE_CW;
else if (digi_mode > 0) else if (digi_mode > 0)
mode = MODE_DIGI; mode = RIG_MODE_DIGI;
else if (is_test) else if (is_test)
mode = MODE_TEST; mode = RIG_MODE_TEST;
else else
mode = MODE_SSB; mode = RIG_MODE_SSB;
sendIOPModeCommand(mode); sendIOPModeCommand(mode);
} }
@ -810,12 +810,25 @@ byte rxBufferCheckCount = 0;
//Prevent Stack Overflow //Prevent Stack Overflow
byte isProcessCheck_Cat = 0; 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 //fromType normal : 0, TX : 1, CW_STRAIGHT : 2, CW_PADDLE : 3, CW_AUTOMODE : 4
//if cw mode, no delay //if cw mode, no delay
void Check_Cat(byte fromType) void Check_Cat(byte fromType)
{ {
byte i; byte i;
static PrefixID readPrefix;
static uint8_t readLength;
static IOPMessage msg;
//Check Serial Port Buffer //Check Serial Port Buffer
if (Serial.available() == 0) if (Serial.available() == 0)
{ {
@ -823,7 +836,9 @@ void Check_Cat(byte fromType)
rxBufferCheckCount = 0; rxBufferCheckCount = 0;
return; 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 //First Arrived
if (rxBufferCheckCount == 0) if (rxBufferCheckCount == 0)
@ -848,14 +863,43 @@ void Check_Cat(byte fromType)
} }
//Arived CAT DATA //Arived CAT DATA
for (i = 0; i < 5; i++) // KC4UPR - IOP update - 6 characters; first character determines mode (CAT or IOP)
CAT_BUFF[i] = Serial.read(); 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) if (isProcessCheck_Cat == 1)
return; return;
isProcessCheck_Cat = 1; isProcessCheck_Cat = 1;
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 //reference : http://www.ka7oei.com/ft817_meow.html
switch(CAT_BUFF[4]) switch(CAT_BUFF[4])
{ {
@ -945,6 +989,7 @@ void Check_Cat(byte fromType)
Serial.write(ACK); Serial.write(ACK);
break; break;
} //end of switch } //end of switch
}
isProcessCheck_Cat = 0; isProcessCheck_Cat = 0;
} }

View File

@ -518,8 +518,6 @@ void updateDisplay() {
} }
} }
char line2Buffer[17]; char line2Buffer[17];
//KD8CEC 200Hz ST //KD8CEC 200Hz ST
//L14.150 200Hz ST //L14.150 200Hz ST
@ -674,13 +672,18 @@ void updateLine2Buffer(char displayType)
if (isStepKhz == 0) if (isStepKhz == 0)
{ {
line2Buffer[11] = 'H'; // KC4UPR: Getting rid of the "Hz" to unclutter the top line.
line2Buffer[12] = 'z'; line2Buffer[11] = ' '; //'H';
line2Buffer[12] = ' '; //'z';
} }
line2Buffer[13] = ' '; //line2Buffer[13] = ' ';
//Check CW Key cwKeyType = 0; //0: straight, 1 : iambica, 2: iambicb // 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) if (sdrModeOn == 1)
{ {
line2Buffer[13] = 'S'; line2Buffer[13] = 'S';
@ -701,7 +704,7 @@ void updateLine2Buffer(char displayType)
{ {
line2Buffer[14] = 'I'; line2Buffer[14] = 'I';
line2Buffer[15] = 'B'; line2Buffer[15] = 'B';
} } */
} }
} }
@ -745,8 +748,14 @@ void idle_process()
} }
} }
if (!displaySmeter) {
if (delaySmeter < millis()) {
displaySmeter = true;
}
}
//S-Meter Display //S-Meter Display
if (((displayOption1 & 0x08) == 0x08 && (sdrModeOn == 0)) && (++checkCountSMeter > SMeterLatency)) if (((displayOption1 & 0x08) == 0x08 && (sdrModeOn == 0)) && (++checkCountSMeter > SMeterLatency) && displaySmeter)
{ {
int newSMeter; int newSMeter;

View File

@ -996,7 +996,7 @@ void menuSelectMode(int btn){
// modify if two-tone test mode is set // modify if two-tone test mode is set
} else if (isTest > 0) { } else if (isTest > 0) {
selectModeType += 5; selectModeType += 6;
} }
} else if (cwMode == 1) { } else if (cwMode == 1) {
selectModeType = 2; // CWL selectModeType = 2; // CWL