Search found 51 matches

by nvannote
Mon Jun 01, 2020 3:24 pm
Forum: ESP-IDF
Topic: [solved] sprintf() Guru Meditation Error (maximum Task Size?)
Replies: 9
Views: 9619

Re: sprintf() Guru Meditation Error (maximum Task Size?)

I have for each format specifier one argument into the sprintf() fucntion. This was only a mistake in my example. like you said it's not a problem if there are more or less arguments if my html string is shorter than approximately 6500 bytes. If there are more format specifiers in this format strin...
by nvannote
Mon Jun 01, 2020 12:47 pm
Forum: ESP-IDF
Topic: [solved] sprintf() Guru Meditation Error (maximum Task Size?)
Replies: 9
Views: 9619

Re: sprintf() Guru Meditation Error (maximum Task Size?)

Thanks for your response. I've tried snprintf() but it changed nothing. html request is defined as static const char. It is html code wich I minified to put it into one line of code and then put to a Text -> C/C++ string converter to have a C string wich I use vor the variable. Here is a peace of t...
by nvannote
Mon Jun 01, 2020 11:32 am
Forum: ESP-IDF
Topic: [solved] sprintf() Guru Meditation Error (maximum Task Size?)
Replies: 9
Views: 9619

Re: Maximum Memory allocation (for html webserver)

I think it is an overflow with the sprintf() command. In my code it looks like this: char* HTML = (char*)malloc(8500); if (HTML != NULL) { ESP_LOGD(TAG,"Fill HTML file"); export_aio_conf(conf, HTML, html_request); } ESP_LOGD(TAG,"Send Response"); httpd_resp_send(req, (const char*)HTML, strlen(HTML)...
by nvannote
Fri May 29, 2020 12:40 am
Forum: ESP-IDF
Topic: Download and write binary file
Replies: 8
Views: 12194

Re: Download and write binary file

So fread() (or socket calls) might return data which (politely) 'mess' with fprintf(). Depends on what you mean by "politely". ;) printf/fprintf/sprintf/snprintf (and the like) use the format string as a trustworthy map of the a variable argument list that follows; which it only has a stack pointer...
by nvannote
Wed May 27, 2020 1:44 pm
Forum: ESP-IDF
Topic: Download and write binary file
Replies: 8
Views: 12194

Re: Download and write binary file

I might also point out that that http_request example is a plain sockets example. The HTTP protocol has more going on than just receiving the requested resource. You may wan't to look into the ESP HTTP Client APIs to deal with that.

Regards
by nvannote
Wed May 27, 2020 11:49 am
Forum: ESP-IDF
Topic: Download and write binary file
Replies: 8
Views: 12194

Re: Download and write binary file

Thank you for your advices, i have tried to write binary data from variable to file and it works. About the downloading file, as i said, i just combined two example codes. Whole code is there: Groan. OK, You certainly did "just combined two example codes", didn't you. Well, I am not going to rewrit...
by nvannote
Tue May 26, 2020 5:36 am
Forum: ESP-IDF
Topic: Download and write binary file
Replies: 8
Views: 12194

Re: Download and write binary file

Short answer is that fprintf() won't do binary well. Ends at first 0x00. Try fwrite(), r gives you the length. rtfm wrt to fwrite() ;) Actually the short answer is... Don't pass unknown strings/data to fprintf as a format specification. It will produce unexpected results at best. Open the file with...
by nvannote
Mon May 25, 2020 9:07 am
Forum: ESP-IDF
Topic: Download and write binary file
Replies: 8
Views: 12194

Re: Download and write binary file

Well, I am not going to get into the download part as you didn’t post any code you're using to do that. But I will address the binary output part you did. Personally, I prefer to use the system/posix functions for binary data; but the C functions will do just fine here. First off; For any fprintf (o...
by nvannote
Mon May 25, 2020 8:25 am
Forum: General Discussion
Topic: Save temperature data to local database
Replies: 10
Views: 8676

Re: Save temperature data to local database

EDIT: So maybe raw might be better for you. You can recover from power fail corruption but would loose data, dual partitions and buffering aside. Yes, NVS has its own issues, but as you concluded fairly easy to "reasonably" recover from (IF it were to actually fail). I sill prefer an NVS solution (...
by nvannote
Fri May 22, 2020 11:48 pm
Forum: General Discussion
Topic: Save temperature data to local database
Replies: 10
Views: 8676

Re: Save temperature data to local database

Thanks you really helped me out there! I think I will go for arrays to store data, use the flash memory and MQTT for submiting the data to the server. If that very basic setup doesn't hold, I will opt for something else. But I don't want to unnecessary overcomplicate it at first :) Thanks again! I ...