Revert back to old firmware on OTA Update

Hello,
Below are the details of my issue.
1. My goal is:
Perform OTA firmware upgrade via iOS/Android/web app
2. My actions are:
I check for current firmware vs. new firmware, if there is a difference I ask user if he wants to update. If user select “Yes” OTA update is deployed.


3. The result I see is:
New firmware seems deployed to the device
4. My expectation & question is:
Why after reset I have back old firmware? Meaning go back to step 1 from above picture. For sure I’m doing something wrong…but what?

Thanks.

As per the docs, are you calling OTA.Commit after the update to stop the device from reverting back to old firmware??

https://mongoose-os.com/docs/mongoose-os/userguide/ota.md

It’s seems that I skip that part.
From what I understand after firmware is deployed I need to perform a OTA.Commit.
Is this possible to set it so that is don automaticaly?

Seeing as you can perform RPC from within your code using RPC loopback, I had planned to write a startup test function that call OTA.Commit on boot if all tests passed.

I haven’t done this yet so can’t say if this is the right way.