Example sketches for the new Arduino IDE for ESP8266

Moderator: igrr

User avatar
By penatenjoe
#33710 woah, you are always a couple of steps ahead. Thanks for the hints. Ok, just making sure I understood: If I upload the sketch but do not see the board listed there are two options a) wait 10 min or b) restart the IDE. I didn't try the first option but I thought I tried the second - but apparently not with a working sketch. Based on what I tried and what you wrote my guess is that you have to include the telnet code for setting up the communication. Can you say how the minimal code looks like? Maybe one has to also keep the Telnet.read() code to ensure data is not stuck in a read buffer?

EDIT:
Maybe someone can also help me my making the attached script work? As mentioned above OTA update failed if I added a simple webserver to the sketch. When I open the IP of the ESP8266 in a browser the served page runs a script which asks for data once per second. During an OTA update at some point one can see that there is no data coming anymore but the update process terminates with an error. With no browser window running the script it worked fine. I suspect it may be good if I could stop the server on the ESP but don't know how to do that.
I think the tested scenario could happen in a real application as well so I appreciate any help to solve this.
Thanks again, Bernd
You do not have the required permissions to view the files attached to this post.
User avatar
By krzychb
#34538 Hi Bernd,

I have checked your sketch and it fails for me as you described. I gave up trying after one or two attempts to upload.

Then I have implemented your server using latest ArduinoOTA library. It fails in about 3/4 attempts to upload (about 25% OTA uploads are successful). Please see screenshots below.
The moment when upload fails is random – typically it happens between 60% and 90% of completion.
OTA Update Failed.PNG

OTA Update Succesfull.PNG

Here is my sketch if you like to check it.
BasicOTA_AndServer.zip

Have you considered stopping Ajax in web browser so no XML is pulled from ESP? I would search how to reload the whole web page that contains Ajax with some other page that is "OTA safe". This should be done on OTA start using:

Code: Select allvoid onStart(OTA_CALLBACK(fn));

Apart of that I would ask for help under https://github.com/esp8266/Arduino/issues . There are several nice and clever people there that may be able to point us to a solution or at least tell that we are doing something horribly wrong and “why is it so” :D

Krzysztof

P.S .you have prepared nice fully featured and well documented test sketch!
You do not have the required permissions to view the files attached to this post.
User avatar
By penatenjoe
#34549 Hi Krzysztof,
stopping the Ajax script could certainly be done. The easiest is to close the browser before updating which I successfully tried. Of course one could add some logic to stop the script asking for data. I haven't done that because in my tests opening a browser window and entering the address of the module while updating made the OTA update process fail too. That certainly could be a real-life scenario for which I cannot see a cure yet. The Ajax script is a little esoteric but was an easy way to make the failure reproducible.
What I tried was to add a "server.stopAll()" method by modifying the library which stopped all "server.on()" routines. That did not help. At that point I suspended my search because I noticed that the OTA library was coming. Unfortunately as you showed the issue persists.

To me it seems as if the OTA update may fail on any incoming request.
User avatar
By mkeyno
#35186 hi guys
still don't get what is Arduino OTA use for!!!
, I uploaded the sketch and every things looks normal but try different ip , domain and port , but nothings happened both in address bar and serial terminal
there is no good guide in sketch
any help really appreciated