added ST7789 driver
This commit is contained in:
parent
293e8a7313
commit
26c7be76df
|
|
@ -74,7 +74,7 @@ var cfgs = [
|
||||||
[ "sondehub.fimaxdist", "Import maximum distance (km, ≤ 700)" ],
|
[ "sondehub.fimaxdist", "Import maximum distance (km, ≤ 700)" ],
|
||||||
[ "sondehub.fimaxage", "Import maximum age (hours, ≤ 48)" ],
|
[ "sondehub.fimaxage", "Import maximum age (hours, ≤ 48)" ],
|
||||||
[ "", "Hardware configuration (requires reboot)", "https://github.com/dl9rdz/rdz_ttgo_sonde/wiki/Hardware-configuration"],
|
[ "", "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_sda", "OLED SDA/TFT SDA"],
|
||||||
[ "oled_scl", "OLED SCL/TFT CLK"],
|
[ "oled_scl", "OLED SCL/TFT CLK"],
|
||||||
[ "oled_rst", "OLED RST/TFT RST (needs reboot)"],
|
[ "oled_rst", "OLED RST/TFT RST (needs reboot)"],
|
||||||
|
|
|
||||||
|
|
@ -514,9 +514,11 @@ void ILI9225Display::begin() {
|
||||||
tft = new Arduino_ILI9341(bus, sonde.config.oled_rst);
|
tft = new Arduino_ILI9341(bus, sonde.config.oled_rst);
|
||||||
else if(_type == 4)
|
else if(_type == 4)
|
||||||
tft = new Arduino_ILI9342(bus, sonde.config.oled_rst);
|
tft = new Arduino_ILI9342(bus, sonde.config.oled_rst);
|
||||||
|
else if(_type == 5)
|
||||||
|
tft = new Arduino_ST7789(bus, sonde.config.oled_rst);
|
||||||
else
|
else
|
||||||
tft = new Arduino_ILI9225(bus, sonde.config.oled_rst);
|
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->begin(sonde.config.tft_spifreq);
|
||||||
tft->fillScreen(BLACK);
|
tft->fillScreen(BLACK);
|
||||||
tft->setRotation(sonde.config.tft_orient);
|
tft->setRotation(sonde.config.tft_orient);
|
||||||
|
|
@ -777,10 +779,10 @@ RawDisplay *Display::rdis = NULL;
|
||||||
//TODO: maybe merge with initFromFile later?
|
//TODO: maybe merge with initFromFile later?
|
||||||
void Display::init() {
|
void Display::init() {
|
||||||
Serial.printf("disptype is %d\n",sonde.config.disptype);
|
Serial.printf("disptype is %d\n",sonde.config.disptype);
|
||||||
if(sonde.config.disptype==1 || sonde.config.disptype==3 || sonde.config.disptype==4 ) {
|
if(sonde.config.disptype==0 || sonde.config.disptype==2) {
|
||||||
rdis = new ILI9225Display(sonde.config.disptype);
|
|
||||||
} else {
|
|
||||||
rdis = new U8x8Display(sonde.config.disptype);
|
rdis = new U8x8Display(sonde.config.disptype);
|
||||||
|
} else {
|
||||||
|
rdis = new ILI9225Display(sonde.config.disptype);
|
||||||
}
|
}
|
||||||
Serial.println("Display created");
|
Serial.println("Display created");
|
||||||
rdis->begin();
|
rdis->begin();
|
||||||
|
|
@ -1033,6 +1035,7 @@ int Display::getScreenIndex(int index) {
|
||||||
break;
|
break;
|
||||||
case 3: // ILI9341
|
case 3: // ILI9341
|
||||||
case 4: // ILI9342
|
case 4: // ILI9342
|
||||||
|
case 5:
|
||||||
index = 4; // landscape mode (orient=1/3)
|
index = 4; // landscape mode (orient=1/3)
|
||||||
if( (sonde.config.tft_orient&0x01)==0 ) index++; // portrait mode (0/2)
|
if( (sonde.config.tft_orient&0x01)==0 ) index++; // portrait mode (0/2)
|
||||||
break;
|
break;
|
||||||
|
|
@ -1154,7 +1157,9 @@ void Display::initFromFile(int index) {
|
||||||
char text[61];
|
char text[61];
|
||||||
n=sscanf(s, "%f,%f,%f", &y, &x, &w);
|
n=sscanf(s, "%f,%f,%f", &y, &x, &w);
|
||||||
sscanf(ptr+1, "%60[^\r\n]", text);
|
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].x = x;
|
||||||
newlayouts[idx].de[what].y = y;
|
newlayouts[idx].de[what].y = y;
|
||||||
newlayouts[idx].de[what].width = n>2 ? w : WIDTH_AUTO;
|
newlayouts[idx].de[what].width = n>2 ? w : WIDTH_AUTO;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
const char *version_name = "rdzTTGOsonde";
|
const char *version_name = "rdzTTGOsonde";
|
||||||
const char *version_id = "devel20220426";
|
const char *version_id = "devel20220528";
|
||||||
const int SPIFFS_MAJOR=2;
|
const int SPIFFS_MAJOR=2;
|
||||||
const int SPIFFS_MINOR=16;
|
const int SPIFFS_MINOR=16;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue