Skip to content

Commit

Permalink
treewide: left align lbl_ln4 and lbl_ln5 text for response
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
stintel committed Nov 22, 2023
1 parent 7190c45 commit 4a70eb2
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion main/audio.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
2 changes: 2 additions & 0 deletions main/endpoint/hass.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:");
Expand Down
2 changes: 2 additions & 0 deletions main/endpoint/rest.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:");
Expand Down
2 changes: 2 additions & 0 deletions main/was.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 4a70eb2

Please sign in to comment.