Hieromon / AutoConnect

An Arduino library for ESP8266/ESP32 WLAN configuration at runtime with the Web interface
https://hieromon.github.io/AutoConnect/
MIT License
889 stars 185 forks source link

Apparent limit on pages with large number of ACSelect elements #592

Closed ghmpi closed 1 year ago

ghmpi commented 1 year ago

I seem to be having a problem, maybe a bug or a size limit, I'm not too sure. If put too many large ACSelect elements (pulldown boxes) in a custom page, it will not work. The title on the menubar does not display and the page where the html is supposed to be.. in this example "/alarm".. it gives me a 404 error.

I don't think it's a limit on the actual size of the char itself, as I can make it pretty big with other text and various elements and it will still work. It's just it doesn't seem to like to many, or long ACSelects.

One curious behavior is the SAME code works on a ESP32wrover module, but moving the code to a ESP32-C3 will cause this problem and apparent limit.

I turned on debug on both autoconnect and pagebuilder. The only line about the alarm page is: [AC] /alarm not registered, handler ignored

Sample page code below, first one works with a limited number of select options in ALARMxMIN, second one that has more pulldown choices does not work on a ESP32-C3.

Thank you!

Regards, -Moses

//// THIS IS WORKING WORKING

const char PAGE_ALARM[] PROGMEM = R"( { "uri": "/alarm", "title": "Alarm", "menu": true, "element": [ { "name": "SETTING_ALARM1ENABLE", "type": "ACCheckbox", "value": "1", "label": "Alarm 1 Enable", "checked": "false", "global": "true"}, { "name": "SETTING_ALARM1SUN", "type": "ACCheckbox", "value": "1", "label": "S", "checked": "false", "posterior": "none"}, { "name": "SETTING_ALARM1MON", "type": "ACCheckbox", "value": "1", "label": "M", "checked": "false", "posterior": "none"}, { "name": "SETTING_ALARM1TUE", "type": "ACCheckbox", "value": "1", "label": "T", "checked": "false", "posterior": "none"}, { "name": "SETTING_ALARM1WED", "type": "ACCheckbox", "value": "1", "label": "W", "checked": "false", "posterior": "none"}, { "name": "SETTING_ALARM1THU", "type": "ACCheckbox", "value": "1", "label": "Th", "checked": "false", "posterior": "none"}, { "name": "SETTING_ALARM1FRI", "type": "ACCheckbox", "value": "1", "label": "F", "checked": "false", "posterior": "none"}, { "name": "SETTING_ALARM1SAT", "type": "ACCheckbox", "value": "1", "label": "S", "checked": "false"}, { "name": "SETTING_ALARM1HOUR", "type": "ACSelect", "option": [ "00 / 12 AM", "01 / 1 AM", "02 / 2 AM", "03 / 3 AM", "04 / 4 AM", "05 / 5 AM", "06 / 6 AM", "07 / 7 AM", "08 / 8 AM", "09 / 9 AM", "10 / 10 AM", "11 / 11 AM", "12 / 12 PM", "13 / 1 PM", "14 / 2 PM", "15 / 3 PM", "16 / 4 PM", "17 / 5 PM", "18 / 6 PM", "19 / 7 PM", "20 / 8 PM", "21 / 9 PM", "22 / 10 PM", "23 / 11 PM" ], "label": "Time", "posterior": "none"}, { "name": "SETTING_ALARM1MIN", "type": "ACSelect", "option": [ "00", "05", "10", "15", "20", "25", "30", "35", "40", "45", "50", "55" ], "label": "", "posterior": "none"}, { "name": "SETTING_ALARM1DUR", "type": "ACSelect", "option": [ "Until canceled", "2 seconds", "5 seconds", "10 seconds", "30 seconds", "1 minute", "2 minutes", "3 minutes","4 minutes", "5 minutes", "6 minutes", "7 minutes", "8 minutes", "9 minutes", "10 minutes" ], "label": "Duration"}, { "name": "newline1", "type": "ACElement", "value": "


"},

