From cd0746a10d9d1fbd1edf2fd28becebd33008e7e0 Mon Sep 17 00:00:00 2001 From: lancersky Date: Mon, 12 Jun 2023 09:49:37 +0800 Subject: [PATCH] improve link update --- .github/workflows/release.yml | 9 +++++---- prj.conf | 4 ++-- src/gl_coap.c | 17 ----------------- 3 files changed, 7 insertions(+), 23 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e2151a9..55e20a8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -30,8 +30,9 @@ jobs: cd glinet/gl-dev-board-over-thread west build -b gl_nrf52840_dev_board - cp build/zephyr/app_update.bin ../../../app_update.bin - cp build/zephyr/zephyr.bin ../../../zephyr.bin + VERSION=$(cat prj.conf|grep CONFIG_SW_VERSION|awk -F '"' '{print $2}') + cp build/zephyr/app_update.bin ../../../GL-Thread-Dev-Board-MTD-OTA-v$VERSION.bin + cp build/zephyr/merged.hex ../../../GL-Thread-Dev-Board-MTD-JLINK-UPGRADE-v$VERSION.hex - uses: marvinpinto/action-automatic-releases@latest with: @@ -39,5 +40,5 @@ jobs: draft: true prerelease: false files: | - app_update.bin - zephyr.bin + GL-Thread-Dev-Board*.bin + GL-Thread-Dev-Board*.hex diff --git a/prj.conf b/prj.conf index 98ff2c5..6038232 100755 --- a/prj.conf +++ b/prj.conf @@ -74,8 +74,8 @@ CONFIG_MAIN_STACK_SIZE=10240 # Ensure an MCUboot-compatible binary is generated. CONFIG_BOOTLOADER_MCUBOOT=y CONFIG_MCUBOOT_UTIL_LOG_LEVEL_WRN=y -CONFIG_MCUBOOT_IMAGE_VERSION="1.1.9" -CONFIG_SW_VERSION="1.1.9" +CONFIG_MCUBOOT_IMAGE_VERSION="1.1.10" +CONFIG_SW_VERSION="1.1.10" # Required by the `taskstat` command. CONFIG_THREAD_MONITOR=y diff --git a/src/gl_coap.c b/src/gl_coap.c index b357b8c..ecc0021 100755 --- a/src/gl_coap.c +++ b/src/gl_coap.c @@ -76,7 +76,6 @@ static uint32_t poll_period; static bool is_joined; static bool is_connected; static bool is_srp_client_running = false; -static bool is_need_to_update_server_ipaddr = false; static struct k_work multicast_light_work; static struct k_work toggle_MTD_SED_work; @@ -252,8 +251,6 @@ static int on_provisioning_reply(const struct coap_packet *response, struct coap LOG_INF("Received peer address: %s", unique_local_addr_str); - is_need_to_update_server_ipaddr = false; - coap_client_send_status(); exit: @@ -280,7 +277,6 @@ static int on_send_trigger_reply(const struct coap_packet *response, struct coap ARG_UNUSED(reply); ARG_UNUSED(from); - is_need_to_update_server_ipaddr = false; LOG_INF("Send 'trigger' done."); return 0; } @@ -302,11 +298,6 @@ void send_trigger_event_request(trigger_event_type_e event, char* obj, void* val coap_client_send_provisioning_request(); return; } - if (is_need_to_update_server_ipaddr) { - LOG_WRN("Peer address can not access"); - coap_client_send_provisioning_request(); - return; - } cJSON *root_obj = cJSON_CreateObject(); gl_json_add_str(root_obj, "eui64", ot_get_eui64()); @@ -345,7 +336,6 @@ void send_trigger_event_request(trigger_event_type_e event, char* obj, void* val char* payload = cJSON_PrintUnformatted(root_obj); LOG_INF("Send trigger ev: %s", payload); - is_need_to_update_server_ipaddr = true; coap_send_request(COAP_METHOD_PUT, (const struct sockaddr *)&unique_local_addr, trigger_repo_option, payload, strlen(payload) + 1, on_send_trigger_reply); @@ -395,7 +385,6 @@ static int on_send_status_reply(const struct coap_packet *response, struct coap_ ARG_UNUSED(reply); ARG_UNUSED(from); - is_need_to_update_server_ipaddr = false; LOG_INF("Send 'status' done."); return 0; } @@ -412,11 +401,6 @@ static void do_report_status_request(struct k_work *item) coap_client_send_provisioning_request(); return; } - if (is_need_to_update_server_ipaddr) { - LOG_WRN("Peer address can not access"); - coap_client_send_provisioning_request(); - return; - } gl_sensor_sample_fetch(); @@ -438,7 +422,6 @@ static void do_report_status_request(struct k_work *item) payload = cJSON_PrintUnformatted(root_obj); LOG_INF("Send 'status' request to: %s, payload: %s", unique_local_addr_str, payload); - is_need_to_update_server_ipaddr = true; coap_send_request(COAP_METHOD_PUT, (const struct sockaddr *)&unique_local_addr, status_option, payload, strlen(payload) + 1, on_send_status_reply);