From 4cb27df53a47550e68174ef3e2593eb33d94f567 Mon Sep 17 00:00:00 2001 From: Stijn Tintel Date: Thu, 14 Sep 2023 16:14:23 +0300 Subject: [PATCH 01/11] CI: skip changed-files action on tag The changed-files action fails when pushing a tag: Error: Similar commit hashes detected: previous sha: a9cf47f4429ec2552ccb3c8d4241dcda29ea7bef is equivalent to the current sha: a9cf47f4429ec2552ccb3c8d4241dcda29ea7bef. Error: Please verify that both commits are valid, and increase the fetch_depth to a number higher than 50. Error: Similar commit hashes detected. (cherry picked from commit 440ca8833d48484b3cd07f14380efa8f1c462150) --- .github/workflows/meta.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/meta.yml b/.github/workflows/meta.yml index 22ed6444..80d976b3 100644 --- a/.github/workflows/meta.yml +++ b/.github/workflows/meta.yml @@ -22,6 +22,7 @@ jobs: fetch-depth: 0 - uses: tj-actions/changed-files@v37 + if: ${{ github.ref_type != 'tag' }} id: changed_files_yaml with: files_yaml: | @@ -37,9 +38,8 @@ jobs: - 'sdkconfig.willow' - 'spiffs/**' - build_container: - if: ${{ needs.trigger_workflow.outputs.container_any_changed == 'true' }} + if: ${{ needs.trigger_workflow.outputs.container_any_changed == 'true' || github.ref_type == 'tag' }} uses: ./.github/workflows/build-container.yml needs: trigger_workflow From 37a9161de64b94414b0ac6a4d0f7ff8492ad7c3a Mon Sep 17 00:00:00 2001 From: Stijn Tintel Date: Mon, 18 Sep 2023 17:57:40 +0300 Subject: [PATCH 02/11] CI: use release-v0.1 container tag Using main would introduce unwanted changes. --- .github/workflows/meta.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/meta.yml b/.github/workflows/meta.yml index 80d976b3..95ee72ec 100644 --- a/.github/workflows/meta.yml +++ b/.github/workflows/meta.yml @@ -48,4 +48,4 @@ jobs: uses: ./.github/workflows/build-willow.yml needs: trigger_workflow with: - container-image: ghcr.io/toverainc/willow:main + container-image: ghcr.io/toverainc/willow:release-v0.1 From ecd20bd28b2a6ab8b7aba9b3e249869fe69135f0 Mon Sep 17 00:00:00 2001 From: Stijn Tintel Date: Tue, 12 Sep 2023 01:06:39 +0300 Subject: [PATCH 03/11] rest: fix potential NULL pointer dereference (cherry picked from commit a787a32dc3a910dbb9f5a6f442bcbc7c4a25c700) --- main/endpoint/rest.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main/endpoint/rest.c b/main/endpoint/rest.c index d24edeba..b72be0d4 100644 --- a/main/endpoint/rest.c +++ b/main/endpoint/rest.c @@ -66,7 +66,7 @@ void rest_send(const char *data) war.fn_err("error"); } - if (strlen(body) > 1) { + if (body != NULL && strlen(body) > 1) { ESP_LOGI(TAG, "REST response: %s", body); } @@ -75,7 +75,7 @@ void rest_send(const char *data) lv_obj_clear_flag(lbl_ln5, LV_OBJ_FLAG_HIDDEN); lv_label_set_text_static(lbl_ln4, "Command status:"); lv_obj_remove_event_cb(lbl_ln4, cb_btn_cancel); - if (strlen(body) > 1) { + if (body != NULL && strlen(body) > 1) { lv_label_set_text(lbl_ln5, body); } else { lv_label_set_text(lbl_ln5, ok ? "#008000 Success!" : "#ff0000 Error"); From fde653c952123ad8b92c20c003b234649cad6b6b Mon Sep 17 00:00:00 2001 From: Kristian Kielhofner Date: Mon, 11 Sep 2023 12:56:26 -0500 Subject: [PATCH 04/11] REST endpoint doesn't use TTS response. When available use the text from the REST response for TTS. (cherry picked from commit c6d7d179dcea32f0e4d027d316037d5f64946ea2) --- main/endpoint/rest.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/main/endpoint/rest.c b/main/endpoint/rest.c index b72be0d4..6638fd7e 100644 --- a/main/endpoint/rest.c +++ b/main/endpoint/rest.c @@ -61,23 +61,27 @@ void rest_send(const char *data) } if (ok) { - war.fn_ok("ok"); + if (body != NULL && strlen(body) > 1) { + ESP_LOGI(TAG, "REST response: %s", body); + war.fn_ok(body); + } else { + ESP_LOGI(TAG, "REST successful"); + war.fn_ok("Success"); + } } else { - war.fn_err("error"); - } - - if (body != NULL && strlen(body) > 1) { - ESP_LOGI(TAG, "REST response: %s", body); + ESP_LOGI(TAG, "REST failed"); + war.fn_err("Something went wrong"); } 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_label_set_text_static(lbl_ln4, "Command status:"); lv_obj_remove_event_cb(lbl_ln4, cb_btn_cancel); if (body != NULL && strlen(body) > 1) { + lv_label_set_text_static(lbl_ln4, "Response:"); lv_label_set_text(lbl_ln5, body); } else { + lv_label_set_text_static(lbl_ln4, "Command status:"); lv_label_set_text(lbl_ln5, ok ? "#008000 Success!" : "#ff0000 Error"); } lvgl_port_unlock(); From 7b44046411334336794f4e49e50242952b94a1d4 Mon Sep 17 00:00:00 2001 From: Kristian Kielhofner Date: Mon, 11 Sep 2023 13:18:19 -0500 Subject: [PATCH 05/11] REST: Color doesn't display well with our background, standardize display and TTS language to other endpoints (cherry picked from commit dc1d55ddb7a6e2c5a48a10ce5281d95cd34a5d99) --- main/endpoint/rest.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main/endpoint/rest.c b/main/endpoint/rest.c index 6638fd7e..61dc1e24 100644 --- a/main/endpoint/rest.c +++ b/main/endpoint/rest.c @@ -70,7 +70,7 @@ void rest_send(const char *data) } } else { ESP_LOGI(TAG, "REST failed"); - war.fn_err("Something went wrong"); + war.fn_err("Error"); } if (lvgl_port_lock(lvgl_lock_timeout)) { @@ -82,7 +82,7 @@ void rest_send(const char *data) lv_label_set_text(lbl_ln5, body); } else { lv_label_set_text_static(lbl_ln4, "Command status:"); - lv_label_set_text(lbl_ln5, ok ? "#008000 Success!" : "#ff0000 Error"); + lv_label_set_text(lbl_ln5, ok ? "Success!" : "Error"); } lvgl_port_unlock(); } From 4660c0cd13b670f1f30683f4d17d0c77b074783b Mon Sep 17 00:00:00 2001 From: Kristian Kielhofner Date: Mon, 11 Sep 2023 13:18:56 -0500 Subject: [PATCH 06/11] Support TTS (without status because OpenHAB doesn't provide), remove text color, standardize feedback language (cherry picked from commit f3471025904f52a9dddfd7db9ca15c9c58b48fad) --- main/endpoint/openhab.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/main/endpoint/openhab.c b/main/endpoint/openhab.c index b4bb3129..63b40f81 100644 --- a/main/endpoint/openhab.c +++ b/main/endpoint/openhab.c @@ -63,9 +63,9 @@ void openhab_send(const char *data) end: free(url); if (ok) { - war.fn_ok("ok"); + war.fn_ok("Success"); } else { - war.fn_err("error"); + war.fn_err("Error"); } if (body != NULL && strlen(body) > 1) { @@ -75,12 +75,12 @@ void openhab_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_label_set_text_static(lbl_ln4, "Command status:"); lv_obj_remove_event_cb(lbl_ln4, cb_btn_cancel); + lv_label_set_text_static(lbl_ln4, "Command status:"); if (body != NULL && strlen(body) > 1) { lv_label_set_text(lbl_ln5, body); } else { - lv_label_set_text(lbl_ln5, ok ? "#008000 Success!" : "#ff0000 Error"); + lv_label_set_text(lbl_ln5, ok ? "Success!" : "Error"); } lvgl_port_unlock(); } From dd99a8b88424fba0e5f8102f34c609fe0394ab8b Mon Sep 17 00:00:00 2001 From: Kristian Kielhofner Date: Mon, 11 Sep 2023 13:30:56 -0500 Subject: [PATCH 07/11] Standardize TTS responses and display status language and font color to align with REST and OpenHAB (cherry picked from commit e24c0539184a08b97ba86aca062ce4cfca8fd287) --- main/endpoint/hass.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/main/endpoint/hass.c b/main/endpoint/hass.c index a0058d32..bab10301 100644 --- a/main/endpoint/hass.c +++ b/main/endpoint/hass.c @@ -144,7 +144,7 @@ no_speech:; if (hir.has_speech) { hir.ok ? war.fn_ok(hir.speech) : war.fn_err(hir.speech); } else { - hir.ok ? war.fn_ok("success") : war.fn_err("error"); + hir.ok ? war.fn_ok("Success") : war.fn_err("Error"); } if (lvgl_port_lock(lvgl_lock_timeout)) { @@ -156,7 +156,7 @@ no_speech:; lv_label_set_text(lbl_ln5, hir.speech); } else { lv_label_set_text_static(lbl_ln4, "Command status:"); - lv_label_set_text(lbl_ln5, hir.ok ? "#008000 Success!" : "#ff0000 Error!"); + lv_label_set_text(lbl_ln5, hir.ok ? "Success!" : "Error"); } lvgl_port_unlock(); } @@ -357,10 +357,10 @@ static void hass_post(const char *data) lv_obj_remove_event_cb(lbl_ln4, cb_btn_cancel); if (http_status == 200) { lv_label_set_text_static(lbl_ln4, "Command status:"); - lv_label_set_text(lbl_ln5, ok ? "#008000 Success!" : "#ff0000 No Matching HA Intent"); + lv_label_set_text(lbl_ln5, ok ? "Success!" : "No Matching HA Intent"); } else { lv_label_set_text_static(lbl_ln4, "Error contacting HASS:"); - lv_label_set_text_fmt(lbl_ln5, "#ff0000 HTTP %d", http_status); + lv_label_set_text_fmt(lbl_ln5, "HTTP %d", http_status); } lvgl_port_unlock(); From fa22cce8ddaba0fe03f6d90b579b51d0390c4f67 Mon Sep 17 00:00:00 2001 From: Stijn Tintel Date: Mon, 11 Sep 2023 23:35:37 +0300 Subject: [PATCH 08/11] audio: hide lbl_ln3 and lbl_ln4 before calling endpoint 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 c18aa98a2b0ead138dd093aeb817765db7cc519f) --- main/audio.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/main/audio.c b/main/audio.c index 0070e69b..5c555f98 100644 --- a/main/audio.c +++ b/main/audio.c @@ -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); @@ -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 { From 79ebcb8eedd796e0b0bd967de34750b41eeb3e1a Mon Sep 17 00:00:00 2001 From: Stijn Tintel Date: Wed, 20 Sep 2023 16:12:44 +0300 Subject: [PATCH 09/11] CI: use hyphen instead of underscore in device suffix (cherry picked from commit 06e27f4896ebf14fcf4465abcbe3750150fc8ce5) --- .github/workflows/build-willow.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-willow.yml b/.github/workflows/build-willow.yml index ca5041ce..24f6ac2b 100644 --- a/.github/workflows/build-willow.yml +++ b/.github/workflows/build-willow.yml @@ -17,8 +17,8 @@ jobs: strategy: matrix: device: - - ESP32_S3_BOX - - ESP32_S3_BOX_LITE + - ESP32-S3-BOX + - ESP32-S3-BOX-LITE runs-on: ubuntu-22.04 container: image: ${{ inputs.container-image }} @@ -63,7 +63,7 @@ jobs: run: ( . "$IDF_PATH/export.sh"; ./utils.sh setup ) shell: bash - name: append device type to sdkconfig - run: echo "CONFIG_${{ matrix.device }}_BOARD=y" >> sdkconfig + run: echo "CONFIG_${{ matrix.device }}_BOARD=y" | sed 's/-/_/g' >> sdkconfig - name: ./utils.sh build run: ( . "$IDF_PATH/export.sh"; ./utils.sh build ) shell: bash From 6d85a2a1f012efc699094e753c6a26e2b8fbb977 Mon Sep 17 00:00:00 2001 From: Stijn Tintel Date: Wed, 20 Sep 2023 16:17:27 +0300 Subject: [PATCH 10/11] CI: generate and publish sha256sums (cherry picked from commit 711c258c3f29fde896e6257b971b75760b2db147) --- .github/workflows/build-willow.yml | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build-willow.yml b/.github/workflows/build-willow.yml index 24f6ac2b..2d39cf9e 100644 --- a/.github/workflows/build-willow.yml +++ b/.github/workflows/build-willow.yml @@ -73,16 +73,21 @@ jobs: - name: copy willow.bin to ota_filename run: cp /willow/build/willow.bin "/willow/build/${{ env.ota_filename }}" - - name: upload willow-dist.bin artifact + - name: calculate sha256sum for willow.bin + run: cd /willow/build &&sha256sum "${{ env.ota_filename }}" > "${{ env.ota_filename }}.sha256sum.txt" + - name: calculate sha256sum for willow-dist.bin + run: cd /willow/build && sha256sum "${{ env.dist_filename }}" > "${{ env.dist_filename }}.sha256sum.txt" + + - name: upload willow-dist.bin artifacts uses: actions/upload-artifact@v3 with: name: "${{ env.dist_filename }}" - path: "/willow/build/${{ env.dist_filename }}" - - name: upload willow-ota.bin artifact + path: "/willow/build/${{ env.dist_filename }}*" + - name: upload willow-ota.bin artifacts uses: actions/upload-artifact@v3 with: name: "${{ env.ota_filename }}" - path: "/willow/build/${{ env.ota_filename }}" + path: "/willow/build/${{ env.ota_filename }}*" - name: upload build artifacts uses: actions/upload-artifact@v3 with: @@ -108,9 +113,12 @@ jobs: - name: find -ls run: find -ls + - name: create sha256sums.txt + run: find -type f -name '*.sha256sum.txt' -exec cat {} + | sort -u > sha256sums.txt + - name: create release uses: ncipollo/release-action@v1 with: allowUpdates: false - artifacts: "willow-dist-*/willow-dist-*.bin,willow-ota-*/willow-ota-*.bin" + artifacts: "sha256sums.txt,willow-dist-*/willow-dist-*.bin,willow-ota-*/willow-ota-*.bin" prerelease: ${{ contains(github.ref, 'pre') }} From 449a5386cee10a3c4c40ece407dee681269c7812 Mon Sep 17 00:00:00 2001 From: Stijn Tintel Date: Wed, 20 Sep 2023 16:59:07 +0300 Subject: [PATCH 11/11] CI: mark releases containing delete as pre-release We're using tags like will-be-deleted-something for test tags, to verify things work as expected before tagging an actual release tag. Mark a release as pre-release if the tag contains delete. (cherry picked from commit 4a83be719a74eebc1bf187d95ef366a92c0c8e82) --- .github/workflows/build-willow.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-willow.yml b/.github/workflows/build-willow.yml index 2d39cf9e..62ce3a29 100644 --- a/.github/workflows/build-willow.yml +++ b/.github/workflows/build-willow.yml @@ -121,4 +121,4 @@ jobs: with: allowUpdates: false artifacts: "sha256sums.txt,willow-dist-*/willow-dist-*.bin,willow-ota-*/willow-ota-*.bin" - prerelease: ${{ contains(github.ref, 'pre') }} + prerelease: ${{ contains(github.ref, 'delete') || contains(github.ref, 'pre') }}