bugfix with FG / BG color

pull/1/head
Thomas Ballmann 4 years ago
parent 3791227d13
commit e9b0c1e3f4

@ -5,15 +5,8 @@
#include "esp_task_wdt.h"
// mapping suggestion for ESP32, e.g. LOLIN32, see .../variants/.../pins_arduino.h for your board
// NOTE: there are variants with different pins for SPI ! CHECK SPI PINS OF YOUR BOARD
// BUSY -> 4, RST -> 16, DC -> 17, CS -> SS(5), CLK -> (18), DIN -> MOSI(23), GND -> GND, 3.3V -> 3.3V
// mapping of Waveshare Universal e-Paper Raw Panel Driver Shield for Arduino / NUCLEO
// BUSY -> 7, RST -> 8, DC -> 9, CS-> 10, CLK -> 13, DIN -> 11
// base class GxEPD2_GFX can be used to pass references or pointers to the display instance as parameter, uses ~1.2k more code
// enable or disable GxEPD2_GFX base class
GxEPD2_BW<GxEPD2_750, GxEPD2_750::HEIGHT> display(GxEPD2_750(/*CS=*/5, /*DC=*/17, /*RST=*/16, /*BUSY=*/4));
GFXcanvas1 *displayCanvas;
@ -30,7 +23,10 @@ void setupDisplay()
{
Serial.println("setupDisplay");
delay(100);
//display.init(115200); TODO
display.init(115200); // TODO
display.setRotation(0);
display.setFullWindow();
display.firstPage();
displayCanvas = new GFXcanvas1(display.width(), display.height());
@ -55,12 +51,9 @@ void displayWritePixel(int16_t x, int16_t y, uint16_t color)
void displayFlush()
{
display.setRotation(0);
display.setFullWindow();
display.firstPage();
display.fillScreen(GxEPD_WHITE);
display.drawBitmap(0, 0, displayCanvas->getBuffer(), displayCanvas->width(), displayCanvas->height(), GxEPD_BLACK);
display.drawBitmap(0, 0, displayCanvas->getBuffer(), displayCanvas->width(), displayCanvas->height(), GxEPD_WHITE, GxEPD_BLACK);
display.display();
}
/*

@ -141,7 +141,7 @@ void display_calender()
const unsigned char *icon = getIconById(weatherData.current_icon, 64);
if (icon)
{
canvas->drawBitmap(72, 325, icon, 64, 64, GxEPD_WHITE);
canvas->drawBitmap(72, 325, icon, 64, 64, GxEPD_BLACK, GxEPD_WHITE);
}
// temperature

@ -72,7 +72,7 @@ void render_current()
const unsigned char *icon = getIconById(weatherData.current_icon, 256);
if (icon)
{
canvas->drawBitmap(192, 0, icon, 256, 256, GxEPD_WHITE);
canvas->drawBitmap(192, 0, icon, 256, 256, GxEPD_BLACK, GxEPD_WHITE);
}
// 250 height
@ -111,7 +111,7 @@ void render_forecast()
icon = getIconById(weatherData.forecast_1_icon, 64);
if (icon)
{
canvas->drawBitmap(0 + 48, 260, icon, 64, 64, GxEPD_WHITE);
canvas->drawBitmap(0 + 48, 260, icon, 64, 64, GxEPD_BLACK, GxEPD_WHITE);
sprintf(label, "%2d ... %2d", weatherData.forecast_1_min, weatherData.forecast_1_max);
canvas->getTextBounds(label, 0, 0, &tbx, &tby, &tbw, &tbh);
@ -124,7 +124,7 @@ void render_forecast()
icon = getIconById(weatherData.forecast_2_icon, 64);
if (icon)
{
canvas->drawBitmap(160 + 48, 260, icon, 64, 64, GxEPD_WHITE);
canvas->drawBitmap(160 + 48, 260, icon, 64, 64, GxEPD_BLACK, GxEPD_WHITE);
sprintf(label, "%2d ... %2d", weatherData.forecast_2_min, weatherData.forecast_2_max);
canvas->getTextBounds(label, 0, 0, &tbx, &tby, &tbw, &tbh);
@ -137,7 +137,7 @@ void render_forecast()
icon = getIconById(weatherData.forecast_3_icon, 64);
if (icon)
{
canvas->drawBitmap(320 + 48, 260, icon, 64, 64, GxEPD_WHITE);
canvas->drawBitmap(320 + 48, 260, icon, 64, 64, GxEPD_BLACK, GxEPD_WHITE);
sprintf(label, "%2d ... %2d", weatherData.forecast_3_min, weatherData.forecast_3_max);
canvas->getTextBounds(label, 0, 0, &tbx, &tby, &tbw, &tbh);
@ -150,7 +150,7 @@ void render_forecast()
icon = getIconById(weatherData.forecast_4_icon, 64);
if (icon)
{
canvas->drawBitmap(480 + 48, 260, icon, 64, 64, GxEPD_WHITE);
canvas->drawBitmap(480 + 48, 260, icon, 64, 64, GxEPD_BLACK, GxEPD_WHITE);
sprintf(label, "%2d ... %2d", weatherData.forecast_4_min, weatherData.forecast_4_max);
canvas->getTextBounds(label, 0, 0, &tbx, &tby, &tbw, &tbh);

Loading…
Cancel
Save