#include "ota.h" // system includes #include #include // esp-idf includes #include // 3rdparty lib includes #include #include #include #include #include // local includes #include "config.h" using namespace std::chrono_literals; namespace { constexpr const char * const TAG = "OTA_CLIENT"; cpputils::DelayedConstruction _otaClient; } // namespace EspAsyncOta &otaClient{_otaClient.getUnsafe()}; void ota_client_init() { ESP_LOGI(TAG, "called"); _otaClient.construct("asyncOtaTask", 8192u); } void ota_client_update() { _otaClient->update(); } tl::expected otaClientTrigger(std::string_view url) { if (auto result = _otaClient->trigger(url, {}, {}, {}); !result) return tl::make_unexpected(std::move(result).error()); wifi_stack::delete_scan_result(); return {}; } tl::expected otaClientAbort() { if (auto result = _otaClient->abort(); !result) return tl::make_unexpected(std::move(result).error()); return {}; }