Working on the buffer issues. It looks like the issue is a failure (on

the Raduino side) to check for availability of character in the Serial
port, before reading the serial port.  Note, need to see if this is a
weakness on the Teensy (IOP) side as well.
This commit is contained in:
Rob French 2020-06-07 13:27:24 -05:00
parent 20e1eda140
commit f588a89ee7
3 changed files with 22 additions and 27 deletions

View File

@ -76,6 +76,8 @@ unsigned int skipTimeCount = 0;
byte CAT_BUFF[34];
byte CAT_SNDBUFF[34];
byte error_buf[17];
void SendCatData(byte sendCount)
{
// KC4UPR--uBITX IOP: Adding an additional byte at the beginning that
@ -811,7 +813,7 @@ 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
//char iopStatusWindow[4] = " "; // may need to move this if it's not visible to ubitx_lcd_1602
char iopMenuDisplay[17] = " ";
// KC4UPR - these are used to delay the display of the Smeter, if the
@ -820,7 +822,6 @@ char iopMenuDisplay[17] = " ";
//#define SMETER_DELAY_TIME 5000
//bool displaySmeter = true;
//int delaySmeter;
int delayTopLine = 0;
int stateTopLine = 0;
//fromType normal : 0, TX : 1, CW_STRAIGHT : 2, CW_PADDLE : 3, CW_AUTOMODE : 4
@ -871,7 +872,7 @@ void Check_Cat(byte fromType)
// Will adjust based on readlength
byte first = Serial.read();
readPrefix = byteToPrefix(first);
readLength = byteToLength(first);
readLength = byteToLength(first);
for (int i = 0; i < readLength; i++) {
CAT_BUFF[i] = Serial.read();
}
@ -904,17 +905,18 @@ void Check_Cat(byte fromType)
case IOP_MENU_DISPLAY_MSG:
for (int i = 0; i < 16; i++) {
iopMenuDisplay[i] = msg.data[i+1];
}
if (int8_t(msg.data[0]) == 0) {
stateTopLine = 4;
} else if (int8_t(msg.data[0]) < 0) {
stateTopLine = 0;
} else { // > 0
delayTopLine = millis() + (int8_t(msg.data[0]) * 1000);
stateTopLine = 2;
iopMenuDisplay[i] = msg.data[i];
}
stateTopLine = 2;
sprintf(error_buf, "# recv'd: %3d", readLength);
sendIOPDebugMessage(error_buf);
sendIOPDebugMessage(iopMenuDisplay);
break;
case IOP_MENU_INACTIVE_MSG:
stateTopLine = 0;
line2DisplayStatus = 0; // trying to force an update
break;
}
} else if (readPrefix == CAT_PREFIX) {
@ -1020,5 +1022,6 @@ void Init_Cat(long baud, int portConfig)
// At start, immediately send mode to IOP. Currently, IOP has no way to
// request the mode.
iopSendMode(cwMode, isUSB, digiMode, isTest);
// Moving this to main setup loop. Here, it may actually occur before the Raduino knows its mode!
//iopSendMode(cwMode, isUSB, digiMode, isTest);
}

View File

@ -1453,6 +1453,8 @@ void setup()
factory_alignment();
#endif
iopSendMode(cwMode, isUSB, digiMode, isTest);
}
//Auto save Frequency and Mode with Protected eeprom life by KD8CEC

View File

@ -531,22 +531,12 @@ void updateLine2Buffer(char displayType)
{
unsigned long tmpFreq = 0;
if ((stateTopLine == 2) || (stateTopLine == 4)) {
strcpy(line2Buffer, iopMenuDisplay);
if (stateTopLine == 4) {
stateTopLine = 3;
} else {
stateTopLine = 1;
}
if (stateTopLine == 2) {
strncpy(line2Buffer, iopMenuDisplay, 16);
stateTopLine = 1;
}
if (stateTopLine == 3) {
if (stateTopLine == 1) {
return;
} else if (stateTopLine == 1) {
if (delayTopLine < millis()) {
stateTopLine = 0;
} else {
return;
}
}
if (ritOn)