Make screen work at 480x320 as well as 320x240

This commit is contained in:
Pim van Pelt
2017-12-07 01:28:27 +01:00
parent 7c3f699275
commit 7ba19c8372
2 changed files with 7 additions and 2 deletions

View File

@ -33,6 +33,10 @@ config_schema:
- ["tft", "o", {title: "TFT settings"}]
- ["tft.orientation", "i", {title: "Orientation; 0=PORTRAIT 1=LANDSCAPE 2=PORTRAIT_FLIP 3=LANDSCAPE_FLIP"}]
- ["tft.orientation", 1 ]
- ["tft.width", "i", {title: "TFT width in pixels"}]
- ["tft.height", "i", {title: "TFT height in pixels"}]
- ["tft.width", 480] # Set to 320 for 2.4" Featherwing, set to 480 for 3.5" Featherwing
- ["tft.height", 320] # Set to 240 for 2.4" Featherwing, set to 320 for 3.5" Featherwing
- ["app", "o", {title: "APP settings"}]
- ["app.hostname", "s", {title: "Device hostname"}]
- ["app.hostname", "Mongoose Touch"]
@ -47,6 +51,7 @@ config_schema:
- ["spi.cs2_gpio", -1]
- ["ili9341.cs_index", 0]
- ["stmpe610.cs_index", 1]
- ["stmpe610.orientation", 5] # Set to 4 for 2.4" Featherwing, set to 5 for 3.5" Featherwing
- ["mqtt.enable", true]
- ["mqtt.server", "chbtl01.paphosting.net:1883"]

View File

@ -44,10 +44,10 @@ static void touch_handler(struct mgos_stmpe610_event_data *ed) {
void tft_demo(void)
{
mgos_ili9341_set_dimensions(mgos_sys_config_get_tft_width(), mgos_sys_config_get_tft_height());
mgos_ili9341_set_rotation(mgos_sys_config_get_tft_orientation());
mgos_stmpe610_set_rotation(mgos_sys_config_get_tft_orientation());
mgos_stmpe610_set_handler(touch_handler);
mgos_stmpe610_set_dimensions(320, 240);
mgos_stmpe610_set_dimensions(mgos_ili9341_get_screenWidth(), mgos_ili9341_get_screenHeight());
mgos_ili9341_set_fgcolor(0,0,0);
mgos_ili9341_fillScreen();