Add tft.enable flag, gate the use of ILI9341/STMPE610 on it.

- For esp8266 (lightswitch w/o touchscreen), set tft.enable=false
- For esp32 (lightswitch w/ touchscreen), set it to true.

Clean up mos.yml flags per architecture type.
- Button is always 0,2
- Relay0 at 16 for ESP8266, as that's NodeMCU v2's onboard LED.
- Relay0 at 13 for ESP32, as that's Featherwing's onboard LED
This commit is contained in:
Pim van Pelt
2017-12-22 10:23:15 +01:00
parent 44a84dd1bc
commit ecf0a9a2fc
2 changed files with 17 additions and 8 deletions

View File

@ -47,7 +47,7 @@ static void touch_handler(struct mgos_stmpe610_event_data *ed) {
}
}
void tft_demo(void)
static void tft_init(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());
@ -65,6 +65,8 @@ void tft_demo(void)
screen_add_default_widgets(s_screen);
screen_widget_broadcast(s_screen, EV_WIDGET_DRAW, NULL);
LOG(LL_INFO, ("Screen '%s' has %d widgets", s_screen->name, screen_get_num_widgets(s_screen)));
backlight_init();
}
enum mgos_app_init_result mgos_app_init(void)
@ -73,9 +75,9 @@ enum mgos_app_init_result mgos_app_init(void)
relays_init(mgos_sys_config_get_app_relays());
mqtt_init();
rpc_init();
backlight_init();
tft_demo();
if (mgos_sys_config_get_tft_enable())
tft_init();
return MGOS_APP_INIT_SUCCESS;
}