Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Me No Dev
@me-no-dev
@everslick check if both calcul;ate the available space the same way. also did the update work?
Clemens Kirchgatterer
@everslick
it 'worked' as in yes it flashed the update. it 'didn't work' as in, the binary did not even boot.
the NO Error was printed for each block, that did not fit anymore
but the flash went on regardless
Me No Dev
@me-no-dev
anyone interested in adding this to the core:
#include <time.h>
struct tm * getSketchCompileTime(){
  const char * months[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
  const char * compile_date = __DATE__;
  const char * compile_time = __TIME__;

  int year = atoi(compile_date+7),
  month = 0,
  day = atoi(compile_date+4),
  hour = atoi(compile_time),
  minute = atoi(compile_time+3),
  second = atoi(compile_time+6);

  int i;
  for(i=0; i<12; i++){
    if(memcmp(compile_date, months[i], 3) == 0){
      month = i;
    }
  }

  static struct tm * timeinfo = (struct tm *)malloc(sizeof(struct tm));
  timeinfo->tm_year = year - 1900;
  timeinfo->tm_mon = month;
  timeinfo->tm_mday = day;
  timeinfo->tm_hour = hour;
  timeinfo->tm_min = minute;
  timeinfo->tm_sec = second;
  mktime(timeinfo);
  return timeinfo;
}
@everslick sounds like bug in updater (returning wrong error code)
Clemens Kirchgatterer
@everslick
can i send html pages in chunks to the browser using the SYNC ESP8266WebServer also?
i know it works in the async server
Me No Dev
@me-no-dev
afaik no
Clemens Kirchgatterer
@everslick
hmpf
Me No Dev
@me-no-dev
should not be hard to implement though ;)
Clemens Kirchgatterer
@everslick
setting content header and length an calling WiFiClient::write() in a loop and then WiFiClient::stop() ?
Ivan Grokhotkov
@igrr
no need to stop
Clemens Kirchgatterer
@everslick
or implementing a sendChunked with a callback to feed it more data
Ivan Grokhotkov
@igrr
just set the correct content-length first, and then call server.sendContent a number of times
Clemens Kirchgatterer
@everslick
ah, ok
will try that
Ivan Grokhotkov
@igrr
nowadays in master i think you can pass the whole thing to sendContent, and it will send is as fast as possible
Me No Dev
@me-no-dev
there is no content length with chunked output, so it makes sense in cases where you do not know the size of the response beforehand
else there is no point with the sync server
Ivan Grokhotkov
@igrr
ah, right. there is no support for chunked encoding in esp8266webserver
it's just that you can set content-length if you know it
Clemens Kirchgatterer
@everslick
i run out of heap to prepare the whole page in rame before sending it
so i need to generate one chank, send it, generate the next aso
Me No Dev
@me-no-dev
do you know the size of the resulting page though?
Clemens Kirchgatterer
@everslick
not exactly
but i could just send a little bit more
Ivan Grokhotkov
@igrr
hmm, sounds like you might really need chunked encoding
Clemens Kirchgatterer
@everslick
to fill up the missing bytes
Clemens Kirchgatterer
@everslick
or does anybody have a good idea how to send large dynamic html code (other then the async server, which i cannot switch to in the short term)/
maybe use websocket to set innerHTML on a div
Ivan Grokhotkov
@igrr
@me-no-dev is going to implement chunked encoding in sync webserver. i think this will take him like 15 minutes.
Me No Dev
@me-no-dev
what are your issues with switching to async?
I so hate this "Merge remote tracking branch..." crap in my commits
how to get rid of it?
tried rebase and whatnot....
surely it's a one liner in terminal
Clemens Kirchgatterer
@everslick
some of my code is not 'async safe' yet
and i have no time to sort it out cleanly ATM
i have to say, you guys are awesome! :-D
Me No Dev
@me-no-dev
ok now let's see if it works :D
Clemens Kirchgatterer
@everslick
tell, if i can test it
Me No Dev
@me-no-dev
works, but it has delay at the end that should not be there
Me No Dev
@me-no-dev
yup working great :) sendContent and sendContent_P
  server.on("/chunked", HTTP_GET, [](){
    server.send(200, "text/html", String());
    server.sendContent("<!DOCTYPE html><html><head><title>Chunked Test</title></head><body>");
    server.sendContent("<p>Chunk 1</p>");
    server.sendContent("<p>Chunk 2</p>");
    server.sendContent("<p>Chunk 3</p>");
    server.sendContent("<p>Chunk 4</p>");
    server.sendContent("<p>Chunk 5</p>");
    server.sendContent("<p>Chunk 6</p>");
    server.sendContent("</html>");
    server.sendContent("");//end of chunked
  });
works on HTTP/1.1 clients
Me No Dev
@me-no-dev
@everslick if you want to test it: esp8266/Arduino#2199
no need to set contentLength to UNKNOWN anymore if you send empty string in send()
Clemens Kirchgatterer
@everslick
looks great. i will test it tomorrow. thank you very much for your support!!!
Me No Dev
@me-no-dev

no need to set contentLength to UNKNOWN anymore if you send empty string in send()

that is no longer true