These are chat archives for esp8266/Arduino

4th
Jun 2016
Clemens Kirchgatterer
@everslick
Jun 04 2016 06:06
@me-no-dev thanks for your help, i ported everything over to your asyncwebserver, but could need a hand here: https://github.com/everslick/genesys/blob/master/http.cpp#L243
Me No Dev
@me-no-dev
Jun 04 2016 07:24
why do you delay in there?
Clemens Kirchgatterer
@everslick
Jun 04 2016 08:58
worked better with the sync server
i don't have an Update object anymore, i guess: HTTPUpload &upload = http->upload();
Me No Dev
@me-no-dev
Jun 04 2016 09:00
you do not have upload object or update object?
also what worked better with sync?
uploads are handled a bit different but all info is still there
Clemens Kirchgatterer
@everslick
Jun 04 2016 09:05
sorry, i meant the the upload object. in the sync server i got a reference to the that by the line i pasted. but the new async server does not have that.
the procedure is still : read a chunk from network, give that chunk to the upload object, aso... isn't it/
feeding the updater is the part i have to figure out yet.
Me No Dev
@me-no-dev
Jun 04 2016 09:09
static void handle_update_progress_cb(AsyncWebServerRequest *request, String filename, size_t index, uint8_t *data, size_t len, bool final) {
  uint32_t free_space = (system_free_sketch_space() - 0x1000) & 0xFFFFF000;
  static int received = 0, last_perc = -1;
  StreamString out;

  if (!index){
    log_print(F("HTTP: starting OTA update ...\n"));
    log_print(F("HTTP: available space: %u bytes\n"), free_space);
    log_print(F("HTTP: filename: %s\n"), filename.c_str());

    websocket_broadcast_message("update");
    websocket_disconnect_clients();

    log_poll();

    if (!Update.begin(free_space)) {
      Update.printError(out);
      log_print(out.readString().c_str());
    }
  }

  if (Update.write(data, len) != len) {
    Update.printError(out);
    log_print(out.readString().c_str());
  } else {
    received += len;

    int perc = 100 * received / system_sketch_size();

    if (perc != last_perc) {
      log_progress(F("HTTP: received "), "%", perc);
      last_perc = perc;
    }

    system_count_net_traffic(len);
  }

  if (final) {
    if (Update.end(true)) { // true to set the size to the current progress
      log_print(F("HTTP: update successful: %u bytes\n"), index+len);
    } else {
      Update.printError(out);
      log_print(out.readString().c_str());
    }
  }
}
Clemens Kirchgatterer
@everslick
Jun 04 2016 09:14
oh
:-D thx a million.
Me No Dev
@me-no-dev
Jun 04 2016 09:14
:)
it's about the same, with the difference that you do not get separate callbacks for start and end
that decision is based on the index and final arguments
and you always get data
Clemens Kirchgatterer
@everslick
Jun 04 2016 09:21
ic
so i have to add the reboot after update and the server response to the if (final) ... as well now it is still in the handle_update_finished_cb()
Me No Dev
@me-no-dev
Jun 04 2016 09:23
you can leave it there
you will get the POST callback after the upload
have to go :)
Clemens Kirchgatterer
@everslick
Jun 04 2016 09:24
thx
Rohit Yermalkar
@romuye123
Jun 04 2016 11:54
when you run WiFi.begin("mywifi_ssid","mywifi_pass");
this will store the ssid and password to flash
how to reset or delete ssid and password ?
Martin Ayotte
@martinayotte
Jun 04 2016 15:07
@me-no-dev , @igrr , remember my sketch for NYTimes ? replacing the tcpclient.write(content) by spiffs.write(content), I now see some Soft WTD :-( Doing only spiffs.write(String("chunksize=") + chunksize) instead of real content and it works until complete NYTimes download
Me No Dev
@me-no-dev
Jun 04 2016 16:11
@martinayotte how big is the chunk size?
Martin Ayotte
@martinayotte
Jun 04 2016 16:27
@me-no-dev , 1460 bytes.
I've also tried with 1024
Martin Ayotte
@martinayotte
Jun 04 2016 16:49
Oh ! Something I didn't check : the issue is when used within my bigger Sketch-Buffet, but no with the stripped down version on Gist. So, maybe I'm facing some memory issue ... :-(
Euuh ! not true, I got it with the stripped down version, but it is more intermittent : https://gist.github.com/martinayotte/965452b92299eb2ff681c5a65736bdc9
Martin Ayotte
@martinayotte
Jun 04 2016 18:06
Ouch ! after mergin with latest github, probably unrelated, I got one crash with this time different stacktrace but related to umm_malloc too : https://gist.github.com/martinayotte/2d3d9a1517b34f5ece9ea335539e6524
Martin Ayotte
@martinayotte
Jun 04 2016 18:18
... and SPIFFS write doesn't seem to write NYTimes content at all now, only some nulls characters ... I should have done backup, but I didn't ... :-(
Martin Ayotte
@martinayotte
Jun 04 2016 18:24
maybe not exact ... too much headaches ! I will go take a walk to refresh myself ...
Germán Martín
@gmag11
Jun 04 2016 21:00
Hi, I'm developing a Firmata client for ESP. I'd like to do stream.available() checking inside class by using a ticker. But I do not know how to assign a member function as callback of ticket. Could you give me some indications?
Me No Dev
@me-no-dev
Jun 04 2016 23:52
@martinayotte I know those moments :) nothing a good night sleep can't put in order