It’s my first post here so at the beginning I want to introduce myself
My name is Radek and I’ve used Blynk in 2 of my projects for now, one to operate my gate opener and one to read temperature values from my furnance.
But back to the issue I have, after a few trips to my basement with the laptop and cable I’ve decided to implement OTA update in my code, after some research (on this forum of course ) I’ve integrated Web Browser OTA code into my Blynk sketch.
And everything worked fine at the beginning, temps in the app were correct and I was able to upload sketch through web browser, but after a few hours I’ve noticed that “Device was disconnected.” message pops up in the app every few seconds.
I know what you are thinking right now “another guy that uses Delays or stuffed a lot of instructions in the Loop function” but my loop function looks like this:
It looks like httpServer.handleClient(); is causing some delays and my device is considered as offline by the server, is that correct? Is there a way to solve this?
Thanks in advance.
Oh, by the way my device is NodeMCU v2, and if all of the code is needed I will post it here, just let me know.
Yeah, you are talking about Classic OTA Update, through Arduino IDE, but that wasn’t working consistently for me, and thanks to web browser update i was able to upload sketch to ESP using my android device (loading sketch to phone memory before of course)
I took inspiration from http://esp8266.github.io/Arduino/versions/2.0.0/doc/ota_updates/ota_updates.html#web-browser
ok, i see.
but why classic ota didn’t work for you? probably millions esp8266 boards use it without problems…
just my opinion, it would be better to debug why ota is not working for you as expected, than upload code from ide to phone and from phone to mcu every time.
Hi,
I’m sorry for the writing, I’m on the phone.
Try to put a condition on the loop to execute handleclient().
I added a push button widget on my project to execute the web update.
When I press the button, my sketch execute the webupdate.
Yes, it makes sense, in fact I did something similar before but it didn’t help.
But your sketch is slightly different, you are setting up MDNS in the BLYNK_WRITE function, in my previous sketch i left this in the Setup function (BLYNK_WRITE was used only to assign value to my updateWeb variable) and you also uses Blynk.disconnect();.
I will check your solution as soon as I will return to home and I will let you know.
The reason why it does not work in the function, is because you are making a new instances everytime of the MDNS and Httpupdater. Multiple instances will be started and will at the end create stack problems and uncontrollable behavior. So keep de httpupdater.setup and MDNS.addservice etc in the setup();