Skip to content

Commit

Permalink
audio: hide lbl_ln3 and lbl_ln4 before calling endpoint
Browse files Browse the repository at this point in the history
Hiding labels after calling the endpoint could result in them being
hidden after the endpoint unhid them. This currently seems to happen for
both the openHAB and the REST endpoint.

Adding some logging confirms the label is hid in the audio code just a
few milliseconds after unhiding in the endpoint code. We don't see this
with Home Assistant as we're using a recent Home Assistant version where
the endpoint code sets up a WebSocket. The additional JSON constructing
and parsing in the Home Assistant WebSocket code causes enough delay to
not see the issue there.

(cherry picked from commit c18aa98)
  • Loading branch information
stintel committed Sep 18, 2023
1 parent dd99a8b commit fa22cce
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions main/audio.c
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,11 @@ static esp_err_t hdl_ev_hs(http_stream_event_msg_t *msg)
}
buf[read_len] = 0;
ESP_LOGI(TAG, "WIS HTTP Response = %s", (char *)buf);
if (lvgl_port_lock(lvgl_lock_timeout)) {
lv_obj_add_flag(lbl_ln3, LV_OBJ_FLAG_HIDDEN);
lv_obj_add_flag(lbl_ln4, LV_OBJ_FLAG_HIDDEN);
lvgl_port_unlock();
}
char *command_endpoint = config_get_char("command_endpoint", DEFAULT_COMMAND_ENDPOINT);
if (strcmp(command_endpoint, "Home Assistant") == 0) {
hass_send(buf);
Expand All @@ -465,8 +470,6 @@ static esp_err_t hdl_ev_hs(http_stream_event_msg_t *msg)
if (lvgl_port_lock(lvgl_lock_timeout)) {
lv_obj_clear_flag(lbl_ln1, LV_OBJ_FLAG_HIDDEN);
lv_obj_clear_flag(lbl_ln2, LV_OBJ_FLAG_HIDDEN);
lv_obj_add_flag(lbl_ln3, LV_OBJ_FLAG_HIDDEN);
lv_obj_add_flag(lbl_ln4, LV_OBJ_FLAG_HIDDEN);
if (cJSON_IsString(speaker_status) && speaker_status->valuestring != NULL) {
lv_label_set_text(lbl_ln1, speaker_status->valuestring);
} else {
Expand Down

0 comments on commit fa22cce

Please sign in to comment.