Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport endpoint consistency and CI changes to v0.1 #266

Merged
merged 11 commits into from
Sep 21, 2023
Merged
26 changes: 17 additions & 9 deletions .github/workflows/build-willow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down Expand Up @@ -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
Expand All @@ -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:
Expand All @@ -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"
prerelease: ${{ contains(github.ref, 'pre') }}
artifacts: "sha256sums.txt,willow-dist-*/willow-dist-*.bin,willow-ota-*/willow-ota-*.bin"
prerelease: ${{ contains(github.ref, 'delete') || contains(github.ref, 'pre') }}
6 changes: 3 additions & 3 deletions .github/workflows/meta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand All @@ -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

Expand All @@ -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
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
8 changes: 4 additions & 4 deletions main/endpoint/hass.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand All @@ -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();
}
Expand Down Expand Up @@ -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();
Expand Down
8 changes: 4 additions & 4 deletions main/endpoint/openhab.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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();
}
Expand Down
22 changes: 13 additions & 9 deletions main/endpoint/rest.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,24 +61,28 @@ 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 (strlen(body) > 1) {
ESP_LOGI(TAG, "REST response: %s", body);
ESP_LOGI(TAG, "REST failed");
war.fn_err("Error");
}

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 (strlen(body) > 1) {
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(lbl_ln5, ok ? "#008000 Success!" : "#ff0000 Error");
lv_label_set_text_static(lbl_ln4, "Command status:");
lv_label_set_text(lbl_ln5, ok ? "Success!" : "Error");
}
lvgl_port_unlock();
}
Expand Down