0

When we upload a sketch to Arduino using OTA, we can follow upload progression using the following script and do some display accordingly.

How can we achieve the same using wired sketch upload?

  ArduinoOTA.onStart([]() {
    String type;
    if (ArduinoOTA.getCommand() == U_FLASH)
      type = "sketch";
    else // U_SPIFFS
      type = "filesystem";

    // NOTE: if updating SPIFFS this would be the place to unmount SPIFFS using SPIFFS.end()
    drawProgressBarOTA(0, "Receiving update");
  });
  ArduinoOTA.onEnd([]() {
    drawProgressBarOTA(100, "Rebooting");
    ESP.restart();
  });
  ArduinoOTA.onProgress([](unsigned int progress, unsigned int total) {
    drawProgressBarOTA((progress / (total / 100)));
  });
  ArduinoOTA.onError([](ota_error_t error) {
    Serial.printf("Error[%u]: ", error);
    if (error == OTA_AUTH_ERROR) Serial.println("Auth Failed");
    else if (error == OTA_BEGIN_ERROR) Serial.println("Begin Failed");
    else if (error == OTA_CONNECT_ERROR) Serial.println("Connect Failed");
    else if (error == OTA_RECEIVE_ERROR) Serial.println("Receive Failed");
    else if (error == OTA_END_ERROR) Serial.println("End Failed");
  });
  ArduinoOTA.begin();
Remi
  • 693
  • 8
  • 17
  • 1
    Related: https://github.com/arduino/Arduino/issues/6595 – per1234 Aug 09 '17 at 20:48
  • @per1234 thanks, it's a good pointer but I'm looking for something on the arduino side instead of the command line one. I would like to display upload progress on arduino LCD as I can do with OTA updates – Remi Aug 09 '17 at 21:27

0 Answers0