Place to put your Basic demos and examples

Moderator: Mmiscool

User avatar
By tcontrada
#49338 Is there a good way to keep the screen from going blank (CLS) before displaying the opposite image button?

I guess for practical use in the UI it appears that the screen is refreshing...
User avatar
By forlotto
#49360 Sure there is ... You could have two separate image buttons 1 on and 1 off.

You could also just create a webpage pointing to the ip and the device and use html5 with javascript this way the webpage will simply be run from your pc with more horsepower.

You could also create a phone application with a toggle button pointing to the pertinent info.

I think that refresh after click is essentially what it does it changes from one image to another so it must reload the appropriate image this thing is not exactly a speed demon however basic seems to have it running on steroids already compared to the others.

As far as making the response for image button faster or the cls to happen faster it is possible that a better connection to your router or the device may help. Possibly a different web browser. firefox or chrome etc try disabling any web browser plugins that may be causing issues with latency as well as clearing your browser history and saved data etc... I don't know that you will be able to get it perfect but these things may get you closer ... You may also try to upgrade your mechanical hard drive to an SSD to improve all your data rates. It is amazing what a difference all these things can make.

Hrmmm short of that I don't know how much faster the response can be maybe it is possible to transition to the other pic faster somehow IDK last I knew the esp8266 is already over clocked using the fastest methods of data transfer possible the more things that are added as features the more run code the more latency but thus far I believe they are all acceptable as a personal preference if it is a problem these are the solutions I use ... However, if there is anything else I am not aware of maybe mmiscool or cicciocb might have some answer for yah.

Hope this is helpful,

forlotto
User avatar
By forlotto
#49364 @mmiscool
Would it be helpful if you put the code higher on the list for real time things so it would find param0 quicker?

Reboot should be dead last one would think... Yet it is the first thing you look for.

A timer should likely be first on the list
next graphical items
etc...

I believe that possibly organizing the code so that it checks for more real time or intense things first might help but I am not a genius here it just seems that ms would matter in this case.

for instance if you put this code somewhere towards the top:

Code: Select allif (Param0 == F("imagebutton"))
  {
    NewGuiItemAddedSinceLastWait = 1;
    numberButtonInUse++;
   Param1 = evaluate(Param1);
    String tempButton = GenerateIDtag(GOTOimagebutton);
    if (Param1.startsWith(F("http://")) | Param1.startsWith(F("HTTP://")) )tempButton.replace(F("/file?file="), "");
    tempButton.replace(F("gotonotext"),  Param1);

    tempButton.replace(F("gotonobranch"),  String(JumpList.getPos(Param2)));

    HTMLout = String(HTMLout + tempButton);
    return;
}


It is one big looped if then statement checking for parameters. Maybe even have cls command towards the top as well IDK but I figure these things will likely save time when I think of it...

Same thing in the eval ino...

Organizing how things are checked should maximize execution at the best possible speed. I remember looking at an emulator of code going through a loop although I didn't know jack about it it was interesting to see the loop it took and how it ran through a buncch of code rather quickly but the less code you must run through the less time it took to arrive and do its thing.

So this is assumption I guess purely so forgive me if this is incorrect in the way that I am thinking.

@tcontrada
here is an html example of a toggle button maybe you could modify the code to fit your needs a bit better.
viewtopic.php?f=40&t=10130

forlotto