Kinda implemented build server selection (does not work)

This commit is contained in:
CommanderRedYT
2021-10-18 13:35:18 +02:00
committed by 0xFEEDC0DE64
parent 5c657c20af
commit b2b9f97dce
4 changed files with 20 additions and 11 deletions

View File

@ -27,17 +27,25 @@ class SelectBuildServerMenu :
public: public:
SelectBuildServerMenu() { SelectBuildServerMenu() {
/* auto numDisplayedServers = 0;
for (auto index = 0; index < stringSettings.otaServers.size(); index++) for (auto index = 0; index < stringSettings.otaServers.size(); index++)
{ {
auto otaServer = stringSettings.otaServers[index]; auto otaServer = stringSettings.otaServers[index];
std::string url = otaServer.url; std::string url = otaServer.url;
std::string name = (otaServer.name.empty()) ? url : otaServer.name; std::string name = (otaServer.name.empty()) ? url : otaServer.name;
auto menuitem = constructMenuItem<makeComponent<MenuItem, ChangeableText, DummyAction>>(); if (!name.empty()) {
menuitem.setTitle(name); auto menuitem = constructMenuItem<makeComponent<MenuItem, ChangeableText, DummyAction>>();
menuitem.setTitle(name);
numDisplayedServers++;
}
}
if (!numDisplayedServers)
{
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_NOBUILDSERVERCONFIGURED>, DummyAction>>();
} }
*/
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BACK>, SwitchScreenAction<SettingsMenu>, StaticMenuItemIcon<&espgui::icons::back>>>(); constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BACK>, SwitchScreenAction<SettingsMenu>, StaticMenuItemIcon<&espgui::icons::back>>>();
} }

View File

@ -325,10 +325,9 @@ StringSettings makeDefaultStringSettings()
.timeServer = "europe.pool.ntp.org", .timeServer = "europe.pool.ntp.org",
#endif #endif
#ifdef FEATURE_OTA #ifdef FEATURE_OTA
.otaServers = std::array<ConfiguredOtaServer, 10> { .otaServers = std::array<ConfiguredOtaServer, 2> {
ConfiguredOtaServer { .name = {}, .url = {} }, ConfiguredOtaServer { .name = {}, .url = {} },
ConfiguredOtaServer { .name = {}, .url = {} }, ConfiguredOtaServer { .name = {}, .url = {} },/*
ConfiguredOtaServer { .name = {}, .url = {} },
ConfiguredOtaServer { .name = {}, .url = {} }, ConfiguredOtaServer { .name = {}, .url = {} },
ConfiguredOtaServer { .name = {}, .url = {} }, ConfiguredOtaServer { .name = {}, .url = {} },
ConfiguredOtaServer { .name = {}, .url = {} }, ConfiguredOtaServer { .name = {}, .url = {} },
@ -336,6 +335,7 @@ StringSettings makeDefaultStringSettings()
ConfiguredOtaServer { .name = {}, .url = {} }, ConfiguredOtaServer { .name = {}, .url = {} },
ConfiguredOtaServer { .name = {}, .url = {} }, ConfiguredOtaServer { .name = {}, .url = {} },
ConfiguredOtaServer { .name = {}, .url = {} }, ConfiguredOtaServer { .name = {}, .url = {} },
ConfiguredOtaServer { .name = {}, .url = {} },*/
}, },
#endif #endif
}; };

View File

@ -43,7 +43,7 @@ struct StringSettings
std::string url; std::string url;
}; };
std::array<ConfiguredOtaServer, 10> otaServers; std::array<ConfiguredOtaServer, 2> otaServers;
#endif #endif
}; };
@ -89,7 +89,7 @@ void StringSettings::executeForEveryCommonSetting(T &&callable)
callable("otaName0", otaServers[0].name); callable("otaName0", otaServers[0].name);
callable("otaUrl0", otaServers[0].url); callable("otaUrl0", otaServers[0].url);
callable("otaName1", otaServers[1].name); callable("otaName1", otaServers[1].name);
callable("otaUrl1", otaServers[1].url); callable("otaUrl1", otaServers[1].url);/*
callable("otaName2", otaServers[2].name); callable("otaName2", otaServers[2].name);
callable("otaUrl2", otaServers[2].url); callable("otaUrl2", otaServers[2].url);
callable("otaName3", otaServers[3].name); callable("otaName3", otaServers[3].name);
@ -105,7 +105,7 @@ void StringSettings::executeForEveryCommonSetting(T &&callable)
callable("otaName8", otaServers[8].name); callable("otaName8", otaServers[8].name);
callable("otaUrl8", otaServers[8].url); callable("otaUrl8", otaServers[8].url);
callable("otaName9", otaServers[9].name); callable("otaName9", otaServers[9].name);
callable("otaUrl9", otaServers[9].url); callable("otaUrl9", otaServers[9].url);*/
#endif #endif
} }

View File

@ -473,6 +473,7 @@ constexpr char TEXT_CRASH_DIVZERO[] = "42 / 0";
//SelectBuildServerMenu //SelectBuildServerMenu
constexpr char TEXT_SELECTBUILDSERVERMENU[] = "Select Buildserver"; constexpr char TEXT_SELECTBUILDSERVERMENU[] = "Select Buildserver";
constexpr char TEXT_NOBUILDSERVERCONFIGURED[] = "Not configured";
#ifdef FEATURE_CAN #ifdef FEATURE_CAN
constexpr char TEXT_POWERSUPPLY[] = "Powersupply"; constexpr char TEXT_POWERSUPPLY[] = "Powersupply";