chore: initial commit
This commit is contained in:
@@ -0,0 +1,98 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2024-2026 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include "app_composition.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "control_plane.h"
|
||||
#include "esp_log.h"
|
||||
#include "sdkconfig.h"
|
||||
|
||||
static const char *TAG = "app_comp_boot";
|
||||
|
||||
#if CONFIG_TQ_BOOT_TURNTABLE_CALIBRATION_ENABLE
|
||||
static void app_composition_run_boot_turntable_calibration(void)
|
||||
{
|
||||
ESP_LOGI(TAG, "Starting boot turntable calibration");
|
||||
|
||||
esp_err_t err = control_plane_calibrate();
|
||||
if (err == ESP_OK) {
|
||||
ESP_LOGI(TAG, "Boot turntable calibration completed");
|
||||
return;
|
||||
}
|
||||
|
||||
ESP_LOGW(TAG, "Boot turntable calibration failed: %s", esp_err_to_name(err));
|
||||
}
|
||||
#endif
|
||||
|
||||
static void app_composition_connect_wifi_for_boot(void)
|
||||
{
|
||||
esp_err_t err = control_plane_bootstrap_connectivity(CONFIG_MULTIMODAL_WIFI_SSID,
|
||||
CONFIG_MULTIMODAL_WIFI_PASSWORD,
|
||||
CONFIG_MULTIMODAL_CONNECT_TIMEOUT_MS,
|
||||
"TQ-CAT");
|
||||
if (err != ESP_OK) {
|
||||
ESP_LOGW(TAG, "Connectivity bootstrap failed: %s", esp_err_to_name(err));
|
||||
}
|
||||
}
|
||||
|
||||
static void app_composition_run_boot_orchestration(void)
|
||||
{
|
||||
#if CONFIG_TQ_BOOT_TURNTABLE_CALIBRATION_ENABLE
|
||||
app_composition_run_boot_turntable_calibration();
|
||||
#else
|
||||
ESP_LOGI(TAG, "Boot turntable calibration disabled by configuration");
|
||||
#endif
|
||||
app_composition_connect_wifi_for_boot();
|
||||
}
|
||||
|
||||
esp_err_t app_composition_start_default_runtime(void)
|
||||
{
|
||||
setvbuf(stdin, NULL, _IONBF, 0);
|
||||
setvbuf(stdout, NULL, _IONBF, 0);
|
||||
setvbuf(stderr, NULL, _IONBF, 0);
|
||||
|
||||
ESP_LOGI(TAG, "========================================");
|
||||
ESP_LOGI(TAG, " App Composition Boot");
|
||||
ESP_LOGI(TAG, "========================================");
|
||||
|
||||
#if CONFIG_TQ_SCREEN_ENABLE
|
||||
esp_err_t lcd_err = control_plane_init_lcd_device();
|
||||
if (lcd_err != ESP_OK) {
|
||||
ESP_LOGW(TAG, "LCD init failed: %s", esp_err_to_name(lcd_err));
|
||||
}
|
||||
#else
|
||||
ESP_LOGI(TAG, "LCD init disabled by configuration");
|
||||
#endif
|
||||
|
||||
esp_err_t err = control_plane_init();
|
||||
if (err != ESP_OK) {
|
||||
ESP_LOGE(TAG, "Start default runtime failed: %s", esp_err_to_name(err));
|
||||
return err;
|
||||
}
|
||||
|
||||
esp_err_t cli_err = control_plane_factory_cli_start();
|
||||
if (cli_err != ESP_OK) {
|
||||
ESP_LOGW(TAG, "Factory serial CLI start failed: %s", esp_err_to_name(cli_err));
|
||||
}
|
||||
|
||||
err = control_plane_prepare_runtime_storage();
|
||||
if (err != ESP_OK) {
|
||||
ESP_LOGE(TAG, "Start default runtime failed: %s", esp_err_to_name(err));
|
||||
return err;
|
||||
}
|
||||
|
||||
app_composition_run_boot_orchestration();
|
||||
|
||||
err = control_plane_start_runtime_workers();
|
||||
if (err != ESP_OK) {
|
||||
ESP_LOGE(TAG, "Start default runtime failed: %s", esp_err_to_name(err));
|
||||
return err;
|
||||
}
|
||||
|
||||
return ESP_OK;
|
||||
}
|
||||
Reference in New Issue
Block a user