Skip to content

Commit

Permalink
fw_update: when reporting IDLE during retry, use await retry reason
Browse files Browse the repository at this point in the history
Use the new GOLIOTH_OTA_REASON_AWAIT_RETRY reason when reporting IDLE state
during retry backoff period.

Signed-off-by: Mike Szczys <[email protected]>
  • Loading branch information
szczys committed Dec 11, 2024
1 parent 88bf4c0 commit 288f72d
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/fw_update.c
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,26 @@ static void fw_update_thread(void *arg)
? GOLIOTH_SYS_WAIT_FOREVER
: backoff_ms_before_expiration(&_component_ctx);

GLTH_LOGI(TAG, "State = Idle");

if (manifest_timeout == GOLIOTH_SYS_WAIT_FOREVER)
{
golioth_fw_update_report_state_sync(&_component_ctx,
GOLIOTH_OTA_STATE_IDLE,
GOLIOTH_OTA_REASON_READY,
FW_REPORT_COMPONENT_NAME
| FW_REPORT_CURRENT_VERSION);
}
else
{
golioth_fw_update_report_state_sync(&_component_ctx,
GOLIOTH_OTA_STATE_IDLE,
GOLIOTH_OTA_REASON_AWAIT_RETRY,
FW_REPORT_COMPONENT_NAME
| FW_REPORT_CURRENT_VERSION
| FW_REPORT_TARGET_VERSION);
}

if (!golioth_sys_sem_take(_manifest_rcvd, manifest_timeout))
{
GLTH_LOGI(TAG,
Expand Down

0 comments on commit 288f72d

Please sign in to comment.