smaller fixes and using new esphttpdutils component

This commit is contained in:
2021-08-06 17:11:38 +02:00
parent bbc1f643e2
commit b76c6c7bf2
3 changed files with 19 additions and 15 deletions

View File

@ -7,12 +7,15 @@ set(sources
)
set(dependencies
esp_https_ota
expected
fmt
cpputils
espchrono
espcpputils
esp_https_ota
expected
fmt
esphttpdutils
)
idf_component_register(

View File

@ -13,7 +13,7 @@
// local includes
#include "cleanuphelper.h"
#include "espstrutils.h"
#include "esphttpdutils.h"
#include "tickchrono.h"
using namespace std::chrono_literals;
@ -155,8 +155,8 @@ tl::expected<void, std::string> EspAsyncOta::trigger(std::string_view url, std::
if (url.empty())
return tl::make_unexpected("empty firmware url");
if (const auto result = espcpputils::urlverify(url); !result)
return result;
if (const auto result = esphttpdutils::urlverify(url); !result)
return tl::make_unexpected(fmt::format("could not verify firmware url: {}", result.error()));
m_url = std::string{url};
m_cert_pem = cert_pem;

View File

@ -14,20 +14,21 @@
#include "taskutils.h"
#include "wrappers/event_group.h"
#include "espchrono.h"
#include "cpptypesafeenum.h"
enum OtaCloudUpdateStatus
{
Idle,
Updating,
Failed,
Succeeded,
NotReady
};
#define OtaCloudUpdateStatusValues(x) \
x(Idle) \
x(Updating) \
x(Failed) \
x(Succeeded) \
x(NotReady)
DECLARE_TYPESAFE_ENUM(OtaCloudUpdateStatus, : uint8_t, OtaCloudUpdateStatusValues)
IMPLEMENT_TYPESAFE_ENUM(OtaCloudUpdateStatus, : uint8_t, OtaCloudUpdateStatusValues)
class EspAsyncOta
{
public:
EspAsyncOta(const char *taskName="asyncOtaTask", uint32_t stackSize=2048, espcpputils::CoreAffinity coreAffinity=espcpputils::CoreAffinity::Core1);
EspAsyncOta(const char *taskName="asyncOtaTask", uint32_t stackSize=4096, espcpputils::CoreAffinity coreAffinity=espcpputils::CoreAffinity::Core1);
~EspAsyncOta();
tl::expected<void, std::string> startTask();