Place to put your Basic demos and examples

Moderator: Mmiscool

User avatar
By Electroguard
#65374 There is an elusive bug hiding in Esp_Basic which causes those strange unpredictable intermittent problems.

This 'quantum weirdness" starts becoming apparent as the script grows in complexity, especially as more info gets written to the browser web page.
There is no magic fix, but you can keep struggling on for a while so long as you are aware that you will be pushing an overloaded wonky wheel-barrow across a sagging plank which will get ever more likely to collapse under the strain and ever steeper the further you go.

The first signs of quantum weirdness are when doing a SAVE causes the esp device to reboot. Even though it may have returned a 'Saved ok' confirmation after reconnection, there is now a real possibility that the saved file is corrupted, so it's best not to load the script back from the device using EDIT in order to prevent loading corruption, and make sure that you frequently save the script to computer text file.

Typically, every alternate SAVE will cause a device reboot. I found this unworkable with Chrome, but Firefox eventually reconnects back up to the rebooted device and the web page becomes responsive again, offering the opportunity for doing another SAVE, which hopefully this time will return a 'Saved ok' confirmation without causing the device to reboot.

Even if your script has SAVEd ok it may not RUN properly. Typically it may not correctly display all elements of the web page, ie: some may have incorrect lengths and widths or missing backrounds etc. Many times, simply doing a browser BACK then another RUN may display things correctly (or with different errors) but other times those same errors persist until another successful non-rebooting SAVE is performed.

You can lighten the load by temporarily 'commenting out' completed but non-crucial chunks of script, or you can even create your own 'debug flags' to temporarily avoid displaying some things to screen, with the eventual intention of putting everything back in place once each chunk is debugged and working.

So it may be possible to continue development for quite some time by 2nd SAVEing again directly after a reboot, but with the caveat that the web page may eventually display correctly, but not necessarilly first time each time.

If you reach the stage where the second alternate SAVE does not correct the display errors, you are now teetering on the brink of total collapse. You might just manage to keep going a bit longer by doing 2 good SAVES in quick succession after the rebooted SAVE, or you might scrape things along a bit more my powering off the device then back on again and doing a clean successful SAVE without any accumulated VARs baggage.

Continued persistence is now likely to result in Esp_Basic interpreter corruption - which is likely to have you wasting much time chasing ghosts... until you eventually twig the reason for the frustrations, and do an inevitable reformat and reflash. If you haven't achieved your original intentions by now, this would be a good point to re-evaluate and consider compromise or alternatives.
User avatar
By Mmiscool
#65375 If you are using the cssid command it keeps outputting the case to the bottom of the page. You can check this by doing a view source from the browser.

You could use JavaScript in the web browser to do things to the page with out getting the esps limited memory involved.
User avatar
By Pierre
#65381 Hi Electroguard / Mmiscool

Thank you for the quick responds. Electroguard, your response is exactly word for word as I experienced it. From the saving issues up to Firefox working the best as with my own experiments. Could you just clear up something for me, do you think it is an issue with ESP8266Basic or with the 4M memory limitations of the module? In other words should I rather pursue another language using the Arduino IDE or other platforms and languages or try other options with ESP8266Basic. Would it work if I split some of the functions, for example the setup part of the automated switch on and of times and do this on a separate page just to set the variables. The main page will then be much smaller, but how do you call one page and then return. I assume you will use LOAD: command. My question is the following: If you load a new page, does it remove the previous page from memory and does any of the variables change when you move between pages. Please try to be patient and I am totally unfamiliar with ESP8266Basic. If it is possible, then maybe I could get the project to work with ESP8266Basic .

Thanks
Pierre
User avatar
By Pierre
#65384 Hi

I think I found the usage of LOAD in another post and as stated by Mmiscool it will keep the variable values. Another thing, should I format the module before I flash or only do a flash? Another question, the SETTINGS page does not have a "Network Scan" function, is this also because the page will crash when it becomes to complex or did this not come up as a requirement? Will it be possible to load the SETUP page from a basic page and how would you return if possible.

Regards
Pierre