{ "name": "SETTING_ALARM2ENABLE", "type": "ACCheckbox", "value": "1", "label": "Alarm 2 Enable", "checked": "false", "global": "true"},
{ "name": "SETTING_ALARM2SUN", "type": "ACCheckbox", "value": "1", "label": "S", "checked": "false", "posterior": "none"},
{ "name": "SETTING_ALARM2MON", "type": "ACCheckbox", "value": "1", "label": "M", "checked": "false", "posterior": "none"},
{ "name": "SETTING_ALARM2TUE", "type": "ACCheckbox", "value": "1", "label": "T", "checked": "false", "posterior": "none"},
{ "name": "SETTING_ALARM2WED", "type": "ACCheckbox", "value": "1", "label": "W", "checked": "false", "posterior": "none"},
{ "name": "SETTING_ALARM2THU", "type": "ACCheckbox", "value": "1", "label": "Th", "checked": "false", "posterior": "none"},
{ "name": "SETTING_ALARM2FRI", "type": "ACCheckbox", "value": "1", "label": "F", "checked": "false", "posterior": "none"},
{ "name": "SETTING_ALARM2SAT", "type": "ACCheckbox", "value": "1", "label": "S", "checked": "false"},
{ "name": "SETTING_ALARM2HOUR", "type": "ACSelect", "option":  [ "00 / 12 AM", "01 / 1 AM", "02 / 2 AM", "03 / 3 AM", "04 / 4 AM", "05 / 5 AM", "06 / 6 AM", "07 / 7 AM", "08 / 8 AM", "09 / 9 AM", "10 / 10 AM", "11 / 11 AM", "12 / 12 PM", "13 / 1 PM", "14 / 2 PM", "15 / 3 PM", "16 / 4 PM", "17 / 5 PM", "18 / 6 PM", "19 / 7 PM", "20 / 8 PM", "21 / 9 PM", "22 / 10 PM", "23 / 11 PM" ], "label": "Time", "posterior": "none"},
{ "name": "SETTING_ALARM2MIN", "type": "ACSelect", "option":  [ "00", "05", "10", "15", "20", "25", "30", "35", "40", "45", "50", "55" ], "label": "", "posterior": "none"},
{ "name": "SETTING_ALARM2DUR", "type": "ACSelect", "option":  [ "Until canceled", "2 seconds", "5 seconds", "10 seconds", "30 seconds", "1 minute", "2 minutes", "3 minutes","4 minutes", "5 minutes", "6 minutes", "7 minutes", "8 minutes", "9 minutes", "10 minutes" ], "label": "Duration"},
{ "name": "newline2", "type": "ACElement", "value": "<hr>"},

{ "name": "SETTING_ALARM3ENABLE", "type": "ACCheckbox", "value": "1", "label": "Alarm 3 Enable", "checked": "false", "global": "true"},
{ "name": "SETTING_ALARM3SUN", "type": "ACCheckbox", "value": "1", "label": "S", "checked": "false", "posterior": "none"},
{ "name": "SETTING_ALARM3MON", "type": "ACCheckbox", "value": "1", "label": "M", "checked": "false", "posterior": "none"},
{ "name": "SETTING_ALARM3TUE", "type": "ACCheckbox", "value": "1", "label": "T", "checked": "false", "posterior": "none"},
{ "name": "SETTING_ALARM3WED", "type": "ACCheckbox", "value": "1", "label": "W", "checked": "false", "posterior": "none"},
{ "name": "SETTING_ALARM3THU", "type": "ACCheckbox", "value": "1", "label": "Th", "checked": "false", "posterior": "none"},
{ "name": "SETTING_ALARM3FRI", "type": "ACCheckbox", "value": "1", "label": "F", "checked": "false", "posterior": "none"},
{ "name": "SETTING_ALARM3SAT", "type": "ACCheckbox", "value": "1", "label": "S", "checked": "false"},
{ "name": "SETTING_ALARM3HOUR", "type": "ACSelect", "option":  [ "00 / 12 AM", "01 / 1 AM", "02 / 2 AM", "03 / 3 AM", "04 / 4 AM", "05 / 5 AM", "06 / 6 AM", "07 / 7 AM", "08 / 8 AM", "09 / 9 AM", "10 / 10 AM", "11 / 11 AM", "12 / 12 PM", "13 / 1 PM", "14 / 2 PM", "15 / 3 PM", "16 / 4 PM", "17 / 5 PM", "18 / 6 PM", "19 / 7 PM", "20 / 8 PM", "21 / 9 PM", "22 / 10 PM", "23 / 11 PM" ], "label": "Time", "posterior": "none"},
{ "name": "SETTING_ALARM3MIN", "type": "ACSelect", "option":  [ "00", "05", "10", "15", "20", "25", "30", "35", "40", "45", "50", "55" ], "label": "", "posterior": "none"},
{ "name": "SETTING_ALARM3DUR", "type": "ACSelect", "option":  [ "Until canceled", "2 seconds", "5 seconds", "10 seconds", "30 seconds", "1 minute", "2 minutes", "3 minutes","4 minutes", "5 minutes", "6 minutes", "7 minutes", "8 minutes", "9 minutes", "10 minutes" ], "label": "Duration"},
{ "name": "newline3", "type": "ACElement", "value": "<hr>"},

