Files
bobbycar-boardcomputer-firm…/main/ota.h
2021-08-09 12:57:40 +02:00

50 lines
1.4 KiB
C++

#pragma once
#ifdef FEATURE_OTA
#include <espasyncota.h>
#endif
#include "screens.h"
#include "globals.h"
#include "displays/updatedisplay.h"
namespace {
#ifdef FEATURE_OTA
void initOta()
{
// ArduinoOTA
// .onStart([]() {
// std::string type;
// switch (ArduinoOTA.getCommand())
// {
// case U_FLASH: type = "sketch"; break;
// case U_SPIFFS: type = "filesystem"; break;
// default: type = "unknown";
// }
// switchScreenImpl<UpdateDisplay>("Updating " + type);
// })
// .onEnd([]() {
// ((UpdateDisplay*)currentDisplay.get())->m_finished = true;
// ((UpdateDisplay*)currentDisplay.get())->redraw();
// })
// .onProgress([](unsigned int progress, unsigned int total) {
// ((UpdateDisplay*)currentDisplay.get())->m_progress = progress;
// ((UpdateDisplay*)currentDisplay.get())->m_total = total;
// ((UpdateDisplay*)currentDisplay.get())->redraw();
// })
// .onError([](ota_error_t error) {
// ((UpdateDisplay*)currentDisplay.get())->m_error = error;
// ((UpdateDisplay*)currentDisplay.get())->m_errorValid = true;
// ((UpdateDisplay*)currentDisplay.get())->redraw();
// });
// ArduinoOTA.begin();
}
void handleOta()
{
// ArduinoOTA.handle();
}
#endif
}