feat(ota): show update expression during firmware install
This commit is contained in:
@@ -235,6 +235,42 @@ static void control_plane_ota_progress(uint64_t received,
|
||||
}
|
||||
}
|
||||
|
||||
static void control_plane_ota_show_update_expression(void)
|
||||
{
|
||||
const domain_expression_request_t request = {
|
||||
.id = DOMAIN_EXPRESSION_OTA_UPDATE,
|
||||
.trigger = DOMAIN_EXPRESSION_TRIGGER_OTA_UPDATE,
|
||||
};
|
||||
|
||||
esp_err_t preheat_err = domain_runtime_preheat_expression(&request);
|
||||
if (preheat_err != ESP_OK && preheat_err != ESP_ERR_INVALID_STATE) {
|
||||
ESP_LOGW(TAG,
|
||||
"OTA expression preheat failed: %s",
|
||||
esp_err_to_name(preheat_err));
|
||||
}
|
||||
|
||||
esp_err_t request_err = domain_runtime_request_expression(&request);
|
||||
if (request_err != ESP_OK && request_err != ESP_ERR_INVALID_STATE) {
|
||||
ESP_LOGW(TAG,
|
||||
"OTA expression request failed: %s",
|
||||
esp_err_to_name(request_err));
|
||||
}
|
||||
}
|
||||
|
||||
static void control_plane_ota_restore_idle_expression(void)
|
||||
{
|
||||
const domain_expression_request_t request = {
|
||||
.id = DOMAIN_EXPRESSION_IDLE,
|
||||
.trigger = DOMAIN_EXPRESSION_TRIGGER_OTA_UPDATE,
|
||||
};
|
||||
esp_err_t err = domain_runtime_request_expression(&request);
|
||||
if (err != ESP_OK && err != ESP_ERR_INVALID_STATE) {
|
||||
ESP_LOGW(TAG,
|
||||
"Restore idle expression after OTA failed: %s",
|
||||
esp_err_to_name(err));
|
||||
}
|
||||
}
|
||||
|
||||
static void control_plane_ota_log_stack_headroom(const char *phase)
|
||||
{
|
||||
UBaseType_t high_water_bytes = uxTaskGetStackHighWaterMark(NULL) * sizeof(StackType_t);
|
||||
@@ -700,6 +736,7 @@ static void control_plane_ota_worker(void *arg)
|
||||
control_plane_ota_set_state(CONTROL_PLANE_OTA_STATE_DOWNLOADING,
|
||||
ESP_OK,
|
||||
response->http_status);
|
||||
control_plane_ota_show_update_expression();
|
||||
domain_runtime_behavior_set_keep_awake(true);
|
||||
err = domain_runtime_ota_install(&response->firmware,
|
||||
CONFIG_TQ_OTA_INSTALL_TIMEOUT_MS,
|
||||
@@ -710,6 +747,7 @@ static void control_plane_ota_worker(void *arg)
|
||||
domain_runtime_behavior_set_keep_awake(false);
|
||||
if (err != ESP_OK) {
|
||||
initial_check_pending = false;
|
||||
control_plane_ota_restore_idle_expression();
|
||||
control_plane_ota_release_voice_window(&voice_window);
|
||||
control_plane_ota_note_failure(err, response->http_status);
|
||||
ESP_LOGE(TAG, "OTA install failed: %s", esp_err_to_name(err));
|
||||
|
||||
Reference in New Issue
Block a user