chrisjoyce911 / esp32FOTA

Experiments in firmware OTA updates for ESP32 dev boards
The Unlicense
363 stars 89 forks source link

Cannot call setProgressCb #123

Closed grunnels closed 1 year ago

grunnels commented 1 year ago

Maybe I'm missing something, but cannot call setProgressCb and I don't see it in the source code. Is it in an upcoming release?

tobozo commented 1 year ago

it's a callback setter, it accepts either a lambda function:

void setup()
{
  // (...)
  FOTA.setProgressCb( [](size_t progress, size_t size) {
      if( progress == size || progress == 0 ) Serial.println();
      Serial.print(".");
  });
}

... or an existing function

void my_progress_cb(size_t progress, size_t size) 
{
  if( progress == size || progress == 0 ) Serial.println();
  Serial.print(".");
}

void setup()
{
  // (...)
  FOTA.setProgressCb( my_progress_cb );
}
grunnels commented 1 year ago

Thanks for the quick reply. I'm sorry, it was a version mismatch error. Great library, thanks for the work.