Update
Some checks failed
Build Firmware / build (push) Has been cancelled

This commit is contained in:
2025-11-05 22:07:44 +01:00
parent b54e5ef8a5
commit 5416c3a041
28 changed files with 273 additions and 963 deletions

View File

@@ -38,84 +38,47 @@ void UI_DisplayMessages(void) {
6);
}
} else {
uint8_t Data[8];
EEPROM_ReadBuffer(SEQParameterEEPROM, Data, 8);
uint8_t msgIndex = Data[1]; // index of latest written message
// Determine oldest message index (next to be overwritten)
uint8_t startIndex = (msgIndex + 1) % MESSAGES_COUNT;
String[0] = 'M';
String[1] = 'S';
String[2] = 'G';
String[3] = ' ';
// Each bank shows 3 messages
uint8_t messagesPerPage = 3;
for (size_t i = 8; i < 14; i++) {
String[i] = ' ';
// Compute offset for scrolling (0 = newest, higher = older)
uint8_t pageOffset = gActiveMessageBank * messagesPerPage;
for (uint8_t ixa = 0; ixa < messagesPerPage; ixa++) {
// Logical order from oldest to newest
uint8_t logicalIndex = (startIndex + pageOffset + ixa) % MESSAGES_COUNT;
// If out of stored range, stop
if (pageOffset + ixa >= MESSAGES_COUNT)
break;
gActiveMessage = logicalIndex;
MESSAGES_GET();
// Build the display string
u32_to_str(gActiveMessage == MESSAGES_COUNT ? dataPacket.dest : loadedPacket.src, &String[0]);
String[10] = '-';
u8_to_str(loadedPacket.seq, &String[11]);
String[14] = '-';
// Display a visual index (0,1,2,3... not EEPROM slot)
uint8_t visualIndex = ixa + (gActiveMessageBank * 3);
String[15] = (visualIndex < 10) ? ('0' + visualIndex) : ('A' + visualIndex - 10);
String[16] = '-';
String[17] = (gActiveMessage < 10) ? ('0' + gActiveMessage) : ('A' + gActiveMessage - 10);
String[18] = 0;
// Print both metadata and message
UI_PrintString(String, 2, 0, ixa * 2);
UI_PrintString((const char *) loadedPacket.data, 2, 0, ixa * 2 + 1);
}
String[4] = 'F';
String[5] = 'l';
String[6] = 'g';
String[7] = 's';
String[8] = ':';
String[9] = ' ';
u8_to_str(loadedPacket.flags, &String[10]); // Write at offset 7
String[13] = ' ';
if (gActiveMessage == MESSAGES_COUNT) {
String[14] = 'T';
} else {
String[14] = '0' + gActiveMessage;
}
String[15] = '/';
String[16] = '0' + MESSAGES_COUNT;
String[17] = 0;
UI_PrintString(String, 2, 0, 0 /*, 8 */);
String[5] = ' ';
if (gActiveMessage == MESSAGES_COUNT) {
String[0] = 'T';
String[1] = 'o';
String[2] = ':';
String[3] = ' ';
String[4] = ' ';
} else {
String[0] = 'F';
String[1] = 'r';
String[2] = 'o';
String[3] = 'm';
String[4] = ':';
}
u32_to_str(gActiveMessage == MESSAGES_COUNT ? dataPacket.dest : loadedPacket.src,
&String[6]); // Write at offset 6
UI_PrintString(String, 2, 0, 1 /*, 8 */);
String[0] = 'S';
String[1] = 'E';
String[2] = 'Q';
String[3] = ':';
String[4] = ' ';
u8_to_str(loadedPacket.seq, &String[5]); // Write at offset 5
String[8] = ' ';
String[9] = 'T';
String[10] = 'T';
String[11] = 'L';
String[12] = ':';
String[13] = ' ';
String[14] = 0;
u8_to_str(loadedPacket.ttl, &String[14]); // Write at new offset
UI_PrintString(String, 2, 0, 2 /*, 8 */);
char String2[13] = "Data: ";
if (gGotACK) {
String2[6] = 'G';
String2[7] = 'o';
String2[8] = 't';
String2[9] = 'A';
String2[10] = 'C';
String2[11] = 'K';
}
String2[12] = 0;
UI_PrintString(String2, 0, 0, 3 /*, 8 */);
UI_PrintString((const char *) loadedPacket.data, 2, 0, 4 /*, 8 */);
}
ST7565_BlitFullScreen();
}