Merge pull request #572 from Lukaswnd/master

NO_GFX fixes for VirtualPanel and width/height
This commit is contained in:
mrfaptastic 2024-01-18 15:19:50 +00:00 committed by GitHub
commit 1e4c80a264
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 13 additions and 0 deletions

View file

@ -571,6 +571,11 @@ public:
void drawPixel(int16_t x, int16_t y, CRGB color);
#endif
#ifdef NO_GFX
inline int16_t width() const { return m_cfg.mx_width * m_cfg.chain_length; }
inline int16_t height() const { return m_cfg.mx_height; }
#endif
void drawIcon(int *ico, int16_t x, int16_t y, int16_t cols, int16_t rows);
// Colour 444 is a 4 bit scale, so 0 to 15, colour 565 takes a 0-255 bit value, so scale up by 255/15 (i.e. 17)!

View file

@ -124,6 +124,11 @@ public:
void drawPixel(int16_t x, int16_t y, CRGB color);
#endif
#ifdef NO_GFX
inline int16_t width() const { return _virtualResX; }
inline int16_t height() const { return _virtualResY; }
#endif
uint16_t color444(uint8_t r, uint8_t g, uint8_t b)
{
return display->color444(r, g, b);
@ -479,6 +484,9 @@ inline void VirtualMatrixPanel::setRotation(uint8_t rotate)
// Change the _width and _height variables used by the underlying adafruit gfx library.
// Actual pixel rotation / mapping is done in the getCoords function.
#ifdef NO_GFX
int8_t rotation;
#endif
rotation = (rotate & 3);
switch (rotation) {
case 0: // nothing