Skip to content

Commit

Permalink
improve link update
Browse files Browse the repository at this point in the history
  • Loading branch information
lancersky committed Jun 12, 2023
1 parent b717553 commit cd0746a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 23 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,15 @@ 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:
repo_token: ${{ secrets.GITHUB_TOKEN }}
draft: true
prerelease: false
files: |
app_update.bin
zephyr.bin
GL-Thread-Dev-Board*.bin
GL-Thread-Dev-Board*.hex
4 changes: 2 additions & 2 deletions prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 0 additions & 17 deletions src/gl_coap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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:
Expand All @@ -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;
}
Expand All @@ -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());
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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;
}
Expand All @@ -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();

Expand All @@ -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);

Expand Down

0 comments on commit cd0746a

Please sign in to comment.