Boot apps refactored (#498)

- Specify launcher via menuconfig
- Specify auto-start app via menuconfig
- Implement more rigid boot.properties fallbacks
- Devices with tiny screen now auto-start ApWebServer
- ApWebServer UI fixes
This commit is contained in:
Ken Van Hoeylandt
2026-02-12 00:10:04 +01:00
committed by GitHub
parent 49632d15c9
commit 8ff990d635
53 changed files with 243 additions and 35 deletions
@@ -44,18 +44,30 @@ public:
lv_obj_set_style_text_color(labelSsid, lv_palette_main(LV_PALETTE_GREY), LV_PART_MAIN);
labelSsidValue = lv_label_create(wrapper);
lv_obj_set_style_text_align(labelSsidValue, LV_TEXT_ALIGN_CENTER, LV_PART_MAIN);
lv_obj_set_width(labelSsidValue, LV_PCT(100));
lv_label_set_long_mode(labelSsidValue, LV_LABEL_LONG_SCROLL);
lv_obj_set_style_margin_hor(labelSsidValue, 2, LV_PART_MAIN);
lv_obj_t* labelPassword = lv_label_create(wrapper);
lv_label_set_text(labelPassword, "Pass:");
lv_obj_set_style_text_color(labelPassword, lv_palette_main(LV_PALETTE_GREY), LV_PART_MAIN);
labelPasswordValue = lv_label_create(wrapper);
lv_obj_set_style_text_align(labelPasswordValue, LV_TEXT_ALIGN_CENTER, LV_PART_MAIN);
lv_obj_set_width(labelPasswordValue, LV_PCT(100));
lv_label_set_long_mode(labelPasswordValue, LV_LABEL_LONG_SCROLL);
lv_obj_set_style_margin_hor(labelPasswordValue, 2, LV_PART_MAIN);
lv_obj_t* labelIp = lv_label_create(wrapper);
lv_label_set_text(labelIp, "IP:");
lv_obj_set_style_text_color(labelIp, lv_palette_main(LV_PALETTE_GREY), LV_PART_MAIN);
labelIpValue = lv_label_create(wrapper);
lv_obj_set_style_text_align(labelIpValue, LV_TEXT_ALIGN_CENTER, LV_PART_MAIN);
lv_obj_set_width(labelIpValue, LV_PCT(100));
lv_label_set_long_mode(labelIpValue, LV_LABEL_LONG_SCROLL);
lv_obj_set_style_margin_hor(labelIpValue, 2, LV_PART_MAIN);
// Start AP Mode and WebServer
settings::webserver::WebServerSettings apSettings = wsSettings;
+24 -10
View File
@@ -130,6 +130,29 @@ class BootApp : public App {
return 0;
}
static std::string getLauncherAppId() {
settings::BootSettings boot_properties;
// When boot.properties hasn't been overridden, return default
if (!settings::loadBootSettings(boot_properties)) {
return CONFIG_TT_LAUNCHER_APP_ID;
}
// When boot properties didn't specify an override, return default
if (boot_properties.launcherAppId.empty()) {
LOGGER.error("Failed to load launcher configuration, or launcher not configured");
return CONFIG_TT_LAUNCHER_APP_ID;
}
// If the app in the boot.properties does not exist, return default
if (findAppManifestById(boot_properties.launcherAppId) == nullptr) {
LOGGER.error("Launcher app {} not found", boot_properties.launcherAppId);
return CONFIG_TT_LAUNCHER_APP_ID;
}
// The boot.properties launcher app id is valid
return boot_properties.launcherAppId;
}
static void startNextApp() {
#ifdef ESP_PLATFORM
if (esp_reset_reason() == ESP_RST_PANIC) {
@@ -137,16 +160,7 @@ class BootApp : public App {
return;
}
#endif
settings::BootSettings boot_properties;
std::string launcher_app_id;
if (settings::loadBootSettings(boot_properties) && boot_properties.launcherAppId.empty()) {
LOGGER.error("Failed to load launcher configuration, or launcher not configured");
launcher_app_id = boot_properties.launcherAppId;
} else {
launcher_app_id = "Launcher";
}
auto launcher_app_id = getLauncherAppId();
start(launcher_app_id);
}
+17 -3
View File
@@ -8,6 +8,7 @@
#include <Tactility/service/loader/Loader.h>
#include <Tactility/settings/BootSettings.h>
#include <cstring>
#include <lvgl.h>
namespace tt::app::launcher {
@@ -92,9 +93,22 @@ public:
void onCreate(AppContext& app) override {
settings::BootSettings boot_properties;
if (settings::loadBootSettings(boot_properties) && !boot_properties.autoStartAppId.empty()) {
LOGGER.info("Starting {}", boot_properties.autoStartAppId);
start(boot_properties.autoStartAppId);
if (settings::loadBootSettings(boot_properties)) {
if (
!boot_properties.autoStartAppId.empty() &&
findAppManifestById(boot_properties.autoStartAppId) != nullptr
) {
LOGGER.info("Starting {}", boot_properties.autoStartAppId);
start(boot_properties.autoStartAppId);
} else {
LOGGER.info("No auto-start app configured. Skipping default auto-start due to boot.properties presence.");
}
} else if (
strcmp(CONFIG_TT_AUTO_START_APP_ID, "") != 0 &&
findAppManifestById(CONFIG_TT_AUTO_START_APP_ID) != nullptr
) {
LOGGER.info("Starting {}", CONFIG_TT_AUTO_START_APP_ID);
start(CONFIG_TT_AUTO_START_APP_ID);
}
}