feat(product-test): add UART automation flow

This commit is contained in:
admin
2026-04-29 23:39:43 +08:00
parent 9294d72aea
commit d735446547
14 changed files with 2091 additions and 4 deletions

View File

@@ -88,6 +88,18 @@ static esp_err_t lifecycle_start_voice(void) {
return voice_interaction_init();
}
static esp_err_t lifecycle_start_product_test(void) {
return product_test_service_start();
}
static esp_err_t lifecycle_stop_product_test(void) {
esp_err_t rc = product_test_service_stop(domain_policy_printer_stop_timeout_ms());
if (rc == ESP_OK || rc == ESP_ERR_NOT_SUPPORTED || rc == ESP_ERR_INVALID_STATE) {
return ESP_OK;
}
return rc;
}
static esp_err_t lifecycle_stop_printer_protocol(void) {
esp_err_t rc = printer_protocol_stop(domain_policy_printer_stop_timeout_ms());
if (rc == ESP_OK || rc == ESP_ERR_INVALID_STATE) {
@@ -248,6 +260,7 @@ esp_err_t control_plane_lifecycle_start(void) {
bool system_started = false;
bool printer_started = false;
bool voice_started = false;
bool product_test_started = false;
const char *failed_stage = "unknown";
failed_stage = "system_runtime";
@@ -277,6 +290,13 @@ esp_err_t control_plane_lifecycle_start(void) {
}
voice_started = true;
failed_stage = "product_test";
rc = lifecycle_start_product_test();
if (rc != ESP_OK && rc != ESP_ERR_NOT_SUPPORTED) {
goto start_failed;
}
product_test_started = (rc == ESP_OK);
image_generation_schedule_prewarm();
esp_err_t voice_prewarm_rc = voice_interaction_schedule_session_prewarm();
if (voice_prewarm_rc != ESP_OK && voice_prewarm_rc != ESP_ERR_INVALID_STATE) {
@@ -294,6 +314,9 @@ esp_err_t control_plane_lifecycle_start(void) {
return ESP_OK;
start_failed:
if (product_test_started) {
(void)lifecycle_stop_product_test();
}
if (voice_started) {
(void)lifecycle_stop_voice();
}
@@ -340,7 +363,12 @@ esp_err_t control_plane_lifecycle_stop(void) {
esp_err_t first_err = ESP_OK;
esp_err_t rc = lifecycle_stop_voice();
esp_err_t rc = lifecycle_stop_product_test();
if (rc != ESP_OK && first_err == ESP_OK) {
first_err = rc;
}
rc = lifecycle_stop_voice();
if (rc != ESP_OK && first_err == ESP_OK) {
first_err = rc;
}