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