If you are using OTA and you want to use Deep sleep - you will come to the point where you are not able to upload your new firmware just because device is sleeping.
Here is a nice and clever way to make your device ask for update when it wakes up from deep sleep.
Continuus Delivery with OTA
-
The build is tagged with a version number using PlatformIO build-flag
-
A web server with an intermediate PHP script loads
version.json
file to check the latest release version and returns this as a string. -
ESP sends it’s current running firmware version to the PHP script using
tag argument&tag=0.0.1
-
If the running firmware version does not match the latest release version, the PHP script grabs the latest release
firmware.bin
from the same web server and serves it up as a download to the ESP. -
ESP then flashes the compiled
firmware.bin
OTA update using the ESP8266httpUpdate library which is built-in to the espressif Arduino tool-chain
How to upload new firmware?
firmware.bin
is located .pioenvs / board
folder.
In my case it is .pioenvs /d1_mini
folder
Just copy the firmware.bin
to the web server folder then update the file version.json
with editor changing "tag_name": "0.0.1",
for example to "tag_name": "0.0.2",
Then on next wake up device will see that it needs to update its firmware.
Thanks to :
and