diff --git a/lib/obp60task/OBP60Extensions.h b/lib/obp60task/OBP60Extensions.h index 4599aa3..559c79c 100644 --- a/lib/obp60task/OBP60Extensions.h +++ b/lib/obp60task/OBP60Extensions.h @@ -147,6 +147,34 @@ LGFX & getdisplay(); #define PAGE_UPDATE 1 // page wants display to update #define PAGE_HIBERNATE 2 // page wants displey to hibernate +// Draw monochrome bitmap on both E-Ink and TFT displays +// Konvertiert 1-Bit Bilder automatisch zu RGB565 für Farbdisplays +inline void drawMonochromeBitmap( + int16_t x, int16_t y, + const uint8_t *bitmap, + int16_t w, int16_t h, + uint16_t color) { + + #ifdef DISPLAY_ST7796 + // Für RGB565 TFT: Konvertierung von 1-Bit zu Pixel-Zeichnung + for (int row = 0; row < h; row++) { + for (int col = 0; col < w; col++) { + int byteIdx = (row * ((w + 7) / 8)) + (col / 8); + int bitIdx = col % 8; + uint8_t byte = bitmap[byteIdx]; + + // LSB-first format (Adafruit standard) + if (byte & (1 << bitIdx)) { + getdisplay().drawPixel(x + col, y + row, color); + } + } + } + #else + // Für E-Ink Displays: direkt drawBitmap verwenden + getdisplay().drawBitmap(x, y, bitmap, w, h, color); + #endif +} + // Display wrapper functions for E-Ink/TFT compatibility inline void displayFirstPage() { #ifdef DISPLAY_ST7796 diff --git a/lib/obp60task/obp60task.cpp b/lib/obp60task/obp60task.cpp index 93fbf9b..2293865 100644 --- a/lib/obp60task/obp60task.cpp +++ b/lib/obp60task/obp60task.cpp @@ -397,7 +397,7 @@ void OBP60Task(GwApi *api){ displayNextPage(); // Fast Refresh if(String(displaymode) == "Logo + QR Code" || String(displaymode) == "Logo"){ getdisplay().fillScreen(commonData.bgcolor); - getdisplay().drawBitmap(0, 0, gImage_Logo_OBP_400x300_sw, getdisplay().width(), getdisplay().height(), commonData.fgcolor); // Draw start logo + drawMonochromeBitmap(0, 0, gImage_Logo_OBP_400x300_sw, getdisplay().width(), getdisplay().height(), commonData.fgcolor); // Draw start logo displayNextPage(); // Fast Refresh displayNextPage(); // Fast Refresh delay(SHOW_TIME); // Logo show time