Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix state machines #86

Merged
merged 1 commit into from
Feb 28, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions app/src/modules/fota/fota.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ enum fota_module_state {
STATE_WAITING_FOR_IMAGE_APPLY,
/* The FOTA module is waiting for a reboot */
STATE_REBOOT_NEEDED,
/* The FOTA module has been canceled, cleaning up */
STATE_CANCELED,
/* The FOTA module is canceling the job */
STATE_CANCELING,
};

/* User defined state object.
Expand Down Expand Up @@ -148,7 +148,7 @@ static const struct smf_state states[] = {
NULL,
&states[STATE_RUNNING],
NULL),
[STATE_CANCELED] =
[STATE_CANCELING] =
SMF_CREATE_STATE(state_canceling_entry,
state_canceling_run,
NULL,
Expand Down Expand Up @@ -266,7 +266,7 @@ static void state_running_run(void *o)
const enum fota_msg_type msg_type = MSG_TO_FOTA_TYPE(state_object->msg_buf);

if (msg_type == FOTA_DOWNLOAD_CANCEL) {
STATE_SET(fota_state, STATE_CANCELED);
STATE_SET(fota_state, STATE_CANCELING);
}
}
}
Expand Down Expand Up @@ -373,6 +373,9 @@ static void state_downloading_update_run(void *o)
case FOTA_IMAGE_APPLY_NEEDED:
STATE_SET(fota_state, STATE_WAITING_FOR_IMAGE_APPLY);
break;
case FOTA_SUCCESS_REBOOT_NEEDED:
STATE_SET(fota_state, STATE_REBOOT_NEEDED);
break;
case FOTA_DOWNLOAD_CANCELED:
__fallthrough;
case FOTA_DOWNLOAD_TIMED_OUT:
Expand Down
Loading