From c8530d7ae46342236324637bcfb2ed612ca6a51a Mon Sep 17 00:00:00 2001 From: Bodmer Date: Sat, 1 Feb 2020 01:43:16 +0000 Subject: [PATCH] 4 bpp Sprite bug fix OR has precedence over AND so brackets needed. Remove unused varaible. --- Extensions/Sprite.cpp | 5 ++--- TFT_eSPI.h | 2 +- library.json | 2 +- library.properties | 2 +- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/Extensions/Sprite.cpp b/Extensions/Sprite.cpp index 092bc4b..8cc0773 100644 --- a/Extensions/Sprite.cpp +++ b/Extensions/Sprite.cpp @@ -831,7 +831,6 @@ uint8_t TFT_eSprite::readPixelValue(int32_t x, int32_t y) if (_bpp == 4) { - uint16_t color; if ((x & 0x01) == 0) return ((_img4[((x+y*_iwidth)>>1)] & 0xF0) >> 4) & 0x0F; // even index = bits 7 .. 4 else @@ -1639,14 +1638,14 @@ void TFT_eSprite::drawFastVLine(int32_t x, int32_t y, int32_t h, uint32_t color) { uint8_t c = (uint8_t) (color & 0xF) << 4; while (h--) { - _img4[(x + _iwidth * y)>>1] = (uint8_t) (c | _img4[(x + _iwidth * y)>>1] & 0x0F); + _img4[(x + _iwidth * y)>>1] = (uint8_t) (c | (_img4[(x + _iwidth * y)>>1] & 0x0F)); y++; } } else { uint8_t c = (uint8_t)color & 0xF; while (h--) { - _img4[(x - 1 + _iwidth * y)>>1] = (uint8_t) (c | _img4[(x - 1 + _iwidth * y)>>1] & 0xF0); // x is odd; new color goes into the low bits. + _img4[(x - 1 + _iwidth * y)>>1] = (uint8_t) (c | (_img4[(x - 1 + _iwidth * y)>>1] & 0xF0)); // x is odd; new color goes into the low bits. y++; } } diff --git a/TFT_eSPI.h b/TFT_eSPI.h index ed5db6c..b996fe1 100644 --- a/TFT_eSPI.h +++ b/TFT_eSPI.h @@ -16,7 +16,7 @@ #ifndef _TFT_eSPIH_ #define _TFT_eSPIH_ -#define TFT_ESPI_VERSION "2.0.1" +#define TFT_ESPI_VERSION "2.0.2" /*************************************************************************************** ** Section 1: Load required header files diff --git a/library.json b/library.json index 091a89f..2ee491f 100644 --- a/library.json +++ b/library.json @@ -1,6 +1,6 @@ { "name": "TFT_eSPI", - "version": "2.0.1", + "version": "2.0.2", "keywords": "Arduino, tft, ePaper, display, STM32, ESP8266, NodeMCU, ESP32, M5Stack, ILI9341, ST7735, ILI9163, S6D02A1, ILI9486, ST7789, RM68140", "description": "A TFT and ePaper SPI graphics library with optimisation for ESP8266, ESP32 and STM32", "repository": diff --git a/library.properties b/library.properties index 97dd1d7..f9c169c 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=TFT_eSPI -version=2.0.1 +version=2.0.2 author=Bodmer maintainer=Bodmer sentence=TFT graphics library for Arduino processors with performance optimisation for STM32, ESP8266 and ESP32