Merge pull request #659 from mrcodetastic/dev

Dev
This commit is contained in:
mrcodetastic 2024-07-22 13:52:20 +01:00 committed by GitHub
commit 96ee0204e7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 22 additions and 15 deletions

View file

@ -12,9 +12,9 @@
// #include <Arduino.h> // #include <Arduino.h>
#include "platforms/platform_detect.hpp" #include "platforms/platform_detect.hpp"
#ifdef USE_GFX_ROOT #ifdef USE_GFX_LITE
#include <FastLED.h> // Slimmed version of Adafruit GFX + FastLED: https://github.com/mrcodetastic/GFX_Lite
#include "GFX.h" // Adafruit GFX core class -> https://github.com/mrfaptastic/GFX_Root #include "GFX_Lite.h"
#elif !defined NO_GFX #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 #endif
@ -366,7 +366,8 @@ private:
}; // end of structure 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 class MatrixPanel_I2S_DMA : public GFX
{ {
#elif !defined NO_GFX #elif !defined NO_GFX
@ -386,7 +387,7 @@ public:
* *
*/ */
MatrixPanel_I2S_DMA() MatrixPanel_I2S_DMA()
#ifdef USE_GFX_ROOT #ifdef USE_GFX_LITE
: GFX(MATRIX_WIDTH, MATRIX_HEIGHT) : GFX(MATRIX_WIDTH, MATRIX_HEIGHT)
#elif !defined NO_GFX #elif !defined NO_GFX
: Adafruit_GFX(MATRIX_WIDTH, MATRIX_HEIGHT) : Adafruit_GFX(MATRIX_WIDTH, MATRIX_HEIGHT)
@ -401,7 +402,7 @@ public:
* *
*/ */
MatrixPanel_I2S_DMA(const HUB75_I2S_CFG &opts) 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) : GFX(opts.mx_width * opts.chain_length, opts.mx_height)
#elif !defined NO_GFX #elif !defined NO_GFX
: Adafruit_GFX(opts.mx_width * opts.chain_length, opts.mx_height) : Adafruit_GFX(opts.mx_width * opts.chain_length, opts.mx_height)
@ -572,7 +573,7 @@ public:
void fillScreenRGB888(uint8_t r, uint8_t g, uint8_t b); 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); 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 // 24bpp FASTLED CRGB colour struct support
void fillScreen(CRGB color); void fillScreen(CRGB color);
void drawPixel(int16_t x, int16_t y, 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' 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 // Support for CRGB values provided via FastLED
inline void MatrixPanel_I2S_DMA::drawPixel(int16_t x, int16_t y, CRGB color) inline void MatrixPanel_I2S_DMA::drawPixel(int16_t x, int16_t y, CRGB color)
{ {

View file

@ -26,10 +26,16 @@
*******************************************************************/ *******************************************************************/
#include "ESP32-HUB75-MatrixPanel-I2S-DMA.h" #include "ESP32-HUB75-MatrixPanel-I2S-DMA.h"
#ifndef NO_GFX #ifdef USE_GFX_LITE
// Slimmed version of Adafruit GFX + FastLED: https://github.com/mrcodetastic/GFX_Lite
#include "GFX_Lite.h"
#include <Fonts/FreeSansBold12pt7b.h>
#elif !defined NO_GFX
#include "Adafruit_GFX.h" // Adafruit class with all the other stuff
#include <Fonts/FreeSansBold12pt7b.h> #include <Fonts/FreeSansBold12pt7b.h>
#endif #endif
// #include <iostream> // #include <iostream>
struct VirtualCoords struct VirtualCoords
@ -67,7 +73,7 @@ enum PANEL_CHAIN_TYPE
CHAIN_BOTTOM_LEFT_UP_ZZ CHAIN_BOTTOM_LEFT_UP_ZZ
}; };
#ifdef USE_GFX_ROOT #ifdef USE_GFX_LITE
class VirtualMatrixPanel : public GFX class VirtualMatrixPanel : public GFX
#elif !defined NO_GFX #elif !defined NO_GFX
class VirtualMatrixPanel : public Adafruit_GFX class VirtualMatrixPanel : public Adafruit_GFX
@ -78,7 +84,7 @@ class VirtualMatrixPanel
public: public:
VirtualMatrixPanel(MatrixPanel_I2S_DMA &disp, int _vmodule_rows, int _vmodule_cols, int _panelResX, int _panelResY, PANEL_CHAIN_TYPE _panel_chain_type = CHAIN_NONE) 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) : GFX(_vmodule_cols * _panelResX, _vmodule_rows * _panelResY)
#elif !defined NO_GFX #elif !defined NO_GFX
: Adafruit_GFX(_vmodule_cols * _panelResX, _vmodule_rows * _panelResY) : Adafruit_GFX(_vmodule_cols * _panelResX, _vmodule_rows * _panelResY)
@ -121,7 +127,7 @@ public:
void clearScreen() { display->clearScreen(); } void clearScreen() { display->clearScreen(); }
void drawPixelRGB888(int16_t x, int16_t y, 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 // 24bpp FASTLED CRGB colour struct support
void fillScreen(CRGB color); void fillScreen(CRGB color);
void drawPixel(int16_t x, int16_t y, 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); 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 // Support for CRGB values provided via FastLED
inline void VirtualMatrixPanel::drawPixel(int16_t x, int16_t y, CRGB color) inline void VirtualMatrixPanel::drawPixel(int16_t x, int16_t y, CRGB color)
{ {