Tell me what you want, What you really, really want.

Moderator: Mmiscool

User avatar
By Oldbod
#47096 I think there is confusion about the function of the wait command in esp8266basic. There is in my head anyway!

The language reference says

'Wait: sends all the accumulated gui commands to the browser. The browser will display once this command is run"

In other languages, "wait" might be pause for a time, or pause for an action (eg keypress or characters to arrive in a comms register or a pin to go high) or pause for an action but if it doesnt happen after specified time move on anyway.

Readling the code examples hasnt really left me any the wiser, in fact they look like the more historical usage but i think a bit less thought and a bit more trial and error probably would! My suspicion is they read like that to me, because thats what i expected to see...

If no " wait " command was issued, what would the effect be?
User avatar
By Electroguard
#47106 Forlotto please re-read this previous post, which made several points that you did not pick up on... viewtopic.php?f=43&t=9582&start=16
As for the point you made in response to it - well, I assure you I will keep this short and to the point.
Please assume that if I have posted a suggestion in this category I will ALWAYS have thought long and hard about it first - for three important reasons
1. To not make a possible fool of myself by speaking without sufficiently thinking first.
2. To ensure the suggestion is for the future benefit of ESP_Basic rather than just myself.
3. To not unnecessarily waste the precious time of our 2 wizards, who this category is addressed to.

So please conclude in future that I will not be wearing a gopro camera to help the comprehension of others who the suggestion is not addressed to, nor will I appreciate the non-relevent and, quite frankly insultingly trival, comments of someone who by their own admission does not even understand what I am talking about!
Perhaps my explanation to mmiscool was still insufficient to get my point across, but I can assure you that your intervention has certainly not helped matters, and again served to stir up muddy confusion to terminate yet another potentially beneficial suggestion. Forums are all about people offering their advice, but it should be advice welcomed by ears other than our own.
User avatar
By Mmiscool
#47129 I am going to clarify the wait command a bit and talk about the new command jut added to the latest build called returngui.

The wit command will return the html buffer (the whole gui for the device) and puts the device in to a state where it is waiting for browser interaction. It is important to be in a wait state in order for any button presses in the browser to actually execute thee branch on the esp.

The wit command allows an endless loop of checking the interrupt inputs and listening for http requests to run on the device. This is what allows the html buffer to be sent to the browser.

The new command returngui will allow you run code after the browser response is sent but in order for the device to be responsive to any button presses from the browser it still needs to be put in to a wait state.


The below example will enplane the functionality. Note that if you refresh the page after it i run you will see both print statement and not just the first one like when it was first run.

Code: Select allprint "This will show up on the serial and the browser"
returngui
print "This will show up only on the serial"
wait
User avatar
By Electroguard
#47132 I think that would be perfect, but it's not working as explained for me.

I downloaded A24, and it is recognising the new command ok cos it doesn't error.
But both lines are displayed at the same time.

Conversly, I tried using it in my udp demo script to display bootup msg, which it did, but then it didn't continue or do anything else after.

EDIT - I did see get to see the single line, but only once, nearly all the time I see both lines together, and several times I've just had a blank screen. A24 seems to have lost a lot of its previous stability - Saves are very random, but so is Run, and disconnection timeouts now seem as likely as not.