Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: is there a maximum number of controls? #92

Closed
ericBcreator opened this issue Sep 20, 2020 · 25 comments
Closed

Question: is there a maximum number of controls? #92

ericBcreator opened this issue Sep 20, 2020 · 25 comments

Comments

@ericBcreator
Copy link
Contributor

When using tabs, selection lists, sliders (with min and max controls), etc. the number of controls add up fast.
I notice that when I have more than ca 75 controls and/or increase ESPUI.jsonInitialDocumentSize > ca 9200, the web interface will load but I only see 'Control Connected', the rest of the webpage is empty.

Is that a limitation? Is there a workaround?

Note: I'm using an ESP8266 (Wemos D1 mini V3).

@ericBcreator
Copy link
Contributor Author

ericBcreator commented Sep 30, 2020

Giving feedback to my own question: after getting feedback on one of my projects I find out you can connect to ESPUI in 2 ways (2 IP's).
The 1st is the access point set up by the ESP and the 2nd is the local IP (provided the ESP connects in WIFI_AP_STA mode and connects to a lan).

Using the local IP, I have none of the issues mentioned above which occurred in AP mode.
That leads to the conclusion the issues are (mostl likely) due to a less stable or poor quality Wifi connection.
BTW: distance should hardly be the issue, with the test setup the ESP and PC with Wifi connection are hardly 0,5 mtr apart.

@s00500
Copy link
Owner

s00500 commented Oct 1, 2020

one thing to also try is using the ESP32, as it tends to be more stable...

@ericBcreator
Copy link
Contributor Author

OK, thanks and certainly worth a try but I just had the problem with the local IP also.

Maybe the number of controls is not the issue as now it seems there is an occasional problem with the slider, here is a screenshot of the blank page and the debugger (all 340 errors are the same):

espui-error-no-ctrols

BTW: I didn't check the debug messages when I thought the number of controls was the issue so it could be the same error.

Controls.js:2 is this call:

        case UPDATE_SLIDER:
            slider_move($("#id" + t.id), t.value, "100", !1);

and slider.js:12 this one:

var number = parents.attr("id").substring(2);

in context of the slider_move function:

    if (parents.find(".slider-handle span").text() != slider_new_val) {
        parents.find(".slider-handle span").text(slider_new_val);
        var number = parents.attr("id").substring(2);
        if (send)
            websock.send("slvalue:" + slider_new_val + ":" + number);
    }

So apparently var number = parents.attr("id").substring(2); causes the error.

What makes no sense to me is why sometimes this error occurs and other times not, with the same code. This is a screenshot of the same setup and code, after restarting (power cycle) just after I got the above errors. Now it's displaying correctly without errors:

espui-error-no-ctrols-1

Any idea?

@ericBcreator
Copy link
Contributor Author

I did some more testing, here posting my results (on a ESP8266 - Wemos D1 mini).

59 controls, number instead of slider controls (no min & max): stable
79 controls, number instead of slider controls (with min & max): very unstable

59 controls, 10 sliders (no min & max): moderate stable

52 controls, 1 slider : stable
55 controls, 2 sliders: stable

58 controls, 3 sliders: moderate stable
61 controls, 4 sliders: moderate stable
64 controls, 5 sliders: moderate stable

67 controls, 6 sliders: very unstable
70 controls, 7 sliders: very unstable
73 controls, 8 sliders: very unstable
76 controls, 9 sliders: very unstable
79 controls, 10 sliders: very unstable

69 controls, 10 sliders (only max): very unstable

With stable I mean when you open a browser and navigate to the ESP and presh F5 (refresh) ca 10 times, how many times the controls will display or only 'Control connected' will appear.

My conclusion is it still seems a problem with the number of controls and not the slider (per se). The limit, however, does not seem a fixed number but fluctuating.

Note: when 64 controls is moderate stable, I mean that ca 5 out of 10 times the controls would display and 5 out of 10 not. The 1st slider ID would cause the mentioned JS error. However when using strictly number controls with min and max and a control count of 79, there would be no JS error but still only the 'Control connected' would appear. So the same issue without the error message.

BTW: increasing ESPUI.jsonInitialDocumentSize had no effect, it would only trim off controls if set too small.

@s00500
Copy link
Owner

s00500 commented Oct 2, 2020

yes, it is probably a stability issue with the websocket connection as well... pretty tough to investigate I guess

@ericBcreator
Copy link
Contributor Author

Yeah, a strange issue as well.
I'll hook up an ESP32 and check how it performs.

@ericBcreator
Copy link
Contributor Author

OK, I got back to this: how did you get the ESP32 to compile?
The ESP8266 compiles correctly but for the 32 I get a missing LittleFS error:

fatal error: LittleFS.h: No such file or directory

BTW: I'm using the latest Arduino IDE version and ESP32 board definitions.

@s00500
Copy link
Owner

s00500 commented Oct 15, 2020

Did you use the master version of espui ? otherwise what line is the error in ?

@ericBcreator
Copy link
Contributor Author

ericBcreator commented Oct 16, 2020 via email

@s00500
Copy link
Owner

s00500 commented Oct 18, 2020

The PR seems still open, little fs support is not yet ready for esp32, that is why I added a fix in ESPUI to fall back to SPIFFS for esp32... seems like I did not merge it, now it has some pretty nasty merge conflicts with the last PR I merged, so I will have to fix this...

@s00500
Copy link
Owner

s00500 commented Oct 18, 2020

Can you test the branch fix_littlefs_esp32 ? I think I have cleaned the mess successfully...

@s00500
Copy link
Owner

s00500 commented Oct 18, 2020

Master should also be fixed now, if it works I will make a release

@ericBcreator
Copy link
Contributor Author

ericBcreator commented Oct 18, 2020

OK, I'll test it, just working on the ESP32.

BTW, it might be of interest to you: I just got the ESP32 with the current ESPUI master and the https://github.com/lorol/LITTLEFS library to compile and upload correctly with very little editing of the code.

It is working fine when not using the filesystem. And it does seem to solve the initial problem I have with the ESP8266 not showing the controls when going over roughly 70.

But when I use the filesystem, I get 'control offline'. Checking the debug messages, I see this when the UI starts:

Listing directory: /
  FILE: /index.htm  SIZE: 1492

So, it seems OK, at least a file was written. And I also get the listing of all the controls.
I compared it to using it without filesystem and what is missing are these lines (note: I clipped the long list of controls):

Connected: 1
{"type":200,"sliderContinuous":false,"controls":[{"type":0,"label":"  ericBclock-01-A24"},{"id":"1","type":11,"label":"Main settings","value":"Main settings","color":1},
JSON Data Sent to Client!

So, it doesn't seem to connect and send the data when using the (ESP32 littlefs) filesystem. Any idea why?

@ericBcreator
Copy link
Contributor Author

Can you test the branch fix_littlefs_esp32 ? I think I have cleaned the mess successfully...

Yep, it is working fine for me (ESP-WROOM-32).

Littlefs support for the future would be nice though, it is noticably faster.

@s00500
Copy link
Owner

s00500 commented Oct 19, 2020

alright, but I would like to not add another dependency to the project, do you think littlefs support will get merged into arduino-esp32 eventually?

@ericBcreator
Copy link
Contributor Author

Fair point, it only adds complicity.
Probably littlefs will be merged eventually but browsing on github didn't give me a definitive answer. And new releases seem sparse.

Still figuring out the issue with many controls & the blank screen on the ESP8266. Around 60 is buggy, no problems with over 75 on the EPS32, yet. Debug settings didn't give a clue.
Maybe the ESPAsyncTCP library for the 8266 is tripping (unlike the AsyncTCP library for the 32).
I'll see if I can do some debugging.

Note: I did run into one cosmetic issue with fix_littlefs_esp32: the 4 arrows on the pad are not displaying correctly:

espui-32-pad-arrow-error

@s00500
Copy link
Owner

s00500 commented Oct 20, 2020

That is funkey... is this also true for the current release version and in all browsers ? otherwise please specify where it happens and where not...

@ericBcreator
Copy link
Contributor Author

ericBcreator commented Oct 21, 2020 via email

@ericBcreator
Copy link
Contributor Author

Regarding the start of the issue, the max. number of controls: I spend several hours retracing and checking debug messages of the libraries ESPUI depends on but didn't run into obvious errors or encountered new settings I could adjust, like increasing buffer sizes or other limits.
Further investigating several libraries 2 levels below my main projects is taking up too much time and gets me too much sidetracked so I'll stop it here.

I tested a couple of ESP32's (WROOM32) with over 170 controls and they worked fine.
I tested several ESP8266 boards (Wemos D1 mini and NodeMCU) and over around 60 controls the web interface increasingly stops appearing. BTW: increasing ESPUI.jsonInitialDocumentSize over 10000 also does.

So for now my conclusion would be to keep the total number of controls under 60 for an ESP8266 and use and ESP32 when you have more.
That won't solve the problem for finished 8266 projects and too much controls though...

@ericBcreator
Copy link
Contributor Author

Getting back to this issue:

96496754-ee02b700-1249-11eb-96aa-bffc7a2b37c5

It appears it is NOT solved yet, for both the ESP8266 and ESP32.
The garbled characters instead of arrows appear when NOT using the filesystem.
No problem when using the filesystem.

@iangray001
Copy link
Collaborator

Hi Eric, I note that you didn't mention the browser on which you are getting strange characters. The pad is constructed from a pile of CSS so I could imagine that it doesn't work on all browsers, but it seems fine everywhere I've seen it.

@ericBcreator
Copy link
Contributor Author

ericBcreator commented Jan 15, 2022 via email

@iangray001
Copy link
Collaborator

Great. So clarify my recent tranport update is not merged yet. It is this branch: https://github.com/iangray001/ESPUI/tree/chunkupdates2

@ericBcreator
Copy link
Contributor Author

ericBcreator commented Jan 15, 2022 via email

@iangray001
Copy link
Collaborator

Closing this now as I think everything in this thread is dealt with. Reopen if not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants