n0bel / ESPrinkler2

Arduino/ESP8266 based sprinkler Controller
MIT License
31 stars 12 forks source link

Cannot create shcedules more than 8 schedules #1

Open TeguhTeknisi opened 6 years ago

TeguhTeknisi commented 6 years ago

I got error when i create more than 8 schedule. Here some error: handleFileUpload Name: /sched.json handleFileUpload Size: 1040 json parse of schedFile failed.

Please help me to solve the problem.

Thanks before.

Meins321 commented 4 years ago

to be honest i don't have this problem, i did build it too witth the wemos d1 mini pro with external antenna and spi flash which is currently not supported...

i can imagine that if you set the flash vs spiff size wrong in arduino ide before you compile and transfer the programm itself the "schedule" file fails due file size..

1.Please test if you run the default setup with nothing changed if you can't create more than 8 tasks

2.Check that you set it to 3M/512k in arduin ide

  1. how big is your picture for the Zone Map? <- :-)
TeguhTeknisi commented 4 years ago
Hi, Thanks alot for the reply,I don't play with arduino for around 2 year.but just around 2-3 weeks ago i play with ESPEasy just for setup Temp/Hum Sensor DHT11 and Display 1605 to monitor Temp/Hum in my room and outside my room. I have delete some of my project files, because i have upgrade my ubuntu, and loose some arduino ide stuff. And then because i don't know what to do anymore with the ESPrinkler, i move out to OpenSprinkler OSBee - Topic: Need Help to make OSBee Web Offline OpenSprinkler

|

Topic: Need Help to make OSBee Web Offline OpenSprinkler

| |

|

|

Thats me when i ask some help in the forum, and share my modified osbee sourcecode in there. i got more fun playing with it, but because some problem (whiteflies,bug,spidermite,etc) with my greenhouse, i have to quit playing with arduino and my greenhouse. so i'am sory, i cannot answer your question.But for number 3, i use the default picture for zone map, using your.Because my focus still trying to get more schedule, i don't have time to change the picture. Thanks a lot for your reply and the source code, i have fun and learning from esprinkler2.

Best Regrads,Teguh Teknisi

Sent from Yahoo Mail on Android

On Sun, May 17, 2020 at 3:57, Meins321notifications@github.com wrote:

to be honest i don't have this problem, i did build it too witth the wemos d1 mini pro with external antenna and spi flash which is currently not supported...

i can imagine that if you set the flash vs spiff size wrong in arduino ide before you compile and transfer the programm itself the "schedule" file fails due file size..

1.Please test if you run the default setup with nothing changed if you can't create more than 8 tasks

2.Check that you set it to 3M/512k in arduin ide

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

attiliovaccaro commented 3 years ago

I had the same problem with even less schedules. The issue is not with the schedules, bud with the length of the generated sched.json which shall be less than 1000 characters. I tried to increase it to 1500 by changing a couple of lines of code in the loadSched() function and it works. I also tried with larger values, but the system does not work (it continuously reboots after connecting to the WIFI). I guess that a way to solve this would be to modify the names of attributes/nodes used in sched.json using shorter ones, this would imply some further changes in the code and schema.

Meins321 commented 2 years ago

@attiliovaccaro Can you share more insight? i have created more than 8 shedules back then when i answered and it worked maybe i did test it wrong?

YengaJaf-Aizatron commented 1 month ago

I've been struggling with this as well. I couldn't find a solution online, so here's what I did.

What I did was to increase the stack size of the main loop, and increase the JsonDoc size in the loadSched() function:

    // If size 1000 worked for 8 sched, want 30 sched, 4000 should be enough
    const size_t bufferSize = 5000;  // Adjust buffer size based on estimation
    char json[bufferSize];
    memset(json, 0, sizeof(json));
    file.readBytes(json, sizeof(json));
    file.close();
    StaticJsonDocument<bufferSize> jsonDoc;

At first I made the JsonDoc size 5000, but then I ran into a stack overflow issue. What fixed it was this line which I placed right at the beginning of the main.c file: /* Increase stack of main loop, Default 8k This was done to allow schedules more than 8 to work */ SET_LOOP_TASK_STACK_SIZE(16*1024);