Major step in the new AVR interface to send commands. It compiles, but is untested. The old code and function remains active.

This commit is contained in:
2026-01-28 17:18:59 -06:00
parent e2829f648d
commit a83bc28a8d
5 changed files with 534 additions and 63 deletions

View File

@@ -261,7 +261,7 @@ unsigned long Hex2Dec(uint8_t *p, int dig);
//void ShowAllStatusInfo();
void GetAndSendCustomMessage();
void GetAndSendOSDMessage();
bool UserWantsToExitCanSniff = false;
DWORD progStartTime_ms;
@@ -532,7 +532,7 @@ void ProcessWindowsMessage(void) {
}
}
#if 0
// EmitBuffer
//
// Emits the provided buffer to the console, translating non-printable
@@ -579,6 +579,7 @@ void EmitBuffer(const char *prefix, const uint8_t *buf, size_t len = 0, bool app
//Console_ScrollBottomRegion();
}
}
#endif
#if 0
void EchoSerialRecv(const uint8_t *pMsg) {
@@ -838,11 +839,7 @@ void ProcessKeyboard(void) {
avr->Power(AVRInterface::AVROnOff_E::eOff);
break;
case 'O':
avr->ProcessSerialQueue("\x02" "21000" "\x03", 7);
avr->ProcessSerialQueue("\x02" "3Test" "\x03", 7);
avr->ProcessSerialQueue("\x02" "3 Mes" "\x03", 7);
avr->ProcessSerialQueue("\x02" "3sage" "\x03", 7);
avr->ProcessSerialQueue("\x02" "3 WOW" "\x03", 7);
GetAndSendOSDMessage();
break;
case ':':
GetAndSendCustomMessage();
@@ -902,6 +899,28 @@ void HexUppercase(char *p) {
}
}
void GetAndSendOSDMessage() {
char buf[MAXTEXTLEN];
Console_ScrollBottomRegion();
Console_ScrollBottomRegion();
Console_WriteAt(0, -2, "Enter OSD string to send: |________________|\rEnter OSD string to send: |");
gets_s(buf, sizeof(buf));
if (strlen(buf) == 0) {
return;
} else if (strlen(buf) > 16) {
Console_WriteAt(0, -1, " Invalid. String must be 16 chars or less");
Console_ScrollBottomRegion();
} else {
Console_ScrollBottomRegion();
if (avr->AVRSendOSDMessage(buf)) {
// success
} else {
Console_WriteAt(0, -1, " Failed to send OSD message, Invalid chars perhaps.");
Console_ScrollBottomRegion();
}
}
}
void GetAndSendCustomMessage() {
char buf[20];
char msg[30];
@@ -916,7 +935,7 @@ void GetAndSendCustomMessage() {
} else {
Console_ScrollBottomRegion();
sprintf_s(msg, sizeof(msg), "\x02%s\x03", buf);
avr->ProcessSerialQueue(msg, strlen(msg));
avr->ProcessSerialQueue(msg, (uint16_t)strlen(msg));
}
}
@@ -974,6 +993,8 @@ void InformationUpdate(AVRInterface::AVRMessageType_T type, const char *msg) {
}
}
/******************************************************/
/* m a i n ( ) */
/******************************************************/