Can it be determined that a boot came as consequence of an upload?

ullixesp
Posts: 83
Joined: Wed Oct 16, 2019 9:34 am
Location: Germany

Can it be determined that a boot came as consequence of an upload?

Postby ullixesp » Fri Aug 25, 2023 3:02 pm

I'd like to mark some log data with "after upload" when a boot came as a consequence of an upload, versus a "regular boot" like after the boot button pressed.

Is that possible? I am using the Arduino framework under platformio with an Espressif ESP32-dev board.

lbernstone
Posts: 831
Joined: Mon Jul 22, 2019 3:20 pm

Re: Can it be determined that a boot came as consequence of an upload?

Postby lbernstone » Sat Aug 26, 2023 12:04 am

OTA doesn't actually restart the system when complete, you have to do that. So, there's not really any way to signal that, and it isn't really a good method to use anyhow (someone might unplug the device after upgrading, and then you miss it).
Why not just throw a flag into nvs/Preferences after the upload is complete, and process for that at startup?

ullixesp
Posts: 83
Joined: Wed Oct 16, 2019 9:34 am
Location: Germany

Re: Can it be determined that a boot came as consequence of an upload?

Postby ullixesp » Sat Aug 26, 2023 6:04 am

Setting a flag is what I want, but I am not talking about OTA (which I use and it works). I have the ESP connected via USB cable. After modifying my code I compile, build and upload (all under platformio in vscode). Then the ESP automatically boots. It is this boot which I want to register, and not any other boots, be they after a crash, or after intentional reboot via code, or after pressing the boot button.

Is that possible?

Who is online

Users browsing this forum: No registered users and 38 guests