mirror of
https://github.com/justcallmekoko/ESP32Marauder.git
synced 2025-12-12 07:40:58 -08:00
Fix packet monitor for non ILI9341
This commit is contained in:
@@ -283,11 +283,42 @@ void Display::scrollScreenBuffer(bool down) {
|
||||
}
|
||||
#endif
|
||||
|
||||
void Display::processAndPrintString(TFT_eSPI& tft, const String& originalString) {
|
||||
// Define colors
|
||||
uint16_t text_color = TFT_GREEN; // Default text color
|
||||
uint16_t background_color = TFT_BLACK; // Default background color
|
||||
|
||||
String new_string = originalString;
|
||||
|
||||
// Check for color macros at the start of the string
|
||||
if (new_string.startsWith(RED_KEY)) {
|
||||
text_color = TFT_RED;
|
||||
new_string.remove(0, strlen(RED_KEY)); // Remove the macro
|
||||
} else if (new_string.startsWith(GREEN_KEY)) {
|
||||
text_color = TFT_GREEN;
|
||||
new_string.remove(0, strlen(GREEN_KEY)); // Remove the macro
|
||||
} else if (new_string.startsWith(CYAN_KEY)) {
|
||||
text_color = TFT_CYAN;
|
||||
new_string.remove(0, strlen(CYAN_KEY)); // Remove the macro
|
||||
} else if (new_string.startsWith(WHITE_KEY)) {
|
||||
text_color = TFT_WHITE;
|
||||
new_string.remove(0, strlen(WHITE_KEY)); // Remove the macro
|
||||
} else if (new_string.startsWith(MAGENTA_KEY)) {
|
||||
text_color = TFT_MAGENTA;
|
||||
new_string.remove(0, strlen(MAGENTA_KEY)); // Remove the macro
|
||||
}
|
||||
|
||||
// Set text color and print the string
|
||||
tft.setTextColor(text_color, background_color);
|
||||
tft.print(new_string);
|
||||
}
|
||||
|
||||
void Display::displayBuffer(bool do_clear)
|
||||
{
|
||||
if (this->display_buffer->size() > 0)
|
||||
{
|
||||
while (display_buffer->size() > 0)
|
||||
int print_count = 10;
|
||||
while ((display_buffer->size() > 0) && (print_count > 0))
|
||||
{
|
||||
|
||||
#ifndef SCREEN_BUFFER
|
||||
@@ -319,10 +350,14 @@ void Display::displayBuffer(bool do_clear)
|
||||
for (int x = 0; x < TFT_WIDTH / CHAR_WIDTH; x++)
|
||||
tft.print(" ");
|
||||
tft.setCursor(xPos, (i * 12) + (SCREEN_HEIGHT / 6));
|
||||
tft.setTextColor(TFT_GREEN, TFT_BLACK);
|
||||
tft.print(this->screen_buffer->get(i));
|
||||
|
||||
this->processAndPrintString(tft, this->screen_buffer->get(i));
|
||||
//tft.setTextColor(TFT_GREEN, TFT_BLACK);
|
||||
//tft.print(this->screen_buffer->get(i));
|
||||
}
|
||||
#endif
|
||||
|
||||
print_count--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user