From a85f16b8965908bbdb9d41493ef4dbf44025579f Mon Sep 17 00:00:00 2001 From: stevstrong Date: Thu, 1 Sep 2016 14:11:13 +0200 Subject: [PATCH] ILI9325/8 bug: negative X2 coordinate ILI9325/8: When values 1 or 3 are passed to function setRotation(), the function setAddrWindow() will produce negative X2 coordinate. --- Adafruit_TFTLCD.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Adafruit_TFTLCD.cpp b/Adafruit_TFTLCD.cpp index 69f6a83..a97d05c 100644 --- a/Adafruit_TFTLCD.cpp +++ b/Adafruit_TFTLCD.cpp @@ -393,6 +393,7 @@ void Adafruit_TFTLCD::setAddrWindow(int x1, int y1, int x2, int y2) { case 1: t = y1; y1 = x1; + if ( y2>(TFTWIDTH-1) ) y2 = (TFTWIDTH-1); x1 = TFTWIDTH - 1 - y2; y2 = x2; x2 = TFTWIDTH - 1 - t; @@ -413,6 +414,7 @@ void Adafruit_TFTLCD::setAddrWindow(int x1, int y1, int x2, int y2) { t = x1; x1 = y1; y1 = TFTHEIGHT - 1 - x2; + if ( y2>(TFTWIDTH-1) ) y2 = (TFTWIDTH-1); x2 = y2; y2 = TFTHEIGHT - 1 - t; x = x1;