{ "name": "add", "type": "ACSubmit", "value": "Submit", "uri": "/alarm"}

] } )";

/// THIS IS NOT WORKING, DIFFERENCE IS ADDITIONAL VALUES in SETTING_ALARM1MIN

const char PAGE_ALARM[] PROGMEM = R"( { "uri": "/alarm", "title": "Alarm", "menu": true, "element": [ { "name": "SETTING_ALARM1ENABLE", "type": "ACCheckbox", "value": "1", "label": "Alarm 1 Enable", "checked": "false", "global": "true"}, { "name": "SETTING_ALARM1SUN", "type": "ACCheckbox", "value": "1", "label": "S", "checked": "false", "posterior": "none"}, { "name": "SETTING_ALARM1MON", "type": "ACCheckbox", "value": "1", "label": "M", "checked": "false", "posterior": "none"}, { "name": "SETTING_ALARM1TUE", "type": "ACCheckbox", "value": "1", "label": "T", "checked": "false", "posterior": "none"}, { "name": "SETTING_ALARM1WED", "type": "ACCheckbox", "value": "1", "label": "W", "checked": "false", "posterior": "none"}, { "name": "SETTING_ALARM1THU", "type": "ACCheckbox", "value": "1", "label": "Th", "checked": "false", "posterior": "none"}, { "name": "SETTING_ALARM1FRI", "type": "ACCheckbox", "value": "1", "label": "F", "checked": "false", "posterior": "none"}, { "name": "SETTING_ALARM1SAT", "type": "ACCheckbox", "value": "1", "label": "S", "checked": "false"}, { "name": "SETTING_ALARM1HOUR", "type": "ACSelect", "option": [ "00 / 12 AM", "01 / 1 AM", "02 / 2 AM", "03 / 3 AM", "04 / 4 AM", "05 / 5 AM", "06 / 6 AM", "07 / 7 AM", "08 / 8 AM", "09 / 9 AM", "10 / 10 AM", "11 / 11 AM", "12 / 12 PM", "13 / 1 PM", "14 / 2 PM", "15 / 3 PM", "16 / 4 PM", "17 / 5 PM", "18 / 6 PM", "19 / 7 PM", "20 / 8 PM", "21 / 9 PM", "22 / 10 PM", "23 / 11 PM" ], "label": "Time", "posterior": "none"}, { "name": "SETTING_ALARM1MIN", "type": "ACSelect", "option": [ "00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "40", "41", "42", "43", "44", "45", "46", "47", "48", "49", "50", "51", "52", "53", "54", "55", "56", "57", "58", "59" ], "label": "", "posterior": "none"}, { "name": "SETTING_ALARM1DUR", "type": "ACSelect", "option": [ "Until canceled", "2 seconds", "5 seconds", "10 seconds", "30 seconds", "1 minute", "2 minutes", "3 minutes","4 minutes", "5 minutes", "6 minutes", "7 minutes", "8 minutes", "9 minutes", "10 minutes" ], "label": "Duration"}, { "name": "newline1", "type": "ACElement", "value": "


"},

{ "name": "SETTING_ALARM2ENABLE", "type": "ACCheckbox", "value": "1", "label": "Alarm 2 Enable", "checked": "false", "global": "true"},
{ "name": "SETTING_ALARM2SUN", "type": "ACCheckbox", "value": "1", "label": "S", "checked": "false", "posterior": "none"},
{ "name": "SETTING_ALARM2MON", "type": "ACCheckbox", "value": "1", "label": "M", "checked": "false", "posterior": "none"},
{ "name": "SETTING_ALARM2TUE", "type": "ACCheckbox", "value": "1", "label": "T", "checked": "false", "posterior": "none"},
{ "name": "SETTING_ALARM2WED", "type": "ACCheckbox", "value": "1", "label": "W", "checked": "false", "posterior": "none"},
{ "name": "SETTING_ALARM2THU", "type": "ACCheckbox", "value": "1", "label": "Th", "checked": "false", "posterior": "none"},
{ "name": "SETTING_ALARM2FRI", "type": "ACCheckbox", "value": "1", "label": "F", "checked": "false", "posterior": "none"},
{ "name": "SETTING_ALARM2SAT", "type": "ACCheckbox", "value": "1", "label": "S", "checked": "false"},
{ "name": "SETTING_ALARM2HOUR", "type": "ACSelect", "option":  [ "00 / 12 AM", "01 / 1 AM", "02 / 2 AM", "03 / 3 AM", "04 / 4 AM", "05 / 5 AM", "06 / 6 AM", "07 / 7 AM", "08 / 8 AM", "09 / 9 AM", "10 / 10 AM", "11 / 11 AM", "12 / 12 PM", "13 / 1 PM", "14 / 2 PM", "15 / 3 PM", "16 / 4 PM", "17 / 5 PM", "18 / 6 PM", "19 / 7 PM", "20 / 8 PM", "21 / 9 PM", "22 / 10 PM", "23 / 11 PM" ], "label": "Time", "posterior": "none"},
{ "name": "SETTING_ALARM2MIN", "type": "ACSelect", "option":  [ "00", "05", "10", "15", "20", "25", "30", "35", "40", "45", "50", "55" ], "label": "", "posterior": "none"},
{ "name": "SETTING_ALARM2DUR", "type": "ACSelect", "option":  [ "Until canceled", "2 seconds", "5 seconds", "10 seconds", "30 seconds", "1 minute", "2 minutes", "3 minutes","4 minutes", "5 minutes", "6 minutes", "7 minutes", "8 minutes", "9 minutes", "10 minutes" ], "label": "Duration"},
{ "name": "newline2", "type": "ACElement", "value": "<hr>"},

{ "name": "SETTING_ALARM3ENABLE", "type": "ACCheckbox", "value": "1", "label": "Alarm 3 Enable", "checked": "false", "global": "true"},
{ "name": "SETTING_ALARM3SUN", "type": "ACCheckbox", "value": "1", "label": "S", "checked": "false", "posterior": "none"},
{ "name": "SETTING_ALARM3MON", "type": "ACCheckbox", "value": "1", "label": "M", "checked": "false", "posterior": "none"},
{ "name": "SETTING_ALARM3TUE", "type": "ACCheckbox", "value": "1", "label": "T", "checked": "false", "posterior": "none"},
{ "name": "SETTING_ALARM3WED", "type": "ACCheckbox", "value": "1", "label": "W", "checked": "false", "posterior": "none"},
{ "name": "SETTING_ALARM3THU", "type": "ACCheckbox", "value": "1", "label": "Th", "checked": "false", "posterior": "none"},
{ "name": "SETTING_ALARM3FRI", "type": "ACCheckbox", "value": "1", "label": "F", "checked": "false", "posterior": "none"},
{ "name": "SETTING_ALARM3SAT", "type": "ACCheckbox", "value": "1", "label": "S", "checked": "false"},
{ "name": "SETTING_ALARM3HOUR", "type": "ACSelect", "option":  [ "00 / 12 AM", "01 / 1 AM", "02 / 2 AM", "03 / 3 AM", "04 / 4 AM", "05 / 5 AM", "06 / 6 AM", "07 / 7 AM", "08 / 8 AM", "09 / 9 AM", "10 / 10 AM", "11 / 11 AM", "12 / 12 PM", "13 / 1 PM", "14 / 2 PM", "15 / 3 PM", "16 / 4 PM", "17 / 5 PM", "18 / 6 PM", "19 / 7 PM", "20 / 8 PM", "21 / 9 PM", "22 / 10 PM", "23 / 11 PM" ], "label": "Time", "posterior": "none"},
{ "name": "SETTING_ALARM3MIN", "type": "ACSelect", "option":  [ "00", "05", "10", "15", "20", "25", "30", "35", "40", "45", "50", "55" ], "label": "", "posterior": "none"},
{ "name": "SETTING_ALARM3DUR", "type": "ACSelect", "option":  [ "Until canceled", "2 seconds", "5 seconds", "10 seconds", "30 seconds", "1 minute", "2 minutes", "3 minutes","4 minutes", "5 minutes", "6 minutes", "7 minutes", "8 minutes", "9 minutes", "10 minutes" ], "label": "Duration"},
{ "name": "newline3", "type": "ACElement", "value": "<hr>"},

{ "name": "add", "type": "ACSubmit", "value": "Submit", "uri": "/alarm"}

] } )";

Hieromon commented 1 year ago

@ghmpi Chopped code blocks like this are very hard to see. I can't reproduce the problem using this code.

You're probably out of memory. Enable AC_DEBUG and PB_DEBUG for trace logging. If you see ArduinoJson deserialization errors or PageBuilder errors, the cause is there.

Also, AutoConnect's JSON buffer size is defined in AUTOCONNECT_JSONBUFFER_SIZE. Use the ArduinoJson Assistant to calculate the buffer size needed to deserialize your JSON description.

So, what's the point of your experiment? It's not clear what the point of the problem is. Move to Discussions.