Again too many improvements
This commit is contained in:
Submodule components/esp-gui-lib updated: 87b2d2b42a...a29efa4e47
@ -92,7 +92,6 @@ set(headers
|
||||
actions/ledstripblinkactions.h
|
||||
actions/loadsettingsaction.h
|
||||
actions/modesettingsaction.h
|
||||
actions/multiaction.h
|
||||
actions/qraction.h
|
||||
actions/rebootaction.h
|
||||
actions/savesettingsaction.h
|
||||
@ -323,7 +322,6 @@ set(sources
|
||||
actions/ledstripblinkactions.cpp
|
||||
actions/loadsettingsaction.cpp
|
||||
actions/modesettingsaction.cpp
|
||||
actions/multiaction.cpp
|
||||
actions/qraction.cpp
|
||||
actions/rebootaction.cpp
|
||||
actions/savesettingsaction.cpp
|
||||
|
@ -8,5 +8,7 @@ struct WifiApEnabledAccessor : public NewSettingsAccessor<bool> { ConfigWrapper<
|
||||
//struct WifiApDisableWhenOnlineAccessor : public NewSettingsAccessor<bool> { ConfigWrapper<bool> &getConfig() const override { return configs.wifiDisableApWhenOnline; } };
|
||||
struct WifiApNameAccessor : public NewSettingsAccessor<std::string> { ConfigWrapper<std::string> &getConfig() const override { return configs.wifiApName; } };
|
||||
struct WifiApKeyAccessor : public NewSettingsAccessor<std::string> { ConfigWrapper<std::string> &getConfig() const override { return configs.wifiApKey; } };
|
||||
struct WifiApIpAccessor : public NewSettingsAccessor<wifi_stack::ip_address_t> { ConfigWrapper<wifi_stack::ip_address_t> &getConfig() const override { return configs.wifiApIp; } };
|
||||
struct WifiApMaskAccessor : public NewSettingsAccessor<wifi_stack::ip_address_t> { ConfigWrapper<wifi_stack::ip_address_t> &getConfig() const override { return configs.wifiApMask; } };
|
||||
struct WifiApChannelAccessor : public NewSettingsAccessor<uint8_t> { ConfigWrapper<uint8_t> &getConfig() const override { return configs.wifiApChannel; } };
|
||||
struct WifiApAuthmodeAccessor : public NewSettingsAccessor<wifi_auth_mode_t> { ConfigWrapper<wifi_auth_mode_t> &getConfig() const override { return configs.wifiApAuthmode; } };
|
||||
|
@ -1,31 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "actioninterface.h"
|
||||
|
||||
using namespace espgui;
|
||||
|
||||
namespace {
|
||||
template<typename ...T>
|
||||
class MultiAction;
|
||||
|
||||
template<typename T>
|
||||
class MultiAction<T> : public virtual ActionInterface
|
||||
{
|
||||
public:
|
||||
void triggered() override
|
||||
{
|
||||
T{}.triggered();
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T, typename ...Tmore>
|
||||
class MultiAction<T, Tmore...> : public virtual MultiAction<Tmore...>
|
||||
{
|
||||
public:
|
||||
void triggered() override
|
||||
{
|
||||
T{}.triggered();
|
||||
MultiAction<Tmore...>::triggered();
|
||||
}
|
||||
};
|
||||
}
|
@ -2,13 +2,14 @@
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include <changevaluedisplay.h>
|
||||
#include <textwithvaluehelper.h>
|
||||
#include <fmt/core.h>
|
||||
|
||||
// local includes
|
||||
#include "displays/bobbychangevaluedisplay.h"
|
||||
#include "mainmenu.h"
|
||||
#include "displays/calibratevoltagedisplay.h"
|
||||
#include "accessors/settingsaccessors.h"
|
||||
#include "fmt/core.h"
|
||||
#include "battery.h"
|
||||
|
||||
class CurrentBatteryStatusText : public virtual espgui::TextInterface { public: std::string text() const override { return getBatteryPercentageString(); } };
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include <actions/toggleboolaction.h>
|
||||
#include <icons/back.h>
|
||||
#include <checkboxicon.h>
|
||||
#include <textwithvaluehelper.h>
|
||||
|
||||
// local includes
|
||||
#include "displays/bobbychangevaluedisplay.h"
|
||||
|
@ -1,13 +1,14 @@
|
||||
#include "defaultmodesettingsmenu.h"
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include "changevaluedisplay.h"
|
||||
#include "menuitem.h"
|
||||
#include "actions/toggleboolaction.h"
|
||||
#include "actions/switchscreenaction.h"
|
||||
#include "actions/dummyaction.h"
|
||||
#include "checkboxicon.h"
|
||||
#include "icons/back.h"
|
||||
#include <changevaluedisplay.h>
|
||||
#include <menuitem.h>
|
||||
#include <actions/toggleboolaction.h>
|
||||
#include <actions/switchscreenaction.h>
|
||||
#include <actions/dummyaction.h>
|
||||
#include <checkboxicon.h>
|
||||
#include <icons/back.h>
|
||||
#include <textwithvaluehelper.h>
|
||||
|
||||
// local includes
|
||||
#include "displays/bobbychangevaluedisplay.h"
|
||||
|
@ -4,6 +4,9 @@
|
||||
#include <esp_err.h>
|
||||
#include <esp_log.h>
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include <fmt/core.h>
|
||||
|
||||
// local includes
|
||||
#include "actions/switchscreenaction.h"
|
||||
#include "actions/qraction.h"
|
||||
|
@ -2,11 +2,12 @@
|
||||
|
||||
// 3rd party libs
|
||||
#include <fmt/core.h>
|
||||
#include "actions/switchscreenaction.h"
|
||||
#include "actions/toggleboolaction.h"
|
||||
#include "changevaluedisplay.h"
|
||||
#include "checkboxicon.h"
|
||||
#include "icons/back.h"
|
||||
#include <actions/switchscreenaction.h>
|
||||
#include <actions/toggleboolaction.h>
|
||||
#include <changevaluedisplay.h>
|
||||
#include <checkboxicon.h>
|
||||
#include <icons/back.h>
|
||||
#include <textwithvaluehelper.h>
|
||||
|
||||
// local includes
|
||||
#include "displays/bobbychangevaluedisplay.h"
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include <checkboxicon.h>
|
||||
#include <icons/back.h>
|
||||
#include <menuitem.h>
|
||||
#include <textwithvaluehelper.h>
|
||||
|
||||
// local includes
|
||||
#include "displays/bobbychangevaluedisplay.h"
|
||||
|
@ -1,10 +1,11 @@
|
||||
#include "limitssettingsmenu.h"
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include "changevaluedisplay.h"
|
||||
#include "menuitem.h"
|
||||
#include "actions/switchscreenaction.h"
|
||||
#include "icons/back.h"
|
||||
#include <changevaluedisplay.h>
|
||||
#include <menuitem.h>
|
||||
#include <actions/switchscreenaction.h>
|
||||
#include <icons/back.h>
|
||||
#include <textwithvaluehelper.h>
|
||||
|
||||
// local includes
|
||||
#include "displays/bobbychangevaluedisplay.h"
|
||||
|
@ -1,12 +1,13 @@
|
||||
#include "lockscreensettingsmenu.h"
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include "menuitem.h"
|
||||
#include "actions/toggleboolaction.h"
|
||||
#include "actions/switchscreenaction.h"
|
||||
#include "icons/back.h"
|
||||
#include "checkboxicon.h"
|
||||
#include "changevaluedisplay.h"
|
||||
#include <menuitem.h>
|
||||
#include <actions/toggleboolaction.h>
|
||||
#include <actions/switchscreenaction.h>
|
||||
#include <icons/back.h>
|
||||
#include <checkboxicon.h>
|
||||
#include <changevaluedisplay.h>
|
||||
#include <textwithvaluehelper.h>
|
||||
|
||||
// local includes
|
||||
#include "displays/bobbychangevaluedisplay.h"
|
||||
|
@ -1,10 +1,13 @@
|
||||
#include "selectmodemenu.h"
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include <actions/multiaction.h>
|
||||
#include <actions/switchscreenaction.h>
|
||||
#include <icons/back.h>
|
||||
#include <textwithvaluehelper.h>
|
||||
|
||||
// local includes
|
||||
#include "utils.h"
|
||||
#include "actions/multiaction.h"
|
||||
#include "actions/switchscreenaction.h"
|
||||
#include "icons/back.h"
|
||||
#include "globals.h"
|
||||
#include "modes/defaultmode.h"
|
||||
#include "modes/tempomatmode.h"
|
||||
|
@ -1,10 +1,11 @@
|
||||
#include "tempomatmodesettingsmenu.h"
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include "changevaluedisplay.h"
|
||||
#include "menuitem.h"
|
||||
#include "actions/switchscreenaction.h"
|
||||
#include "icons/back.h"
|
||||
#include <changevaluedisplay.h>
|
||||
#include <menuitem.h>
|
||||
#include <actions/switchscreenaction.h>
|
||||
#include <icons/back.h>
|
||||
#include <textwithvaluehelper.h>
|
||||
|
||||
// local includes
|
||||
#include "displays/bobbychangevaluedisplay.h"
|
||||
|
@ -12,9 +12,12 @@
|
||||
#include <icons/back.h>
|
||||
#include <screenmanager.h>
|
||||
#include <espwifistack.h>
|
||||
#include <textwithvaluehelper.h>
|
||||
|
||||
// local includes
|
||||
#include "displays/bobbychangevaluedisplay.h"
|
||||
#include "changevaluedisplay.h"
|
||||
#include "changevaluedisplay_wifi_auth_mode_t.h"
|
||||
#include "wifiapclientsmenu.h"
|
||||
#include "networksettingsmenu.h"
|
||||
#include "accessors/wifiapconfigaccessors.h"
|
||||
@ -29,8 +32,18 @@ constexpr char TEXT_ENABLED[] = "Enabled";
|
||||
constexpr char TEXT_DISABLEWHENONLINE[] = "Disable when online";
|
||||
constexpr char TEXT_BACK[] = "Back";
|
||||
|
||||
constexpr char TEXT_CHANNEL[] = "Channel";
|
||||
constexpr char TEXT_CHANNEL_FORMATTED[] = "Channel: &2";
|
||||
constexpr char TEXT_SSID[] = "AP SSID";
|
||||
constexpr char TEXT_SSID_FORMATTED[] = "&sssid: &2";
|
||||
constexpr char TEXT_KEY[] = "AP Key";
|
||||
constexpr char TEXT_KEY_FORMATTED[] = "&skey: &2";
|
||||
constexpr char TEXT_IP[] = "AP IP";
|
||||
constexpr char TEXT_IP_FORMATTED[] = "&sIP: &f&2";
|
||||
constexpr char TEXT_MASK[] = "AP Mask";
|
||||
constexpr char TEXT_MASK_FORMATTED[] = "&sMask: &f&2";
|
||||
constexpr char TEXT_CHANNEL[] = "AP Channel";
|
||||
constexpr char TEXT_CHANNEL_FORMATTED[] = "&sChannel: &f&2";
|
||||
constexpr char TEXT_AUTHMODE[] = "AP Authmode";
|
||||
constexpr char TEXT_AUTHMODE_FORMATTED[] = "&sAuthmode: &2";
|
||||
|
||||
class WifiApClientsAction : public virtual ActionInterface
|
||||
{
|
||||
@ -45,21 +58,28 @@ using ApChannelChangeScreen = espgui::makeComponent<
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<WifiApSettingsMenu>>,
|
||||
espgui::SwitchScreenAction<WifiApSettingsMenu>
|
||||
>;
|
||||
|
||||
using ApAuthmodeChangeScreen = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<wifi_auth_mode_t>,
|
||||
espgui::StaticText<TEXT_AUTHMODE>,
|
||||
WifiApAuthmodeAccessor,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<WifiApSettingsMenu>>,
|
||||
espgui::SwitchScreenAction<WifiApSettingsMenu>
|
||||
>;
|
||||
} // namespace
|
||||
|
||||
WifiApSettingsMenu::WifiApSettingsMenu()
|
||||
{
|
||||
constructMenuItem<makeComponent<MenuItem, WifiApNameText, DummyAction>>();
|
||||
constructMenuItem<makeComponent<MenuItem, WifiApKeyText, DummyAction>>();
|
||||
constructMenuItem<makeComponent<MenuItem, WifiApMacText, DummyAction>>();
|
||||
constructMenuItem<makeComponent<MenuItem, WifiApIpText, DummyAction>>();
|
||||
constructMenuItem<makeComponent<MenuItem, WifiApMaskText, DummyAction>>();
|
||||
constructMenuItem<makeComponent<MenuItem, WifiApHostnameText, DummyAction>>();
|
||||
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_ENABLED>, ToggleBoolAction, CheckboxIcon, WifiApEnabledAccessor>>();
|
||||
//constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_DISABLEWHENONLINE>, ToggleBoolAction, CheckboxIcon, WifiApDisableWhenOnlineAccessor>>();
|
||||
constructMenuItem<makeComponent<MenuItem, TextWithValueHelper<TEXT_SSID_FORMATTED, WifiApNameAccessor>, DummyAction>>();
|
||||
constructMenuItem<makeComponent<MenuItem, TextWithValueHelper<TEXT_KEY_FORMATTED, WifiApKeyAccessor>, DummyAction>>();
|
||||
constructMenuItem<makeComponent<MenuItem, WifiApMacText, DummyAction>>();
|
||||
constructMenuItem<makeComponent<MenuItem, TextWithValueHelper<TEXT_IP_FORMATTED, WifiApIpAccessor>, DummyAction>>();
|
||||
constructMenuItem<makeComponent<MenuItem, TextWithValueHelper<TEXT_MASK_FORMATTED, WifiApMaskAccessor>, DummyAction>>();
|
||||
constructMenuItem<makeComponent<MenuItem, TextWithValueHelper<TEXT_CHANNEL_FORMATTED, WifiApChannelAccessor>, SwitchScreenAction<ApChannelChangeScreen>>>();
|
||||
|
||||
constructMenuItem<makeComponent<MenuItem, TextWithValueHelper<TEXT_AUTHMODE_FORMATTED, WifiApAuthmodeAccessor>, SwitchScreenAction<ApAuthmodeChangeScreen>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, WifiApHostnameText, DummyAction>>();
|
||||
constructMenuItem<makeComponent<MenuItem, WifiApClientsText, WifiApClientsAction>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BACK>, SwitchScreenAction<NetworkSettingsMenu>, StaticMenuItemIcon<&icons::back>>>();
|
||||
}
|
||||
|
@ -104,6 +104,8 @@ public:
|
||||
ConfigWrapper<bool> wifiApEnabled {true, DoReset, {}, "wifiApEnabled" };
|
||||
ConfigWrapper<std::string> wifiApName {defaultHostname, DoReset, StringMinMaxSize<4, 32>, "wifiApName" };
|
||||
ConfigWrapper<std::string> wifiApKey {"Passwort_123", DoReset, StringOr<StringEmpty, StringMinMaxSize<8, 64>>, "wifiApKey" };
|
||||
ConfigWrapper<wifi_stack::ip_address_t> wifiApIp{wifi_stack::ip_address_t{10, 0, 0, 1},DoReset, {}, "wifiApIp" };
|
||||
ConfigWrapper<wifi_stack::ip_address_t> wifiApMask{wifi_stack::ip_address_t{255, 255, 255, 0},DoReset, {}, "wifiApMask" };
|
||||
ConfigWrapper<uint8_t> wifiApChannel {1, DoReset, MinMaxValue<uint8_t, 1, 14>, "wifiApChannel" };
|
||||
ConfigWrapper<wifi_auth_mode_t> wifiApAuthmode{WIFI_AUTH_WPA2_PSK, DoReset, {}, "wifiApAuthmode" };
|
||||
|
||||
@ -270,6 +272,8 @@ public:
|
||||
x(wifiApEnabled) \
|
||||
x(wifiApName) \
|
||||
x(wifiApKey) \
|
||||
x(wifiApIp) \
|
||||
x(wifiApMask) \
|
||||
x(wifiApChannel) \
|
||||
x(wifiApAuthmode) \
|
||||
\
|
||||
|
@ -8,22 +8,8 @@
|
||||
#include <espwifistack.h>
|
||||
#include <richtextrenderer.h>
|
||||
|
||||
// local includes
|
||||
#include "newsettings.h"
|
||||
#include "wifi_bobbycar.h"
|
||||
|
||||
using namespace espgui;
|
||||
|
||||
std::string WifiApNameText::text() const
|
||||
{
|
||||
return fmt::format("&sssid: &f{}", richTextEscape(configs.wifiApName.value));
|
||||
}
|
||||
|
||||
std::string WifiApKeyText::text() const
|
||||
{
|
||||
return fmt::format("&skey: &f{}", richTextEscape(configs.wifiApKey.value));
|
||||
}
|
||||
|
||||
std::string WifiApMacText::text() const
|
||||
{
|
||||
std::string text = "&smac: &f";
|
||||
@ -35,16 +21,6 @@ std::string WifiApMacText::text() const
|
||||
return text;
|
||||
}
|
||||
|
||||
std::string WifiApIpText::text() const
|
||||
{
|
||||
return fmt::format("&sip: &f{}", wifi_stack::toString(apIP));
|
||||
}
|
||||
|
||||
std::string WifiApMaskText::text() const
|
||||
{
|
||||
return fmt::format("&smask: &f{}", wifi_stack::toString(netMsk));
|
||||
}
|
||||
|
||||
std::string WifiApHostnameText::text() const
|
||||
{
|
||||
if (auto hostname = wifi_stack::get_hostname_for_interface(ESP_IF_WIFI_AP))
|
||||
|
@ -3,36 +3,12 @@
|
||||
// 3rdparty lib includes
|
||||
#include <textinterface.h>
|
||||
|
||||
class WifiApNameText : public virtual espgui::TextInterface
|
||||
{
|
||||
public:
|
||||
std::string text() const override;
|
||||
};
|
||||
|
||||
class WifiApKeyText : public virtual espgui::TextInterface
|
||||
{
|
||||
public:
|
||||
std::string text() const override;
|
||||
};
|
||||
|
||||
class WifiApMacText : public virtual espgui::TextInterface
|
||||
{
|
||||
public:
|
||||
std::string text() const override;
|
||||
};
|
||||
|
||||
class WifiApIpText : public virtual espgui::TextInterface
|
||||
{
|
||||
public:
|
||||
std::string text() const override;
|
||||
};
|
||||
|
||||
class WifiApMaskText : public virtual espgui::TextInterface
|
||||
{
|
||||
public:
|
||||
std::string text() const override;
|
||||
};
|
||||
|
||||
class WifiApHostnameText : public virtual espgui::TextInterface
|
||||
{
|
||||
public:
|
||||
|
@ -131,9 +131,9 @@ std::optional<wifi_stack::ap_config> createApConfig()
|
||||
.ssid = configs.wifiApName.value,
|
||||
.key = configs.wifiApKey.value,
|
||||
.static_ip = {
|
||||
.ip = apIP,
|
||||
.subnet = netMsk,
|
||||
.gateway = apIP
|
||||
.ip = configs.wifiApIp.value,
|
||||
.subnet = configs.wifiApMask.value,
|
||||
.gateway = configs.wifiApIp.value,
|
||||
},
|
||||
.channel = configs.wifiApChannel.value,
|
||||
.authmode = configs.wifiApAuthmode.value,
|
||||
|
@ -6,9 +6,6 @@
|
||||
// 3rdparty lib includes
|
||||
#include <espwifiutils.h>
|
||||
|
||||
constexpr const wifi_stack::ip_address_t apIP{10, 0, 0, 1};
|
||||
constexpr const wifi_stack::ip_address_t netMsk{255, 255, 255, 0};
|
||||
|
||||
void wifi_begin();
|
||||
|
||||
void wifi_update();
|
||||
|
Reference in New Issue
Block a user