Moved otaUrl into newSettings
This commit is contained in:
@@ -13,6 +13,7 @@
|
|||||||
#include "buildserver.h"
|
#include "buildserver.h"
|
||||||
#include "displays/menus/otamenu.h"
|
#include "displays/menus/otamenu.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
#include "newsettings.h"
|
||||||
|
|
||||||
#ifdef FEATURE_OTA
|
#ifdef FEATURE_OTA
|
||||||
|
|
||||||
@@ -34,7 +35,7 @@ public:
|
|||||||
stringSettings.otaServerUrl = m_buildserver_url;
|
stringSettings.otaServerUrl = m_buildserver_url;
|
||||||
if (m_buildserver_url.substr(m_buildserver_url.length() - 4) == ".bin")
|
if (m_buildserver_url.substr(m_buildserver_url.length() - 4) == ".bin")
|
||||||
{
|
{
|
||||||
stringSettings.otaUrl = m_buildserver_url;
|
configs.write_config(configs.otaUrl, m_buildserver_url); // mir egal ob es succeeded
|
||||||
}
|
}
|
||||||
saveSettings();
|
saveSettings();
|
||||||
url_for_latest.clear();
|
url_for_latest.clear();
|
||||||
|
@@ -12,8 +12,8 @@
|
|||||||
#include "actions/switchscreenaction.h"
|
#include "actions/switchscreenaction.h"
|
||||||
#include "icons/back.h"
|
#include "icons/back.h"
|
||||||
#include "displays/menus/otamenu.h"
|
#include "displays/menus/otamenu.h"
|
||||||
|
|
||||||
#include "globals.h"
|
#include "globals.h"
|
||||||
|
#include "newsettings.h"
|
||||||
|
|
||||||
#ifdef FEATURE_OTA
|
#ifdef FEATURE_OTA
|
||||||
#define MESSAGE(text) constructMenuItem<makeComponent<MenuItem, StaticText<text>, DefaultFont, StaticColor<TFT_RED>, DummyAction>>()
|
#define MESSAGE(text) constructMenuItem<makeComponent<MenuItem, StaticText<text>, DefaultFont, StaticColor<TFT_RED>, DummyAction>>()
|
||||||
@@ -34,8 +34,7 @@ public:
|
|||||||
|
|
||||||
void triggered() override
|
void triggered() override
|
||||||
{
|
{
|
||||||
stringSettings.otaUrl = m_url;
|
configs.write_config(configs.otaUrl, m_url); // mir egal ob succeeded
|
||||||
saveSettings();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int color() const override
|
int color() const override
|
||||||
|
@@ -20,6 +20,7 @@
|
|||||||
#include "texts.h"
|
#include "texts.h"
|
||||||
#include "ota.h"
|
#include "ota.h"
|
||||||
#include "displays/menus/otamenu.h"
|
#include "displays/menus/otamenu.h"
|
||||||
|
#include "newsettings.h"
|
||||||
|
|
||||||
#ifdef FEATURE_OTA
|
#ifdef FEATURE_OTA
|
||||||
void UpdateDisplay::initScreen()
|
void UpdateDisplay::initScreen()
|
||||||
@@ -112,7 +113,7 @@ void UpdateDisplay::buttonPressed(espgui::Button button)
|
|||||||
espgui::switchScreen<OtaMenu>();
|
espgui::switchScreen<OtaMenu>();
|
||||||
break;
|
break;
|
||||||
case Button::Right:
|
case Button::Right:
|
||||||
if (const auto result = triggerOta(stringSettings.otaUrl); !result)
|
if (const auto result = triggerOta(configs.otaUrl.value); !result)
|
||||||
ESP_LOGE("BOBBY", "triggerOta() failed with %.*s", result.error().size(), result.error().data());
|
ESP_LOGE("BOBBY", "triggerOta() failed with %.*s", result.error().size(), result.error().data());
|
||||||
break;
|
break;
|
||||||
default:;
|
default:;
|
||||||
|
@@ -110,6 +110,7 @@ public:
|
|||||||
|
|
||||||
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" };
|
ConfigWrapper<std::string> udpCloudHost {std::string{}, DoReset, {}, "udpCloudHost" };
|
||||||
|
ConfigWrapper<std::string> otaUrl {std::string{}, DoReset, StringOr<StringEmpty, StringValidUrl>, "otaUrl" };
|
||||||
|
|
||||||
#define NEW_SETTINGS(x) \
|
#define NEW_SETTINGS(x) \
|
||||||
x(baseMacAddressOverride) \
|
x(baseMacAddressOverride) \
|
||||||
@@ -247,7 +248,8 @@ public:
|
|||||||
x(reverseBeepDuration1) \
|
x(reverseBeepDuration1) \
|
||||||
\
|
\
|
||||||
x(cloudUrl) \
|
x(cloudUrl) \
|
||||||
x(udpCloudHost)
|
x(udpCloudHost) \
|
||||||
|
// x(otaUrl)
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
void callForEveryConfig(T &&callback)
|
void callForEveryConfig(T &&callback)
|
||||||
@@ -255,7 +257,7 @@ public:
|
|||||||
#define HELPER(x) callback(x);
|
#define HELPER(x) callback(x);
|
||||||
NEW_SETTINGS(HELPER)
|
NEW_SETTINGS(HELPER)
|
||||||
#undef HELPER
|
#undef HELPER
|
||||||
callback(udpCloudHost);
|
callback(otaUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto getAllConfigParams()
|
auto getAllConfigParams()
|
||||||
@@ -264,7 +266,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>(udpCloudHost)
|
std::ref<ConfigWrapperInterface>(otaUrl)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@@ -9,9 +9,6 @@ StringSettings makeDefaultStringSettings()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
return {
|
return {
|
||||||
#ifdef FEATURE_OTA
|
|
||||||
.otaUrl = {},
|
|
||||||
#endif
|
|
||||||
#ifdef FEATURE_GARAGE
|
#ifdef FEATURE_GARAGE
|
||||||
.garageUrl = {},
|
.garageUrl = {},
|
||||||
#endif
|
#endif
|
||||||
|
@@ -6,10 +6,6 @@
|
|||||||
|
|
||||||
struct StringSettings
|
struct StringSettings
|
||||||
{
|
{
|
||||||
#ifdef FEATURE_OTA
|
|
||||||
std::string otaUrl;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef FEATURE_GARAGE
|
#ifdef FEATURE_GARAGE
|
||||||
std::string garageUrl;
|
std::string garageUrl;
|
||||||
#endif
|
#endif
|
||||||
@@ -45,10 +41,6 @@ struct StringSettings
|
|||||||
template<typename T>
|
template<typename T>
|
||||||
void StringSettings::executeForEveryCommonSetting(T &&callable)
|
void StringSettings::executeForEveryCommonSetting(T &&callable)
|
||||||
{
|
{
|
||||||
#ifdef FEATURE_OTA
|
|
||||||
callable("otaUrl", otaUrl);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef FEATURE_GARAGE
|
#ifdef FEATURE_GARAGE
|
||||||
callable("garageUrl", garageUrl);
|
callable("garageUrl", garageUrl);
|
||||||
#endif
|
#endif
|
||||||
|
@@ -22,6 +22,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#include "webserver_lock.h"
|
#include "webserver_lock.h"
|
||||||
#include "globals.h"
|
#include "globals.h"
|
||||||
|
#include "newsettings.h"
|
||||||
|
|
||||||
#if defined(FEATURE_WEBSERVER) && defined(FEATURE_OTA)
|
#if defined(FEATURE_WEBSERVER) && defined(FEATURE_OTA)
|
||||||
using namespace std::chrono_literals;
|
using namespace std::chrono_literals;
|
||||||
@@ -344,7 +345,7 @@ esp_err_t webserver_ota_handler(httpd_req_t *req)
|
|||||||
body += "Trigger Update";
|
body += "Trigger Update";
|
||||||
}
|
}
|
||||||
|
|
||||||
body += fmt::format("<input type=\"text\" name=\"url\" value=\"{}\" />", esphttpdutils::htmlentities(stringSettings.otaUrl));
|
body += fmt::format("<input type=\"text\" name=\"url\" value=\"{}\" />", esphttpdutils::htmlentities(configs.otaUrl.value));
|
||||||
|
|
||||||
{
|
{
|
||||||
HtmlTag buttonTag{"button", "type=\"submit\"", body};
|
HtmlTag buttonTag{"button", "type=\"submit\"", body};
|
||||||
|
Reference in New Issue
Block a user