Skip to content

Commit b756f53

Browse files
committed
modules: fota: fix ci
CI fails becuase the full modem FOTA image is applied twice. This is triggered by two network disconnect events coming in close succession causing the FOTA_IMAGE_APPLY event to be sent twice in main.c Also, correct state name in fota.c to reflect internal state documents. Signed-off-by: Simen S. Røstad <simen.rostad@nordicsemi.no>
1 parent c57f3d2 commit b756f53

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

app/src/modules/fota/fota.c

+7-7
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ enum fota_module_state {
6262
/* The module is waiting for the event FOTA_IMAGE_APPLY to apply the image */
6363
STATE_WAITING_FOR_IMAGE_APPLY,
6464
/* The FOTA module is waiting for a reboot */
65-
STATE_REBOOT_NEEDED,
65+
STATE_REBOOT_PENDING,
6666
/* The FOTA module is canceling the job */
6767
STATE_CANCELING,
6868
};
@@ -100,7 +100,7 @@ static void state_downloading_update_run(void *o);
100100
static void state_waiting_for_image_apply_entry(void *o);
101101
static void state_waiting_for_image_apply_run(void *o);
102102

103-
static void state_reboot_needed_entry(void *o);
103+
static void state_reboot_pending_entry(void *o);
104104

105105
static void state_canceling_entry(void *o);
106106
static void state_canceling_run(void *o);
@@ -136,8 +136,8 @@ static const struct smf_state states[] = {
136136
NULL,
137137
&states[STATE_RUNNING],
138138
NULL),
139-
[STATE_REBOOT_NEEDED] =
140-
SMF_CREATE_STATE(state_reboot_needed_entry,
139+
[STATE_REBOOT_PENDING] =
140+
SMF_CREATE_STATE(state_reboot_pending_entry,
141141
NULL,
142142
NULL,
143143
&states[STATE_RUNNING],
@@ -375,7 +375,7 @@ static void state_downloading_update_run(void *o)
375375
&states[STATE_WAITING_FOR_IMAGE_APPLY]);
376376
break;
377377
case FOTA_SUCCESS_REBOOT_NEEDED:
378-
smf_set_state(SMF_CTX(state_object), &states[STATE_REBOOT_NEEDED]);
378+
smf_set_state(SMF_CTX(state_object), &states[STATE_REBOOT_PENDING]);
379379
break;
380380
case FOTA_DOWNLOAD_CANCELED:
381381
__fallthrough;
@@ -421,7 +421,7 @@ static void state_waiting_for_image_apply_run(void *o)
421421

422422
break;
423423
case FOTA_SUCCESS_REBOOT_NEEDED:
424-
smf_set_state(SMF_CTX(state_object), &states[STATE_REBOOT_NEEDED]);
424+
smf_set_state(SMF_CTX(state_object), &states[STATE_REBOOT_PENDING]);
425425
break;
426426
default:
427427
/* Don't care */
@@ -430,7 +430,7 @@ static void state_waiting_for_image_apply_run(void *o)
430430
}
431431
}
432432

433-
static void state_reboot_needed_entry(void *o)
433+
static void state_reboot_pending_entry(void *o)
434434
{
435435
ARG_UNUSED(o);
436436

app/src/modules/network/network.c

-2
Original file line numberDiff line numberDiff line change
@@ -376,8 +376,6 @@ static void state_disconnected_entry(void *obj)
376376

377377
LOG_DBG("state_disconnected_entry");
378378

379-
network_status_notify(NETWORK_DISCONNECTED);
380-
381379
/* Resend connection status if the sample is built for Native Sim.
382380
* This is necessary because the network interface is automatically brought up
383381
* at SYS_INIT() before main() is called.

0 commit comments

Comments
 (0)