diff --git a/mos.yml b/mos.yml index 9353aa1..9b2477b 100644 --- a/mos.yml +++ b/mos.yml @@ -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"] diff --git a/src/main.c b/src/main.c index a1a4636..87a92e7 100644 --- a/src/main.c +++ b/src/main.c @@ -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();