Page 1 of 1

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

Posted: Fri Aug 25, 2023 3:02 pm
by ullixesp
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.

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

Posted: Sat Aug 26, 2023 12:04 am
by lbernstone
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?

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

Posted: Sat Aug 26, 2023 6:04 am
by ullixesp
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?