From c8f4fbb7ddb0498e83ef06dabce2e9448bb08292 Mon Sep 17 00:00:00 2001 From: Gonzalo Paniagua Javier Date: Tue, 4 Jan 2022 05:02:53 -0500 Subject: [PATCH] Honor user set values for col/row start for INITR_MINI_160X80. (#2976) If the caller sets a value for colstart and/or rowstart when using the INITR_MINI_160X80 model, use those values instead of the default 24 and 0. After this patch devices with a 160x80 TFT like the m5stick C can set row/col start (26, 1 for m5stick) and avoid garbage lines showing in the display. --- esphome/components/st7735/st7735.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/esphome/components/st7735/st7735.cpp b/esphome/components/st7735/st7735.cpp index c5178986f3..a0c2d80d16 100644 --- a/esphome/components/st7735/st7735.cpp +++ b/esphome/components/st7735/st7735.cpp @@ -265,8 +265,8 @@ void ST7735::setup() { height_ == 0 ? height_ = ST7735_TFTHEIGHT_160 : height_; width_ == 0 ? width_ = ST7735_TFTWIDTH_80 : width_; display_init_(RCMD2GREEN160X80); - colstart_ = 24; - rowstart_ = 0; // For default rotation 0 + colstart_ == 0 ? colstart_ = 24 : colstart_; + rowstart_ == 0 ? rowstart_ = 0 : rowstart_; } else { // colstart, rowstart left at default '0' values display_init_(RCMD2RED);