Closed tdestro closed 4 years ago
This may be related. Something seems broken with init'ing and/or passing values up the inheritance chain.
Was trying the graphicstest sketch on this: https://www.adafruit.com/product/4383 which ran, but with some weirdness that appeared to be screen size related.
Came up with this simple test sketch:
#include <Adafruit_ST7789.h>
#define TFT_CS 10
#define TFT_RST 9
#define TFT_DC 8
Adafruit_ST7789 tft = Adafruit_ST7789(TFT_CS, TFT_DC, TFT_RST);
void setup(void) {
Serial.begin(9600);
while (!Serial) {};
Serial.println(F("Hello! ST77xx TFT Test"));
tft.init(135, 240);
Serial.println(F("Initialized"));
Serial.print("width = "); Serial.println(tft.width());
Serial.print("height = "); Serial.println(tft.height());
}
void loop() {
}
which outputs this on the serial monitor:
Hello! ST77xx TFT Test
Initialized
width = 320
height = 240
Thanks for reporting this. Gonna take a look at it now.
Ok, I was able to fix it by reversing the numbers in the constructor code. I tested on the 320x240, 240x240, and 240x135 displays with that fix.
@caternuson, the issue you found is due to setRotation changing the width and height to be the raw display width and height. This is because in memory, all of the 7789 displays are 320x240 and we just show a window of them. I believe it was from an older implementation and should probably be updated to work with these displays a bit better.
nice thanks!
PR coming soon to a repo near you. ;)
I am using https://www.adafruit.com/product/4311
The example graphicstest does not recognize a portion of the screen, in order to get it to work, the dimensions need reversed inside graphicstest as well as this library in file Adafruit_ST7789.c
Please fix this so I don't have to maintain a fork, thanks.
On a completely fresh macbook pro I am using arduino ide v 1.8.11 and the newest available libraries.