fix(screen): streamline runtime display states

This commit is contained in:
admin
2026-04-30 10:07:25 +08:00
parent 7e77c6809a
commit d83180975d
9 changed files with 841 additions and 154 deletions

View File

@@ -151,6 +151,7 @@ static void lifecycle_power_key_task_main(void *arg) {
}
ESP_LOGW(TAG, "POWER_KEY long press detected: stopping services and powering off");
(void)screen_preview_show_event(SCREEN_PREVIEW_EVENT_SHUTDOWN, NULL);
esp_err_t stop_rc = ESP_ERR_INVALID_STATE;
for (uint16_t attempt = 0; attempt < POWER_KEY_STOP_RETRY_COUNT; ++attempt) {
@@ -282,6 +283,7 @@ esp_err_t control_plane_lifecycle_start(void) {
goto start_failed;
}
printer_started = true;
(void)screen_preview_start_runtime_feedback();
failed_stage = "voice_interaction";
rc = lifecycle_run_step_with_retry("voice_interaction", lifecycle_start_voice);
@@ -310,6 +312,7 @@ esp_err_t control_plane_lifecycle_start(void) {
xSemaphoreGive(s_lock);
}
(void)screen_preview_show_event(SCREEN_PREVIEW_EVENT_RUNTIME_READY, NULL);
ESP_LOGI(TAG, "control-plane lifecycle started");
return ESP_OK;
@@ -321,6 +324,7 @@ start_failed:
(void)lifecycle_stop_voice();
}
if (printer_started) {
screen_preview_stop_runtime_feedback();
(void)lifecycle_stop_printer_protocol();
}
if (system_started) {
@@ -337,6 +341,10 @@ start_failed:
"control-plane lifecycle start failed at stage=%s, rc=0x%x",
failed_stage,
(unsigned)rc);
screen_preview_context_t ctx = {
.detail = failed_stage,
};
(void)screen_preview_show_event(SCREEN_PREVIEW_EVENT_RUNTIME_ERROR, &ctx);
return rc;
}
@@ -360,6 +368,7 @@ esp_err_t control_plane_lifecycle_stop(void) {
xSemaphoreGive(s_lock);
lifecycle_power_key_worker_unbind();
(void)screen_preview_show_event(SCREEN_PREVIEW_EVENT_SHUTDOWN, NULL);
esp_err_t first_err = ESP_OK;
@@ -373,6 +382,7 @@ esp_err_t control_plane_lifecycle_stop(void) {
first_err = rc;
}
screen_preview_stop_runtime_feedback();
rc = lifecycle_stop_printer_protocol();
if (rc != ESP_OK && first_err == ESP_OK) {
first_err = rc;