#include "OTAsetup.h" void initOTA(){ // Set hostname and start OTA ArduinoOTA.setHostname("LibreMetric"); // Start of OTA ArduinoOTA.onStart([]() { DEBUG_PRINTLN("OTA Beginning!"); }); // progress of OTA ArduinoOTA.onProgress([](unsigned int progress, unsigned int total) { DEBUG_PRINTF("progress: %u%%\r", (progress/(total/100))); }); // OTA onEnd ArduinoOTA.onEnd([](){ DEBUG_PRINTLN("\nOTA ended, let\'s restart"); }); // OTA error handle ArduinoOTA.onError([](ota_error_t error) { DEBUG_PRINT("ArduinoOTA Error["); DEBUG_PRINT(error); DEBUG_PRINT("]: "); if (error == OTA_AUTH_ERROR) DEBUG_PRINTLN("Auth Failed"); else if (error == OTA_BEGIN_ERROR) DEBUG_PRINTLN("Begin Failed"); else if (error == OTA_CONNECT_ERROR) DEBUG_PRINTLN("Connect Failed"); else if (error == OTA_RECEIVE_ERROR) DEBUG_PRINTLN("Receive Failed"); else if (error == OTA_END_ERROR) DEBUG_PRINTLN("End Failed"); }); ArduinoOTA.begin(); }