added ST7789 driver

pull/354/head
Hansi, dl9rdz 2022-05-29 10:28:33 +00:00
rodzic 293e8a7313
commit 26c7be76df
3 zmienionych plików z 12 dodań i 7 usunięć

Wyświetl plik

@ -74,7 +74,7 @@ var cfgs = [
[ "sondehub.fimaxdist", "Import maximum distance (km, ≤ 700)" ],
[ "sondehub.fimaxage", "Import maximum age (hours, ≤ 48)" ],
[ "", "Hardware configuration (requires reboot)", "https://github.com/dl9rdz/rdz_ttgo_sonde/wiki/Hardware-configuration"],
[ "disptype", "Display type (0=OLED/SSD1306, 1=ILI9225, 2=OLED/SH1106, 3=ILI9341, 4=ILI9342)"],
[ "disptype", "Display type (0=OLED/SSD1306, 1=ILI9225, 2=OLED/SH1106, 3=ILI9341, 4=ILI9342, 5=ST7789)"],
[ "oled_sda", "OLED SDA/TFT SDA"],
[ "oled_scl", "OLED SCL/TFT CLK"],
[ "oled_rst", "OLED RST/TFT RST (needs reboot)"],

Wyświetl plik

@ -514,9 +514,11 @@ void ILI9225Display::begin() {
tft = new Arduino_ILI9341(bus, sonde.config.oled_rst);
else if(_type == 4)
tft = new Arduino_ILI9342(bus, sonde.config.oled_rst);
else if(_type == 5)
tft = new Arduino_ST7789(bus, sonde.config.oled_rst);
else
tft = new Arduino_ILI9225(bus, sonde.config.oled_rst);
Serial.println("ILI9225/ILI9341 init: done");
Serial.println("ILI9225/ILI9341/ST7789 init: done");
tft->begin(sonde.config.tft_spifreq);
tft->fillScreen(BLACK);
tft->setRotation(sonde.config.tft_orient);
@ -777,10 +779,10 @@ RawDisplay *Display::rdis = NULL;
//TODO: maybe merge with initFromFile later?
void Display::init() {
Serial.printf("disptype is %d\n",sonde.config.disptype);
if(sonde.config.disptype==1 || sonde.config.disptype==3 || sonde.config.disptype==4 ) {
rdis = new ILI9225Display(sonde.config.disptype);
} else {
if(sonde.config.disptype==0 || sonde.config.disptype==2) {
rdis = new U8x8Display(sonde.config.disptype);
} else {
rdis = new ILI9225Display(sonde.config.disptype);
}
Serial.println("Display created");
rdis->begin();
@ -1033,6 +1035,7 @@ int Display::getScreenIndex(int index) {
break;
case 3: // ILI9341
case 4: // ILI9342
case 5:
index = 4; // landscape mode (orient=1/3)
if( (sonde.config.tft_orient&0x01)==0 ) index++; // portrait mode (0/2)
break;
@ -1154,7 +1157,9 @@ void Display::initFromFile(int index) {
char text[61];
n=sscanf(s, "%f,%f,%f", &y, &x, &w);
sscanf(ptr+1, "%60[^\r\n]", text);
if(sonde.config.disptype==1 || sonde.config.disptype==3 || sonde.config.disptype==4 ) { x*=xscale; y*=yscale; w*=xscale; }
if(sonde.config.disptype!=0 && sonde.config.disptype!=2) {
x*=xscale; y*=yscale; w*=xscale;
}
newlayouts[idx].de[what].x = x;
newlayouts[idx].de[what].y = y;
newlayouts[idx].de[what].width = n>2 ? w : WIDTH_AUTO;

Wyświetl plik

@ -1,4 +1,4 @@
const char *version_name = "rdzTTGOsonde";
const char *version_id = "devel20220426";
const char *version_id = "devel20220528";
const int SPIFFS_MAJOR=2;
const int SPIFFS_MINOR=16;