mirror of
https://github.com/thooge/esp32-nmea2000-obp60.git
synced 2026-08-18 10:22:31 +02:00
Fix black background
This commit is contained in:
@@ -105,8 +105,8 @@ public:
|
|||||||
cfg.pin_busy = -1;
|
cfg.pin_busy = -1;
|
||||||
cfg.panel_width = 320; // Native width resolution
|
cfg.panel_width = 320; // Native width resolution
|
||||||
cfg.panel_height = 480; // Native hight resolution
|
cfg.panel_height = 480; // Native hight resolution
|
||||||
cfg.offset_x = 10; // Display output 400x300 pix to housing center adjusted
|
cfg.offset_x = 0; // No panel offset: full framebuffer mapping
|
||||||
cfg.offset_y = -20; // Display output 400x300 pix to housing center adjusted
|
cfg.offset_y = 0; // No panel offset: full framebuffer mapping
|
||||||
cfg.offset_rotation = 3; // Rotate display content conter clock wise 90 deg
|
cfg.offset_rotation = 3; // Rotate display content conter clock wise 90 deg
|
||||||
cfg.dummy_read_pixel = 8;
|
cfg.dummy_read_pixel = 8;
|
||||||
cfg.dummy_read_bits = 1;
|
cfg.dummy_read_bits = 1;
|
||||||
@@ -260,6 +260,20 @@ public:
|
|||||||
// E-Ink interface compatibility
|
// E-Ink interface compatibility
|
||||||
void setFullWindow() { /* no-op on TFT */ }
|
void setFullWindow() { /* no-op on TFT */ }
|
||||||
|
|
||||||
|
// Runtime panel offset control (ST7796)
|
||||||
|
void setPanelOffset(int16_t x, int16_t y) {
|
||||||
|
auto cfg = _panel_instance.config();
|
||||||
|
cfg.offset_x = x;
|
||||||
|
cfg.offset_y = y;
|
||||||
|
_panel_instance.config(cfg);
|
||||||
|
}
|
||||||
|
|
||||||
|
void getPanelOffset(int16_t &x, int16_t &y) {
|
||||||
|
auto cfg = _panel_instance.config();
|
||||||
|
x = cfg.offset_x;
|
||||||
|
y = cfg.offset_y;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
lgfx::GFXfont _adfFontBridge { nullptr, nullptr, 0, 0, 0 };
|
lgfx::GFXfont _adfFontBridge { nullptr, nullptr, 0, 0, 0 };
|
||||||
lgfx::GFXglyph* _adfGlyphBridge = nullptr;
|
lgfx::GFXglyph* _adfGlyphBridge = nullptr;
|
||||||
@@ -494,7 +508,7 @@ inline void displayFirstPage() {
|
|||||||
inline void displayNextPage() {
|
inline void displayNextPage() {
|
||||||
#ifdef DISPLAY_ST7796
|
#ifdef DISPLAY_ST7796
|
||||||
if (initDisplayShadowBuffer()) {
|
if (initDisplayShadowBuffer()) {
|
||||||
getdisplay().pushSprite(0, 0);
|
getdisplay().pushSprite((480 - GxEPD_WIDTH) / 2, (320 - GxEPD_HEIGHT) / 2);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
getdisplay().nextPage();
|
getdisplay().nextPage();
|
||||||
|
|||||||
@@ -41,6 +41,8 @@
|
|||||||
#define OBP_SPI_BUSY 42
|
#define OBP_SPI_BUSY 42
|
||||||
#define OBP_SPI_CLK 38
|
#define OBP_SPI_CLK 38
|
||||||
#define OBP_SPI_DIN 48
|
#define OBP_SPI_DIN 48
|
||||||
|
#define OBP_TFT_OFFSET_X 10 // ST7796 operating x-offset for centered 400x300 content
|
||||||
|
#define OBP_TFT_OFFSET_Y -20 // ST7796 operating y-offset for centered 400x300 content
|
||||||
#define SHOW_TIME 6000 // Show time in [ms] for logo and WiFi QR code
|
#define SHOW_TIME 6000 // Show time in [ms] for logo and WiFi QR code
|
||||||
#define FULL_REFRESH_TIME 600 // Refresh cycle time in [s][600...3600] for full display update (very important healcy function)
|
#define FULL_REFRESH_TIME 600 // Refresh cycle time in [s][600...3600] for full display update (very important healcy function)
|
||||||
#define GxEPD_WIDTH 400 // Display width
|
#define GxEPD_WIDTH 400 // Display width
|
||||||
|
|||||||
@@ -391,7 +391,9 @@ void OBP60Task(GwApi *api){
|
|||||||
|
|
||||||
#ifdef DISPLAY_ST7796
|
#ifdef DISPLAY_ST7796
|
||||||
getpaneldisplay().setRotation(0); // Set display orientation (horizontal)
|
getpaneldisplay().setRotation(0); // Set display orientation (horizontal)
|
||||||
|
getpaneldisplay().setPanelOffset(0, 0); // Use full native framebuffer coordinates
|
||||||
getpaneldisplay().fillScreen(0x0000); // Initialize full TFT screen to black (native RGB565)
|
getpaneldisplay().fillScreen(0x0000); // Initialize full TFT screen to black (native RGB565)
|
||||||
|
getpaneldisplay().setPanelOffset(OBP_TFT_OFFSET_X, OBP_TFT_OFFSET_Y); // Restore centered 400x300 operating offset
|
||||||
#else
|
#else
|
||||||
getdisplay().setRotation(0); // Set display orientation (horizontal)
|
getdisplay().setRotation(0); // Set display orientation (horizontal)
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user