From fdc9019d99be3edae64447347afaa4f9ad628fe6 Mon Sep 17 00:00:00 2001 From: mrcodetastic <12006953+mrcodetastic@users.noreply.github.com> Date: Mon, 22 Jul 2024 13:47:02 +0100 Subject: [PATCH] Enhance GFX_LITE support --- src/ESP32-HUB75-MatrixPanel-I2S-DMA.h | 19 ++++++++++--------- src/ESP32-VirtualMatrixPanel-I2S-DMA.h | 18 ++++++++++++------ 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/src/ESP32-HUB75-MatrixPanel-I2S-DMA.h b/src/ESP32-HUB75-MatrixPanel-I2S-DMA.h index 939c421..6067e7f 100644 --- a/src/ESP32-HUB75-MatrixPanel-I2S-DMA.h +++ b/src/ESP32-HUB75-MatrixPanel-I2S-DMA.h @@ -12,11 +12,11 @@ // #include #include "platforms/platform_detect.hpp" -#ifdef USE_GFX_ROOT -#include -#include "GFX.h" // Adafruit GFX core class -> https://github.com/mrfaptastic/GFX_Root +#ifdef USE_GFX_LITE + // Slimmed version of Adafruit GFX + FastLED: https://github.com/mrcodetastc/GFX_Lite + #include "GFX_Lite.h" #elif !defined NO_GFX -#include "Adafruit_GFX.h" // Adafruit class with all the other stuff + #include "Adafruit_GFX.h" // Adafruit class with all the other stuff #endif /******************************************************************************************* @@ -366,7 +366,8 @@ struct HUB75_I2S_CFG }; // end of structure HUB75_I2S_CFG /***************************************************************************************/ -#ifdef USE_GFX_ROOT +#ifdef USE_GFX_LITE +// Slimmed version of Adafruit GFX + FastLED: https://github.com/mrcodetastic/GFX_Lite class MatrixPanel_I2S_DMA : public GFX { #elif !defined NO_GFX @@ -386,7 +387,7 @@ class MatrixPanel_I2S_DMA * */ MatrixPanel_I2S_DMA() -#ifdef USE_GFX_ROOT +#ifdef USE_GFX_LITE : GFX(MATRIX_WIDTH, MATRIX_HEIGHT) #elif !defined NO_GFX : Adafruit_GFX(MATRIX_WIDTH, MATRIX_HEIGHT) @@ -401,7 +402,7 @@ class MatrixPanel_I2S_DMA * */ MatrixPanel_I2S_DMA(const HUB75_I2S_CFG &opts) -#ifdef USE_GFX_ROOT +#ifdef USE_GFX_LITE : GFX(opts.mx_width * opts.chain_length, opts.mx_height) #elif !defined NO_GFX : Adafruit_GFX(opts.mx_width * opts.chain_length, opts.mx_height) @@ -572,7 +573,7 @@ class MatrixPanel_I2S_DMA void fillScreenRGB888(uint8_t r, uint8_t g, uint8_t b); void drawPixelRGB888(int16_t x, int16_t y, uint8_t r, uint8_t g, uint8_t b); -#ifdef USE_GFX_ROOT +#ifdef USE_GFX_LITE // 24bpp FASTLED CRGB colour struct support void fillScreen(CRGB color); void drawPixel(int16_t x, int16_t y, CRGB color); @@ -930,7 +931,7 @@ inline void MatrixPanel_I2S_DMA::fillScreenRGB888(uint8_t r, uint8_t g, uint8_t updateMatrixDMABuffer(r, g, b); // RGB only (no pixel coordinate) version of 'updateMatrixDMABuffer' } -#ifdef USE_GFX_ROOT +#ifdef USE_GFX_LITE // Support for CRGB values provided via FastLED inline void MatrixPanel_I2S_DMA::drawPixel(int16_t x, int16_t y, CRGB color) { diff --git a/src/ESP32-VirtualMatrixPanel-I2S-DMA.h b/src/ESP32-VirtualMatrixPanel-I2S-DMA.h index cf92a87..50706a4 100644 --- a/src/ESP32-VirtualMatrixPanel-I2S-DMA.h +++ b/src/ESP32-VirtualMatrixPanel-I2S-DMA.h @@ -26,10 +26,16 @@ *******************************************************************/ #include "ESP32-HUB75-MatrixPanel-I2S-DMA.h" -#ifndef NO_GFX -#include +#ifdef USE_GFX_LITE +// Slimmed version of Adafruit GFX + FastLED: https://github.com/mrcodetastic/GFX_Lite + #include "GFX_Lite.h" + #include +#elif !defined NO_GFX + #include "Adafruit_GFX.h" // Adafruit class with all the other stuff + #include #endif + // #include struct VirtualCoords @@ -67,7 +73,7 @@ enum PANEL_CHAIN_TYPE CHAIN_BOTTOM_LEFT_UP_ZZ }; -#ifdef USE_GFX_ROOT +#ifdef USE_GFX_LITE class VirtualMatrixPanel : public GFX #elif !defined NO_GFX class VirtualMatrixPanel : public Adafruit_GFX @@ -78,7 +84,7 @@ class VirtualMatrixPanel public: VirtualMatrixPanel(MatrixPanel_I2S_DMA &disp, int _vmodule_rows, int _vmodule_cols, int _panelResX, int _panelResY, PANEL_CHAIN_TYPE _panel_chain_type = CHAIN_NONE) -#ifdef USE_GFX_ROOT +#ifdef USE_GFX_LITE : GFX(_vmodule_cols * _panelResX, _vmodule_rows * _panelResY) #elif !defined NO_GFX : Adafruit_GFX(_vmodule_cols * _panelResX, _vmodule_rows * _panelResY) @@ -121,7 +127,7 @@ class VirtualMatrixPanel void clearScreen() { display->clearScreen(); } void drawPixelRGB888(int16_t x, int16_t y, uint8_t r, uint8_t g, uint8_t b); -#ifdef USE_GFX_ROOT +#ifdef USE_GFX_LITE // 24bpp FASTLED CRGB colour struct support void fillScreen(CRGB color); void drawPixel(int16_t x, int16_t y, CRGB color); @@ -459,7 +465,7 @@ inline void VirtualMatrixPanel::drawPixelRGB888(int16_t x, int16_t y, uint8_t r, this->display->drawPixelRGB888(coords.x, coords.y, r, g, b); } -#ifdef USE_GFX_ROOT +#ifdef USE_GFX_LITE // Support for CRGB values provided via FastLED inline void VirtualMatrixPanel::drawPixel(int16_t x, int16_t y, CRGB color) {