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:
committed by
GitHub
parent
49632d15c9
commit
8ff990d635
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user