Hi everyone,
I wrote simple http server to manage pin states and to get sensors data in json format. It supports only two commands: "get" and "set" (with parameters which pin states should be changed). It works fine for "get" command (for example controller had been working about 3 days processing ~3 "get" requests per second) but when I tried to send "set" command it self resets. Looking through information with similar problems I have a guess that a reason in memory. Since freeRam () function shows about 6000 bytes free maybe they are extrimely defragmented though it looks strange for me that it resets always in the same place. Today I've changed "string" to F("string") everywhere it's possible and place of resetting was changed too. But it still does not process "set" request. I don't know exactly where is the problem so have to include all my scetch here (as attachment because direct insert exceeds 9000 symbols limitation). I'll be glad if someone has time to see it with fresh and experienced look:).
attaching code is far less likely to get help/suggestions.
Trim your code to a size you can post within code tags, then everyone can see it, and it will have less unrelated baggage to trawl through.
Go on, give it a shot.
You can edit your initial post in this case, and put the code in.
I cannot open ino files on my device so have not seen your code. Do you use any arrays in the code? A common cause of the behavior that you describe is writing beyond the end of an array into memory that you do not "own".
I notice you are using several String variables, those can often lead to the type of behavior you are experiencing. If possible try to change those to null-terminated char arrays.
Which Thread library are you using? I don't have the correct one and cannot get your code to compile.
groundFungus:
I cannot open ino files on my device so have not seen your code. Do you use any arrays in the code? A common cause of the behavior that you describe is writing beyond the end of an array into memory that you do not "own".
Thank you very much:). I've started to reduce my code it insert it here in message and found out what was wrong. Now I've read your message and you are right. I used sizeof(array) and it was problem because it gave bigger number that it's in reality (I expected count of items but not size in bytes) => write data in memory out of bounds of array. Awful mistake...
hdimon:
Thank you very much:). I've started to reduce my code it insert it here in message and found out what was wrong. Now I've read your message and you are right. I used sizeof(array) and it was problem because it gave bigger number that it's in reality (I expected count of items but not size in bytes) => write data in memory out of bounds of array. Awful mistake...