From b1c2bc3b79d4460b11f1af827092a7d7a49f9a52 Mon Sep 17 00:00:00 2001 From: Stijn Tintel Date: Wed, 22 Nov 2023 18:07:19 +0200 Subject: [PATCH] treewide: left align lbl_ln4 and lbl_ln5 text for response As we're center aligning text in lbl_lb4 in ui_pr_err, we need to make sure we left align it again when writing responses from command endpoint, WAS, or multinet. While at it, also always center align lbl_ln5 text to avoid further UI inconsistencies down the road. --- main/audio.c | 2 +- main/endpoint/hass.c | 2 ++ main/endpoint/rest.c | 2 ++ main/was.c | 2 ++ 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/main/audio.c b/main/audio.c index d354dbc8..99e3856a 100644 --- a/main/audio.c +++ b/main/audio.c @@ -294,7 +294,7 @@ static esp_err_t cb_ar_event(audio_rec_evt_t *are, void *data) war.fn_err("unrecognized command"); if (lvgl_port_lock(lvgl_lock_timeout)) { lv_obj_clear_flag(lbl_ln4, LV_OBJ_FLAG_HIDDEN); - + lv_obj_set_style_text_align(lbl_ln4, LV_TEXT_ALIGN_LEFT, 0); lv_label_set_text(lbl_ln4, "#ff0000 Unrecognized Command"); lvgl_port_unlock(); } diff --git a/main/endpoint/hass.c b/main/endpoint/hass.c index fb6e1b42..5b047c0a 100644 --- a/main/endpoint/hass.c +++ b/main/endpoint/hass.c @@ -151,6 +151,8 @@ no_speech:; if (lvgl_port_lock(lvgl_lock_timeout)) { lv_obj_clear_flag(lbl_ln4, LV_OBJ_FLAG_HIDDEN); lv_obj_clear_flag(lbl_ln5, LV_OBJ_FLAG_HIDDEN); + lv_obj_set_style_text_align(lbl_ln4, LV_TEXT_ALIGN_LEFT, 0); + lv_obj_set_style_text_align(lbl_ln5, LV_TEXT_ALIGN_LEFT, 0); lv_obj_remove_event_cb(lbl_ln4, cb_btn_cancel); if (hir.has_speech) { lv_label_set_text_static(lbl_ln4, "Response:"); diff --git a/main/endpoint/rest.c b/main/endpoint/rest.c index 1c501a90..d2b142d0 100644 --- a/main/endpoint/rest.c +++ b/main/endpoint/rest.c @@ -77,6 +77,8 @@ void rest_send(const char *data) if (lvgl_port_lock(lvgl_lock_timeout)) { lv_obj_clear_flag(lbl_ln4, LV_OBJ_FLAG_HIDDEN); lv_obj_clear_flag(lbl_ln5, LV_OBJ_FLAG_HIDDEN); + lv_obj_set_style_text_align(lbl_ln4, LV_TEXT_ALIGN_LEFT, 0); + lv_obj_set_style_text_align(lbl_ln5, LV_TEXT_ALIGN_LEFT, 0); lv_obj_remove_event_cb(lbl_ln4, cb_btn_cancel); if (body != NULL && strlen(body) > 1) { lv_label_set_text_static(lbl_ln4, "Response:"); diff --git a/main/was.c b/main/was.c index a79a84f7..d699dbc2 100644 --- a/main/was.c +++ b/main/was.c @@ -91,6 +91,8 @@ static void IRAM_ATTR cb_ws_event(const void *arg_evh, const esp_event_base_t *b if (lvgl_port_lock(lvgl_lock_timeout)) { lv_obj_clear_flag(lbl_ln4, LV_OBJ_FLAG_HIDDEN); lv_obj_clear_flag(lbl_ln5, LV_OBJ_FLAG_HIDDEN); + lv_obj_set_style_text_align(lbl_ln4, LV_TEXT_ALIGN_LEFT, 0); + lv_obj_set_style_text_align(lbl_ln5, LV_TEXT_ALIGN_LEFT, 0); lv_obj_remove_event_cb(lbl_ln4, cb_btn_cancel); if (cJSON_IsString(speech) && speech->valuestring != NULL && strlen(speech->valuestring) > 0) {