Moved udpCloudHost into newSettings
This commit is contained in:
@ -109,6 +109,7 @@ public:
|
|||||||
ConfigWrapper<int16_t> reverseBeepDuration1{500, DoReset, {}, "revBeepDur1" };
|
ConfigWrapper<int16_t> reverseBeepDuration1{500, DoReset, {}, "revBeepDur1" };
|
||||||
|
|
||||||
ConfigWrapper<std::string> cloudUrl {std::string{}, DoReset, StringOr<StringEmpty, StringValidUrl>, "cloudUrl" };
|
ConfigWrapper<std::string> cloudUrl {std::string{}, DoReset, StringOr<StringEmpty, StringValidUrl>, "cloudUrl" };
|
||||||
|
ConfigWrapper<std::string> udpCloudHost {std::string{}, DoReset, {}, "udpCloudHost" };
|
||||||
|
|
||||||
#define NEW_SETTINGS(x) \
|
#define NEW_SETTINGS(x) \
|
||||||
x(baseMacAddressOverride) \
|
x(baseMacAddressOverride) \
|
||||||
@ -245,7 +246,8 @@ public:
|
|||||||
x(reverseBeepDuration0) \
|
x(reverseBeepDuration0) \
|
||||||
x(reverseBeepDuration1) \
|
x(reverseBeepDuration1) \
|
||||||
\
|
\
|
||||||
//x(cloudUrl)
|
x(cloudUrl) \
|
||||||
|
x(udpCloudHost)
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
void callForEveryConfig(T &&callback)
|
void callForEveryConfig(T &&callback)
|
||||||
@ -253,7 +255,7 @@ public:
|
|||||||
#define HELPER(x) callback(x);
|
#define HELPER(x) callback(x);
|
||||||
NEW_SETTINGS(HELPER)
|
NEW_SETTINGS(HELPER)
|
||||||
#undef HELPER
|
#undef HELPER
|
||||||
callback(cloudUrl);
|
callback(udpCloudHost);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto getAllConfigParams()
|
auto getAllConfigParams()
|
||||||
@ -262,7 +264,7 @@ public:
|
|||||||
#define HELPER(x) std::ref<ConfigWrapperInterface>(x),
|
#define HELPER(x) std::ref<ConfigWrapperInterface>(x),
|
||||||
NEW_SETTINGS(HELPER)
|
NEW_SETTINGS(HELPER)
|
||||||
#undef HELPER
|
#undef HELPER
|
||||||
std::ref<ConfigWrapperInterface>(cloudUrl)
|
std::ref<ConfigWrapperInterface>(udpCloudHost)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -9,9 +9,6 @@ StringSettings makeDefaultStringSettings()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
return {
|
return {
|
||||||
#ifdef FEATURE_UDPCLOUD
|
|
||||||
.udpCloudUrl = {},
|
|
||||||
#endif
|
|
||||||
#ifdef FEATURE_OTA
|
#ifdef FEATURE_OTA
|
||||||
.otaUrl = {},
|
.otaUrl = {},
|
||||||
#endif
|
#endif
|
||||||
|
@ -6,10 +6,6 @@
|
|||||||
|
|
||||||
struct StringSettings
|
struct StringSettings
|
||||||
{
|
{
|
||||||
#ifdef FEATURE_UDPCLOUD
|
|
||||||
std::string udpCloudUrl;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef FEATURE_OTA
|
#ifdef FEATURE_OTA
|
||||||
std::string otaUrl;
|
std::string otaUrl;
|
||||||
#endif
|
#endif
|
||||||
@ -49,10 +45,6 @@ struct StringSettings
|
|||||||
template<typename T>
|
template<typename T>
|
||||||
void StringSettings::executeForEveryCommonSetting(T &&callable)
|
void StringSettings::executeForEveryCommonSetting(T &&callable)
|
||||||
{
|
{
|
||||||
#ifdef FEATURE_UDPCLOUD
|
|
||||||
callable("udpUrl", udpCloudUrl);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef FEATURE_OTA
|
#ifdef FEATURE_OTA
|
||||||
callable("otaUrl", otaUrl);
|
callable("otaUrl", otaUrl);
|
||||||
#endif
|
#endif
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
#include "espchrono.h"
|
#include "espchrono.h"
|
||||||
#include "battery.h"
|
#include "battery.h"
|
||||||
#include "drivingstatistics.h"
|
#include "drivingstatistics.h"
|
||||||
|
#include "newsettings.h"
|
||||||
|
|
||||||
#ifdef FEATURE_UDPCLOUD
|
#ifdef FEATURE_UDPCLOUD
|
||||||
using namespace std::chrono_literals;
|
using namespace std::chrono_literals;
|
||||||
@ -315,7 +316,7 @@ void sendUdpCloudPacket()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stringSettings.udpCloudUrl.empty())
|
if (configs.udpCloudHost.value.empty())
|
||||||
{
|
{
|
||||||
visualSendUdpPacket = false;
|
visualSendUdpPacket = false;
|
||||||
return;
|
return;
|
||||||
@ -329,7 +330,7 @@ void sendUdpCloudPacket()
|
|||||||
|
|
||||||
ip_addr_t udpCloudIp;
|
ip_addr_t udpCloudIp;
|
||||||
|
|
||||||
if (const auto res = dns_gethostbyname(stringSettings.udpCloudUrl.c_str(), &udpCloudIp, nullptr, nullptr); res != ERR_OK)
|
if (const auto res = dns_gethostbyname(configs.udpCloudHost.value.c_str(), &udpCloudIp, nullptr, nullptr); res != ERR_OK)
|
||||||
{
|
{
|
||||||
if (res == ERR_INPROGRESS)
|
if (res == ERR_INPROGRESS)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user