mirror of
https://github.com/thooge/esp32-nmea2000-obp60.git
synced 2026-08-18 18:32:30 +02:00
Fix image problem with 1Bit images
This commit is contained in:
@@ -147,6 +147,34 @@ LGFX & getdisplay();
|
|||||||
#define PAGE_UPDATE 1 // page wants display to update
|
#define PAGE_UPDATE 1 // page wants display to update
|
||||||
#define PAGE_HIBERNATE 2 // page wants displey to hibernate
|
#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
|
// Display wrapper functions for E-Ink/TFT compatibility
|
||||||
inline void displayFirstPage() {
|
inline void displayFirstPage() {
|
||||||
#ifdef DISPLAY_ST7796
|
#ifdef DISPLAY_ST7796
|
||||||
|
|||||||
@@ -397,7 +397,7 @@ void OBP60Task(GwApi *api){
|
|||||||
displayNextPage(); // Fast Refresh
|
displayNextPage(); // Fast Refresh
|
||||||
if(String(displaymode) == "Logo + QR Code" || String(displaymode) == "Logo"){
|
if(String(displaymode) == "Logo + QR Code" || String(displaymode) == "Logo"){
|
||||||
getdisplay().fillScreen(commonData.bgcolor);
|
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
|
||||||
displayNextPage(); // Fast Refresh
|
displayNextPage(); // Fast Refresh
|
||||||
delay(SHOW_TIME); // Logo show time
|
delay(SHOW_TIME); // Logo show time
|
||||||
|
|||||||
Reference in New Issue
Block a user