Improvements for Arduino code
Opened this issue · 3 comments
I suggest the following improvements on your "boot as AP first" code.
- Set the MQTT port to 1883 by default
- In addition to the "Boot as AP on GPIO 0, add a "Clear EEPROM" function on another GPIO
And of course, FOTA :)
(F)OTA is requested in #27, by using a specific MQTT message with a URL from where the device can download a new firmware. Are there better ways? like directly uploading a file from a browser, or are we then just making a mess having to parse multipart form-encoded content?
I have only been experimenting with FOTA a little while, but my preferred method is something like mosquitto_pub -t 'my/topic/update' -m 'http://my.local.webserver/firmware.bin'
This way the ESP only need to subscribe to one topic and download the .bin when asked to.
Your other proposal means that the ESP need to run as a WebServer, and I guess the code would need to be a bit more complicated.
There is an implementation that is very close to your suggestion in a project I did a while ago here: https://github.com/xnsense/xns-client/blob/master/xnsclient.cpp#L350