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 884b0d0 commit 505a7d0
Showing 1 changed file with 21 additions and 8 deletions.
29 changes: 21 additions & 8 deletions src/fw_update.c
Original file line number Diff line number Diff line change
Expand Up @@ -370,14 +370,6 @@ static void fw_update_thread(void *arg)

while (1)
{
GLTH_LOGI(TAG, "State = Idle");
golioth_fw_update_report_state_sync(&_component_ctx,
GOLIOTH_OTA_STATE_IDLE,
GOLIOTH_OTA_REASON_READY,
true,
true,
true);

GLTH_LOGI(TAG, "Waiting to receive OTA manifest");

while (1)
Expand All @@ -386,6 +378,27 @@ 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,

Check warning on line 385 in src/fw_update.c

View check run for this annotation

Codecov / codecov/patch

src/fw_update.c#L385

Added line #L385 was not covered by tests
GOLIOTH_OTA_STATE_IDLE,
GOLIOTH_OTA_REASON_READY,
true,
true,
false);
}
else
{
golioth_fw_update_report_state_sync(&_component_ctx,

Check warning on line 394 in src/fw_update.c

View check run for this annotation

Codecov / codecov/patch

src/fw_update.c#L394

Added line #L394 was not covered by tests
GOLIOTH_OTA_STATE_IDLE,
GOLIOTH_OTA_REASON_AWAIT_RETRY,
true,
true,
true);
}

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

0 comments on commit 505a7d0

Please sign in to comment.