Push/Pop screens
This commit is contained in:
@ -30,24 +30,23 @@ public:
|
||||
|
||||
void ModeSettingsAction::triggered()
|
||||
{
|
||||
if (
|
||||
currentMode == &modes::defaultMode
|
||||
#ifdef FEATURE_JOYSTICK
|
||||
if (currentMode == &modes::defaultMode
|
||||
#ifdef FEATURE_JOYSTICK
|
||||
|| currentMode == &modes::wheelchairMode
|
||||
#endif
|
||||
#endif
|
||||
)
|
||||
switchScreen<DefaultModeSettingsMenu>();
|
||||
pushScreen<DefaultModeSettingsMenu>();
|
||||
else if (currentMode == &modes::tempomatMode)
|
||||
switchScreen<TempomatModeSettingsMenu>();
|
||||
pushScreen<TempomatModeSettingsMenu>();
|
||||
else if (currentMode == &modes::larsmMode)
|
||||
switchScreen<LarsmModeSettingsMenu>();
|
||||
pushScreen<LarsmModeSettingsMenu>();
|
||||
else if (currentMode == &modes::mickMode)
|
||||
switchScreen<MickModeSettingsMenu>();
|
||||
pushScreen<MickModeSettingsMenu>();
|
||||
else if (currentMode == &modes::motortestMode)
|
||||
switchScreen<MotortestModeSettingsMenu>();
|
||||
pushScreen<MotortestModeSettingsMenu>();
|
||||
#ifdef FEATURE_GAMETRAK
|
||||
else if (currentMode == &modes::gametrakMode)
|
||||
switchScreen<GametrakModeSettingsMenu>();
|
||||
pushScreen<GametrakModeSettingsMenu>();
|
||||
#endif
|
||||
else
|
||||
{
|
||||
|
@ -100,9 +100,11 @@ void BmsDisplay::buttonPressed(espgui::Button button)
|
||||
|
||||
switch (button)
|
||||
{
|
||||
case Button::Right: switchScreen<MainMenu>(); break;
|
||||
using espgui::Button;
|
||||
case Button::Right: pushScreen<MainMenu>(); break;
|
||||
case Button::Up: switchScreen<MetersDisplay>(); break;
|
||||
case Button::Down: switchScreen<StatusDisplay>();
|
||||
case Button::Down: switchScreen<StatusDisplay>(); break;
|
||||
default:;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -7,19 +7,16 @@
|
||||
#include <TFT_eSPI.h>
|
||||
#include <cpputils.h>
|
||||
#include <menuitem.h>
|
||||
#include <actions/switchscreenaction.h>
|
||||
#include <actioninterface.h>
|
||||
#include <tftinstance.h>
|
||||
#include <screenmanager.h>
|
||||
#include <actions/dummyaction.h>
|
||||
|
||||
// local includes
|
||||
#include "menudisplay.h"
|
||||
#include "utils.h"
|
||||
#include "icons/back.h"
|
||||
#include "icons/bobbycar.h"
|
||||
#include "actions/dummyaction.h"
|
||||
#include "globals.h"
|
||||
#include "displays/menus/ledstripmenu.h"
|
||||
|
||||
namespace {
|
||||
constexpr char TEXT_LEDSTRIPCOLORMENU[] = "Customize Ledstrip";
|
||||
@ -101,7 +98,7 @@ void LedstripColorsDisplay::buttonPressed(espgui::Button button)
|
||||
case Button::Left:
|
||||
if(!state_select_color)
|
||||
{
|
||||
espgui::switchScreen<LedstripMenu>();
|
||||
espgui::popScreen();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -80,7 +80,7 @@ BatteryMenu::BatteryMenu()
|
||||
constructMenuItem<makeComponent<MenuItem, TextWithValueHelper<TEXT_CELL_SERIES, BatterySeriesCellsAccessor>, SwitchScreenAction<BatteryCellSeriesChangeScreen>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, TextWithValueHelper<TEXT_CELL_PARALLEL, BatteryParallelCellsAccessor>, SwitchScreenAction<BatteryCellParallelChangeScreen>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, TextWithValueHelper<TEXT_BATTERY_WHKM, BatteryWHperKMAccessor>, SwitchScreenAction<BatteryWHperKMChangeScreen>>>();
|
||||
constructMenuItem<SwitchScreenTypeSafeChangeMenuItem<BatteryCellType, BatteryMenu, TEXT_SELECT_CELL_TYPE>>(&configs.battery.cellType);
|
||||
constructMenuItem<PopScreenTypeSafeChangeMenuItem<BatteryCellType, TEXT_SELECT_CELL_TYPE>>(&configs.battery.cellType);
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_SHOW_BATTERY_GRAPH>, SwitchScreenAction<BatteryGraphDisplay>, StaticMenuItemIcon<&bobbyicons::graph>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, EmptyText, DummyAction>>();
|
||||
constructMenuItem<makeComponent<MenuItem, WhStatisticsText, DummyAction>>();
|
||||
|
@ -3,7 +3,8 @@
|
||||
// 3rdparty lib includes
|
||||
#include <changevaluedisplay.h>
|
||||
#include <menuitem.h>
|
||||
#include <actions/switchscreenaction.h>
|
||||
#include <actions/pushscreenaction.h>
|
||||
#include <actions/popscreenaction.h>
|
||||
#include <actions/dummyaction.h>
|
||||
#include <icons/back.h>
|
||||
#include <textwithvaluehelper.h>
|
||||
@ -14,7 +15,6 @@
|
||||
#include "changevaluedisplay_unifiedmodelmode.h"
|
||||
#include "accessors/settingsaccessors.h"
|
||||
#include "displays/menus/handbremssettingsmenu.h"
|
||||
#include "displays/menus/modessettingsmenu.h"
|
||||
#include "bobbycheckbox.h"
|
||||
|
||||
namespace {
|
||||
@ -49,71 +49,71 @@ using DefaultModeModelModeChangeDisplay = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<UnifiedModelMode>,
|
||||
espgui::StaticText<TEXT_MODELMODE>,
|
||||
DefaultModeModelModeAccessor,
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>
|
||||
espgui::ConfirmActionInterface<espgui::PopScreenAction>,
|
||||
espgui::BackActionInterface<espgui::PopScreenAction>
|
||||
>;
|
||||
using DefaultModeSmoothingChangeDisplay = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<int16_t>,
|
||||
espgui::StaticText<TEXT_SMOOTHINGVAL>,
|
||||
DefaultModeSmoothingAccessor,
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>
|
||||
espgui::ConfirmActionInterface<espgui::PopScreenAction>,
|
||||
espgui::BackActionInterface<espgui::PopScreenAction>
|
||||
>;
|
||||
using DefaultModeFwSmoothingLowerLimitChangeDisplay = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<int16_t>,
|
||||
espgui::StaticText<TEXT_FWSMOOTHING_LIMIT>,
|
||||
DefaultModeEnableFieldWeakSmoothingLowerLimitAccessor,
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>
|
||||
espgui::ConfirmActionInterface<espgui::PopScreenAction>,
|
||||
espgui::BackActionInterface<espgui::PopScreenAction>
|
||||
>;
|
||||
using DefaultModeFrontPercentageChangeDisplay = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<int16_t>,
|
||||
espgui::StaticText<TEXT_FRONTPERCENTAGE>,
|
||||
DefaultModeFrontPercentageAccessor,
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>
|
||||
espgui::ConfirmActionInterface<espgui::PopScreenAction>,
|
||||
espgui::BackActionInterface<espgui::PopScreenAction>
|
||||
>;
|
||||
using DefaultModeBackPercentageChangeDisplay = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<int16_t>,
|
||||
espgui::StaticText<TEXT_BACKPERCENTAGE>,
|
||||
DefaultModeBackPercentageAccessor,
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>
|
||||
espgui::ConfirmActionInterface<espgui::PopScreenAction>,
|
||||
espgui::BackActionInterface<espgui::PopScreenAction>
|
||||
>;
|
||||
using DefaultModeAddSchwelleChangeDisplay = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<int16_t>,
|
||||
espgui::StaticText<TEXT_ADDSCHWELLE>,
|
||||
DefaultModeAddSchwelleAccessor,
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>
|
||||
espgui::ConfirmActionInterface<espgui::PopScreenAction>,
|
||||
espgui::BackActionInterface<espgui::PopScreenAction>
|
||||
>;
|
||||
using DefaultModeGas1WertChangeDisplay = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<int16_t>,
|
||||
espgui::StaticText<TEXT_ADDGASVAL>,
|
||||
DefaultModeGas1WertAccessor,
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>
|
||||
espgui::ConfirmActionInterface<espgui::PopScreenAction>,
|
||||
espgui::BackActionInterface<espgui::PopScreenAction>
|
||||
>;
|
||||
using DefaultModeGas2WertChangeDisplay = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<int16_t>,
|
||||
espgui::StaticText<TEXT_SUBGASVAL>,
|
||||
DefaultModeGas2WertAccessor,
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>
|
||||
espgui::ConfirmActionInterface<espgui::PopScreenAction>,
|
||||
espgui::BackActionInterface<espgui::PopScreenAction>
|
||||
>;
|
||||
using DefaultModeBrems1WertChangeDisplay = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<int16_t>,
|
||||
espgui::StaticText<TEXT_ADDBRAKEVAL>,
|
||||
DefaultModeBrems1WertAccessor,
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>
|
||||
espgui::ConfirmActionInterface<espgui::PopScreenAction>,
|
||||
espgui::BackActionInterface<espgui::PopScreenAction>
|
||||
>;
|
||||
using DefaultModeBrems2WertChangeDisplay = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<int16_t>,
|
||||
espgui::StaticText<TEXT_SUBBRAKEVAL>,
|
||||
DefaultModeBrems2WertAccessor,
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>
|
||||
espgui::ConfirmActionInterface<espgui::PopScreenAction>,
|
||||
espgui::BackActionInterface<espgui::PopScreenAction>
|
||||
>;
|
||||
} // namespace
|
||||
|
||||
@ -121,24 +121,24 @@ using namespace espgui;
|
||||
|
||||
DefaultModeSettingsMenu::DefaultModeSettingsMenu()
|
||||
{
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_MODELMODE>, SwitchScreenAction<DefaultModeModelModeChangeDisplay>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_MODELMODE>, PushScreenAction<DefaultModeModelModeChangeDisplay>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_SQUAREGAS>, BobbyCheckbox, DefaultModeSquareGasAccessor>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_SQUAREBREMS>, BobbyCheckbox, DefaultModeSquareBremsAccessor>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_ENABLESMOOTHINGUP>, BobbyCheckbox, DefaultModeEnableSmoothingUpAccessor>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_ENABLESMOOTHINGDOWN>, BobbyCheckbox, DefaultModeEnableSmoothingDownAccessor>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_ENABLEFWSMOOTHINGUP>, BobbyCheckbox, DefaultModeEnableFieldWeakSmoothingUpAccessor>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_ENABLEFWSMOOTHINGDOWN>, BobbyCheckbox, DefaultModeEnableFieldWeakSmoothingDownAccessor>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_HANDBREMSE>, SwitchScreenAction<HandbremsSettingsMenu>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, TextWithValueHelper<TEXT_FWSMOOTHING_LIMIT, DefaultModeEnableFieldWeakSmoothingLowerLimitAccessor>, SwitchScreenAction<DefaultModeFwSmoothingLowerLimitChangeDisplay>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, TextWithValueHelper<TEXT_SMOOTHINGVAL, DefaultModeSmoothingAccessor>, SwitchScreenAction<DefaultModeSmoothingChangeDisplay>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, TextWithValueHelper<TEXT_FRONTPERCENTAGE, DefaultModeFrontPercentageAccessor>, SwitchScreenAction<DefaultModeFrontPercentageChangeDisplay>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, TextWithValueHelper<TEXT_BACKPERCENTAGE, DefaultModeBackPercentageAccessor>, SwitchScreenAction<DefaultModeBackPercentageChangeDisplay>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, TextWithValueHelper<TEXT_ADDSCHWELLE, DefaultModeAddSchwelleAccessor>, SwitchScreenAction<DefaultModeAddSchwelleChangeDisplay>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, TextWithValueHelper<TEXT_SUBGASVAL, DefaultModeGas2WertAccessor>, SwitchScreenAction<DefaultModeGas2WertChangeDisplay>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, TextWithValueHelper<TEXT_SUBBRAKEVAL, DefaultModeBrems2WertAccessor>, SwitchScreenAction<DefaultModeBrems2WertChangeDisplay>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, TextWithValueHelper<TEXT_ADDGASVAL, DefaultModeGas1WertAccessor>, SwitchScreenAction<DefaultModeGas1WertChangeDisplay>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, TextWithValueHelper<TEXT_ADDBRAKEVAL, DefaultModeBrems1WertAccessor>, SwitchScreenAction<DefaultModeBrems1WertChangeDisplay>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BACK>, SwitchScreenAction<ModesSettingsMenu>, StaticMenuItemIcon<&espgui::icons::back>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_HANDBREMSE>, PushScreenAction<HandbremsSettingsMenu>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, TextWithValueHelper<TEXT_FWSMOOTHING_LIMIT, DefaultModeEnableFieldWeakSmoothingLowerLimitAccessor>, PushScreenAction<DefaultModeFwSmoothingLowerLimitChangeDisplay>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, TextWithValueHelper<TEXT_SMOOTHINGVAL, DefaultModeSmoothingAccessor>, PushScreenAction<DefaultModeSmoothingChangeDisplay>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, TextWithValueHelper<TEXT_FRONTPERCENTAGE, DefaultModeFrontPercentageAccessor>, PushScreenAction<DefaultModeFrontPercentageChangeDisplay>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, TextWithValueHelper<TEXT_BACKPERCENTAGE, DefaultModeBackPercentageAccessor>, PushScreenAction<DefaultModeBackPercentageChangeDisplay>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, TextWithValueHelper<TEXT_ADDSCHWELLE, DefaultModeAddSchwelleAccessor>, PushScreenAction<DefaultModeAddSchwelleChangeDisplay>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, TextWithValueHelper<TEXT_SUBGASVAL, DefaultModeGas2WertAccessor>, PushScreenAction<DefaultModeGas2WertChangeDisplay>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, TextWithValueHelper<TEXT_SUBBRAKEVAL, DefaultModeBrems2WertAccessor>, PushScreenAction<DefaultModeBrems2WertChangeDisplay>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, TextWithValueHelper<TEXT_ADDGASVAL, DefaultModeGas1WertAccessor>, PushScreenAction<DefaultModeGas1WertChangeDisplay>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, TextWithValueHelper<TEXT_ADDBRAKEVAL, DefaultModeBrems1WertAccessor>, PushScreenAction<DefaultModeBrems1WertChangeDisplay>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BACK>, PopScreenAction, StaticMenuItemIcon<&espgui::icons::back>>>();
|
||||
}
|
||||
|
||||
std::string DefaultModeSettingsMenu::text() const
|
||||
@ -148,5 +148,5 @@ std::string DefaultModeSettingsMenu::text() const
|
||||
|
||||
void DefaultModeSettingsMenu::back()
|
||||
{
|
||||
switchScreen<ModesSettingsMenu>();
|
||||
popScreen();
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include "displays/bobbymenudisplay.h"
|
||||
#include "utils.h"
|
||||
#include "menuitem.h"
|
||||
#include "actions/switchscreenaction.h"
|
||||
#include "actions/popscreenaction.h"
|
||||
#include "icons/back.h"
|
||||
|
||||
namespace {
|
||||
@ -16,7 +16,7 @@ class ContainerModeSettingsMenu :
|
||||
public:
|
||||
ContainerModeSettingsMenu()
|
||||
{
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BACK>, SwitchScreenAction<ModesSettingsMenu>, StaticMenuItemIcon<&espgui::icons::back>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BACK>, PopScreenAction, StaticMenuItemIcon<&espgui::icons::back>>>();
|
||||
}
|
||||
|
||||
std::string text() const override
|
||||
|
@ -39,7 +39,7 @@ HandbremsSettingsMenu::HandbremsSettingsMenu()
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_HANDBREMSE_ENABLE>, BobbyCheckbox, HandbremsEnabledAccessor>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_HANDBREMSE_AUTOMATIC>, BobbyCheckbox, HandbremsAutomaticAccessor>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_HANDBREMSE_VISUALIZE>, BobbyCheckbox, HandbremsVisualizeAccessor>>();
|
||||
constructMenuItem<SwitchScreenTypeSafeChangeMenuItem<HandbremseMode, HandbremsSettingsMenu, TEXT_HANDBREMSE_MODE>>(&configs.handbremse.mode);
|
||||
constructMenuItem<PushScreenTypeSafeChangeMenuItem<HandbremseMode, TEXT_HANDBREMSE_MODE>>(&configs.handbremse.mode);
|
||||
constructMenuItem<makeComponent<MenuItem, TextWithValueHelper<TEXT_HANDBREMSE_TRIGGERTIMEOUT, HandbremsTimeoutAccessor>, SwitchScreenAction<HandBremsTriggerTimeoutChangeValueDisplay>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BACK>, SwitchScreenAction<DefaultModeSettingsMenu>, StaticMenuItemIcon<&espgui::icons::back>>>();
|
||||
}
|
||||
|
@ -3,7 +3,8 @@
|
||||
// 3rdparty lib includes
|
||||
#include "changevaluedisplay.h"
|
||||
#include "menuitem.h"
|
||||
#include "actions/switchscreenaction.h"
|
||||
#include "actions/pushscreenaction.h"
|
||||
#include "actions/popscreenaction.h"
|
||||
#include "icons/back.h"
|
||||
|
||||
// local includes
|
||||
@ -12,7 +13,6 @@
|
||||
#include "changevaluedisplay_larsmmode_mode.h"
|
||||
#include "changevaluedisplay_unifiedmodelmode.h"
|
||||
#include "accessors/settingsaccessors.h"
|
||||
#include "displays/menus/modessettingsmenu.h"
|
||||
|
||||
namespace {
|
||||
constexpr char TEXT_LARSMMODESETTINGS[] = "Larsm mode settings";
|
||||
@ -25,22 +25,22 @@ using LarsmModeModelModeChangeDisplay = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<UnifiedModelMode>,
|
||||
espgui::StaticText<TEXT_MODELMODE>,
|
||||
LarsmModeModelModeAccessor,
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<LarsmModeSettingsMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<LarsmModeSettingsMenu>>
|
||||
espgui::ConfirmActionInterface<espgui::PopScreenAction>,
|
||||
espgui::BackActionInterface<espgui::PopScreenAction>
|
||||
>;
|
||||
using LarsmModeModeChangeDisplay = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<LarsmModeMode>,
|
||||
espgui::StaticText<TEXT_SETMODE>,
|
||||
LarsmModeModeAccessor,
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<LarsmModeSettingsMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<LarsmModeSettingsMenu>>
|
||||
espgui::ConfirmActionInterface<espgui::PopScreenAction>,
|
||||
espgui::BackActionInterface<espgui::PopScreenAction>
|
||||
>;
|
||||
using LarsmModeIterationsChangeDisplay = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<uint8_t>,
|
||||
espgui::StaticText<TEXT_SETITERATIONS>,
|
||||
LarsmModeIterationsAccessor,
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<LarsmModeSettingsMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<LarsmModeSettingsMenu>>
|
||||
espgui::ConfirmActionInterface<espgui::PopScreenAction>,
|
||||
espgui::BackActionInterface<espgui::PopScreenAction>
|
||||
>;
|
||||
} // namespace
|
||||
|
||||
@ -48,10 +48,10 @@ using namespace espgui;
|
||||
|
||||
LarsmModeSettingsMenu::LarsmModeSettingsMenu()
|
||||
{
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_MODELMODE>, SwitchScreenAction<LarsmModeModelModeChangeDisplay>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_SETMODE>, SwitchScreenAction<LarsmModeModeChangeDisplay>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_SETITERATIONS>, SwitchScreenAction<LarsmModeIterationsChangeDisplay>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BACK>, SwitchScreenAction<ModesSettingsMenu>, StaticMenuItemIcon<&espgui::icons::back>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_MODELMODE>, PushScreenAction<LarsmModeModelModeChangeDisplay>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_SETMODE>, PushScreenAction<LarsmModeModeChangeDisplay>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_SETITERATIONS>, PushScreenAction<LarsmModeIterationsChangeDisplay>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BACK>, PopScreenAction, StaticMenuItemIcon<&espgui::icons::back>>>();
|
||||
}
|
||||
|
||||
std::string LarsmModeSettingsMenu::text() const
|
||||
@ -61,5 +61,5 @@ std::string LarsmModeSettingsMenu::text() const
|
||||
|
||||
void LarsmModeSettingsMenu::back()
|
||||
{
|
||||
switchScreen<ModesSettingsMenu>();
|
||||
popScreen();
|
||||
}
|
||||
|
@ -3,7 +3,8 @@
|
||||
// 3rdparty lib includes
|
||||
#include <FastLED.h>
|
||||
#include <actioninterface.h>
|
||||
#include <actions/switchscreenaction.h>
|
||||
#include <actions/pushscreenaction.h>
|
||||
#include <actions/popscreenaction.h>
|
||||
#include <changevaluedisplay.h>
|
||||
#include <icons/back.h>
|
||||
#include <menuitem.h>
|
||||
@ -53,32 +54,32 @@ using LedsCountChangeScreen = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<int16_t>,
|
||||
espgui::StaticText<TEXT_LEDSCOUNT>,
|
||||
LedsCountAccessor,
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<LedstripMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<LedstripMenu>>
|
||||
espgui::ConfirmActionInterface<espgui::PopScreenAction>,
|
||||
espgui::BackActionInterface<espgui::PopScreenAction>
|
||||
>;
|
||||
|
||||
using CenterOffsetChangeScreen = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<int16_t>,
|
||||
espgui::StaticText<TEXT_CENTEROFFSET>,
|
||||
CenterOffsetAccessor,
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<LedstripMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<LedstripMenu>>
|
||||
espgui::ConfirmActionInterface<espgui::PopScreenAction>,
|
||||
espgui::BackActionInterface<espgui::PopScreenAction>
|
||||
>;
|
||||
|
||||
using SmallOffsetChangeScreen = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<int16_t>,
|
||||
espgui::StaticText<TEXT_SMALLOFFSET>,
|
||||
SmallOffsetAccessor,
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<LedstripMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<LedstripMenu>>
|
||||
espgui::ConfirmActionInterface<espgui::PopScreenAction>,
|
||||
espgui::BackActionInterface<espgui::PopScreenAction>
|
||||
>;
|
||||
|
||||
using BigOffsetChangeScreen = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<int16_t>,
|
||||
espgui::StaticText<TEXT_BIGOFFSET>,
|
||||
BigOffsetAccessor,
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<LedstripMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<LedstripMenu>>
|
||||
espgui::ConfirmActionInterface<espgui::PopScreenAction>,
|
||||
espgui::BackActionInterface<espgui::PopScreenAction>
|
||||
>;
|
||||
|
||||
using LedStripMaxAmpereChangeScreen = espgui::makeComponent<
|
||||
@ -86,40 +87,40 @@ using LedStripMaxAmpereChangeScreen = espgui::makeComponent<
|
||||
espgui::StaticText<TEXT_LEDSTRIPCURRENTLIMIT>,
|
||||
LedStripMaxAmpereAccessor,
|
||||
espgui::RatioNumberStep<float, std::ratio<1,10>>,
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<LedstripMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<LedstripMenu>>
|
||||
espgui::ConfirmActionInterface<espgui::PopScreenAction>,
|
||||
espgui::BackActionInterface<espgui::PopScreenAction>
|
||||
>;
|
||||
|
||||
using StVOOffsetChangeScreen = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<int16_t>,
|
||||
espgui::StaticText<TEXT_STVO_FRONTOFFSET>,
|
||||
LedsStVOFrontOffsetAccessor,
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<LedstripMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<LedstripMenu>>
|
||||
espgui::ConfirmActionInterface<espgui::PopScreenAction>,
|
||||
espgui::BackActionInterface<espgui::PopScreenAction>
|
||||
>;
|
||||
|
||||
using StVOLengthChangeScreen = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<int16_t>,
|
||||
espgui::StaticText<TEXT_STVO_FRONTLENGTH>,
|
||||
LedsStVOFrontLengthAccessor,
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<LedstripMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<LedstripMenu>>
|
||||
espgui::ConfirmActionInterface<espgui::PopScreenAction>,
|
||||
espgui::BackActionInterface<espgui::PopScreenAction>
|
||||
>;
|
||||
|
||||
using AnimationMultiplierChangeScreen = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<int16_t>,
|
||||
espgui::StaticText<TEXT_ANIMATION_MULTIPLIER>,
|
||||
AnimationMultiplierAccessor,
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<LedstripMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<LedstripMenu>>
|
||||
espgui::ConfirmActionInterface<espgui::PopScreenAction>,
|
||||
espgui::BackActionInterface<espgui::PopScreenAction>
|
||||
>;
|
||||
|
||||
using LedStripBrightnessChangeScreen = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<uint8_t>,
|
||||
espgui::StaticText<TEXT_LEDSTRIP_BRIGHTNESS>,
|
||||
LedstripBrightnessAccessor,
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<LedstripMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<LedstripMenu>>
|
||||
espgui::ConfirmActionInterface<espgui::PopScreenAction>,
|
||||
espgui::BackActionInterface<espgui::PopScreenAction>
|
||||
>;
|
||||
|
||||
class AllCustomLedsOffAction : public virtual espgui::ActionInterface
|
||||
@ -154,30 +155,31 @@ LedstripMenu::LedstripMenu()
|
||||
constructMenuItem<makeComponent<MenuItem, espgui::StaticText<TEXT_AUTOMATIC_LIGHTS>, BobbyCheckbox, LedstripAutomaticLightAccessor>>();
|
||||
|
||||
constructMenuItem<makeComponent<MenuItem, espgui::StaticText<TEXT_LEDANIMATION>, BobbyCheckbox, EnableLedAnimationAccessor>>();
|
||||
constructMenuItem<SwitchScreenTypeSafeChangeMenuItem<LedstripAnimation, LedstripMenu, TEXT_SELECTANIMATION>>(&configs.ledstrip.animationType);
|
||||
|
||||
constructMenuItem<makeComponent<MenuItem, espgui::StaticText<TEXT_BRAKELIGHTS>, BobbyCheckbox, EnableBrakeLightsAccessor>>();
|
||||
constructMenuItem<PushScreenTypeSafeChangeMenuItem<LedstripAnimation, TEXT_SELECTANIMATION>>(&configs.ledstrip.animationType);
|
||||
|
||||
constructMenuItem<makeComponent<MenuItem, espgui::StaticText<TEXT_LEDSTRIPCOLORMENU>, espgui::SwitchScreenAction<LedstripColorsDisplay>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, espgui::StaticText<TEXT_BRAKELIGHTS>, BobbyCheckbox, EnableBrakeLightsAccessor>>();
|
||||
|
||||
constructMenuItem<makeComponent<MenuItem, espgui::StaticText<TEXT_LEDSTRIPCOLORMENU>, espgui::PushScreenAction<LedstripColorsDisplay>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, espgui::StaticText<TEXT_LEDSTRIP_ALLCUSTOMOFF>, AllCustomLedsOffAction>>();
|
||||
|
||||
constructMenuItem<makeComponent<MenuItem, espgui::StaticText<TEXT_BLINKBEEP>, BobbyCheckbox, EnableBeepWhenBlinkAccessor>>();
|
||||
constructMenuItem<makeComponent<MenuItem, espgui::StaticText<TEXT_FULLBLINK>, BobbyCheckbox, EnableFullBlinkAccessor>>();
|
||||
constructMenuItem<makeComponent<MenuItem, espgui::StaticText<TEXT_BLINKBEEP>, BobbyCheckbox, EnableBeepWhenBlinkAccessor>>();
|
||||
constructMenuItem<makeComponent<MenuItem, espgui::StaticText<TEXT_FULLBLINK>, BobbyCheckbox, EnableFullBlinkAccessor>>();
|
||||
|
||||
if (!simplified) { constructMenuItem<makeComponent<MenuItem, TextWithValueHelper<TEXT_STVO_FRONTOFFSET, LedsStVOFrontOffsetAccessor>, espgui::SwitchScreenAction<StVOOffsetChangeScreen>>>(); }
|
||||
if (!simplified) { constructMenuItem<makeComponent<MenuItem, TextWithValueHelper<TEXT_STVO_FRONTLENGTH, LedsStVOFrontLengthAccessor>, espgui::SwitchScreenAction<StVOLengthChangeScreen>>>(); }
|
||||
if (!simplified) { constructMenuItem<makeComponent<MenuItem, TextWithValueHelper<TEXT_STVO_FRONTOFFSET, LedsStVOFrontOffsetAccessor>, espgui::PushScreenAction<StVOOffsetChangeScreen>>>(); }
|
||||
if (!simplified) { constructMenuItem<makeComponent<MenuItem, TextWithValueHelper<TEXT_STVO_FRONTLENGTH, LedsStVOFrontLengthAccessor>, espgui::PushScreenAction<StVOLengthChangeScreen>>>(); }
|
||||
|
||||
constructMenuItem<makeComponent<MenuItem, espgui::StaticText<TEXT_BLINKANIMATION>, espgui::SwitchScreenAction<LedstripSelectBlinkMenu>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, espgui::StaticText<TEXT_BLINKANIMATION>, espgui::PushScreenAction<LedstripSelectBlinkMenu>>>();
|
||||
if (configs.feature.ota.isEnabled.value)
|
||||
if (!simplified) { constructMenuItem<makeComponent<MenuItem, espgui::StaticText<TEXT_LEDSTRIP_CHANGE_OTA_ANIM>, espgui::SwitchScreenAction<LedstripOtaAnimationChangeMenu>>>(); }
|
||||
constructMenuItem<makeComponent<MenuItem, espgui::StaticText<TEXT_ANIMATION_MULTIPLIER>, espgui::SwitchScreenAction<AnimationMultiplierChangeScreen>>>();
|
||||
if (!simplified) { constructMenuItem<makeComponent<MenuItem, TextWithValueHelper<TEXT_LEDSCOUNT, LedsCountAccessor>, espgui::SwitchScreenAction<LedsCountChangeScreen>>>(); }
|
||||
if (!simplified) { constructMenuItem<makeComponent<MenuItem, TextWithValueHelper<TEXT_CENTEROFFSET, CenterOffsetAccessor>, espgui::SwitchScreenAction<CenterOffsetChangeScreen>>>(); }
|
||||
if (!simplified) { constructMenuItem<makeComponent<MenuItem, TextWithValueHelper<TEXT_SMALLOFFSET, SmallOffsetAccessor>, espgui::SwitchScreenAction<SmallOffsetChangeScreen>>>(); }
|
||||
if (!simplified) { constructMenuItem<makeComponent<MenuItem, TextWithValueHelper<TEXT_BIGOFFSET, BigOffsetAccessor>, espgui::SwitchScreenAction<BigOffsetChangeScreen>>>(); }
|
||||
if (!simplified) { constructMenuItem<makeComponent<MenuItem, espgui::StaticText<TEXT_LEDSTRIP_BRIGHTNESS>, espgui::SwitchScreenAction<LedStripBrightnessChangeScreen>>>(); }
|
||||
if (!simplified) { constructMenuItem<makeComponent<MenuItem, LedStripMaxCurrentText, espgui::SwitchScreenAction<LedStripMaxAmpereChangeScreen>>>(); }
|
||||
constructMenuItem<makeComponent<MenuItem, espgui::StaticText<TEXT_BACK>, espgui::SwitchScreenAction<MainMenu>, StaticMenuItemIcon<&espgui::icons::back>>>();
|
||||
if (!simplified) { constructMenuItem<makeComponent<MenuItem, espgui::StaticText<TEXT_LEDSTRIP_CHANGE_OTA_ANIM>, espgui::PushScreenAction<LedstripOtaAnimationChangeMenu>>>(); }
|
||||
constructMenuItem<makeComponent<MenuItem, espgui::StaticText<TEXT_ANIMATION_MULTIPLIER>, espgui::PushScreenAction<AnimationMultiplierChangeScreen>>>();
|
||||
if (!simplified) { constructMenuItem<makeComponent<MenuItem, TextWithValueHelper<TEXT_LEDSCOUNT, LedsCountAccessor>, espgui::PushScreenAction<LedsCountChangeScreen>>>(); }
|
||||
if (!simplified) { constructMenuItem<makeComponent<MenuItem, TextWithValueHelper<TEXT_CENTEROFFSET, CenterOffsetAccessor>, espgui::PushScreenAction<CenterOffsetChangeScreen>>>(); }
|
||||
if (!simplified) { constructMenuItem<makeComponent<MenuItem, TextWithValueHelper<TEXT_SMALLOFFSET, SmallOffsetAccessor>, espgui::PushScreenAction<SmallOffsetChangeScreen>>>(); }
|
||||
if (!simplified) { constructMenuItem<makeComponent<MenuItem, TextWithValueHelper<TEXT_BIGOFFSET, BigOffsetAccessor>, espgui::PushScreenAction<BigOffsetChangeScreen>>>(); }
|
||||
if (!simplified) { constructMenuItem<makeComponent<MenuItem, espgui::StaticText<TEXT_LEDSTRIP_BRIGHTNESS>, espgui::PushScreenAction<LedStripBrightnessChangeScreen>>>(); }
|
||||
if (!simplified) { constructMenuItem<makeComponent<MenuItem, LedStripMaxCurrentText, espgui::PushScreenAction<LedStripMaxAmpereChangeScreen>>>(); }
|
||||
constructMenuItem<makeComponent<MenuItem, espgui::StaticText<TEXT_BACK>, espgui::PushScreenAction<MainMenu>, StaticMenuItemIcon<&espgui::icons::back>>>();
|
||||
}
|
||||
|
||||
std::string LedstripMenu::text() const
|
||||
@ -187,5 +189,5 @@ std::string LedstripMenu::text() const
|
||||
|
||||
void LedstripMenu::back()
|
||||
{
|
||||
espgui::switchScreen<MainMenu>();
|
||||
espgui::popScreen();
|
||||
}
|
||||
|
72
main/displays/menus/ledstripselectanimationmenu.cpp
Normal file
72
main/displays/menus/ledstripselectanimationmenu.cpp
Normal file
@ -0,0 +1,72 @@
|
||||
#include "ledstripselectanimationmenu.h"
|
||||
|
||||
// Local includes
|
||||
#include "actions/dummyaction.h"
|
||||
#include "actions/ledstripanimationactions.h"
|
||||
#include "actions/popscreenaction.h"
|
||||
#include "icons/back.h"
|
||||
#include "ledstripdefines.h"
|
||||
#include "ledstripmenu.h"
|
||||
#include "newsettings.h"
|
||||
|
||||
#ifdef FEATURE_LEDSTRIP
|
||||
namespace {
|
||||
constexpr char TEXT_SELECTANIMATION[] = "Select Animation";
|
||||
constexpr char TEXT_ANIMATION_DEFAULTRAINBOW[] = "Default Rainbow";
|
||||
constexpr char TEXT_ANIMATION_BETTERRAINBOW[] = "Better Rainbow";
|
||||
constexpr char TEXT_ANIMATION_SPEEDSYNCANIMATION[] = "Speed Sync";
|
||||
constexpr char TEXT_ANIMATION_CUSTOMCOLOR[] = "Custom Color";
|
||||
constexpr char TEXT_BACK[] = "Back";
|
||||
|
||||
class CurrentSelectedAnimationText : public virtual espgui::TextInterface
|
||||
{
|
||||
public:
|
||||
std::string text() const override;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
LedstripSelectAnimationMenu::LedstripSelectAnimationMenu()
|
||||
{
|
||||
using namespace espgui;
|
||||
|
||||
constructMenuItem<makeComponent<MenuItem, CurrentSelectedAnimationText, DisabledColor, DummyAction>>();
|
||||
constructMenuItem<makeComponent<MenuItem, EmptyText, DummyAction>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_ANIMATION_DEFAULTRAINBOW>, LedStripSetAnimationAction<LedstripAnimation::DefaultRainbow>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_ANIMATION_BETTERRAINBOW>, LedStripSetAnimationAction<LedstripAnimation::BetterRainbow>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_ANIMATION_SPEEDSYNCANIMATION>, LedStripSetAnimationAction<LedstripAnimation::SpeedSync>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_ANIMATION_CUSTOMCOLOR>, LedStripSetAnimationAction<LedstripAnimation::CustomColor>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BACK>, PopScreenAction, StaticMenuItemIcon<&espgui::icons::back>>>();
|
||||
}
|
||||
|
||||
std::string LedstripSelectAnimationMenu::text() const
|
||||
{
|
||||
return TEXT_SELECTANIMATION;
|
||||
}
|
||||
|
||||
void LedstripSelectAnimationMenu::back()
|
||||
{
|
||||
espgui::popScreen();
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
std::string CurrentSelectedAnimationText::text() const
|
||||
{
|
||||
switch (configs.ledstrip.animationType.value)
|
||||
{
|
||||
case LedstripAnimation::DefaultRainbow:
|
||||
return TEXT_ANIMATION_DEFAULTRAINBOW;
|
||||
case LedstripAnimation::BetterRainbow:
|
||||
return TEXT_ANIMATION_BETTERRAINBOW;
|
||||
case LedstripAnimation::SpeedSync:
|
||||
return TEXT_ANIMATION_SPEEDSYNCANIMATION;
|
||||
case LedstripAnimation::CustomColor:
|
||||
return TEXT_ANIMATION_CUSTOMCOLOR;
|
||||
default:
|
||||
return "Animation Unkown";
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
#endif
|
@ -2,13 +2,12 @@
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include "actions/dummyaction.h"
|
||||
#include "actions/switchscreenaction.h"
|
||||
#include "actions/popscreenaction.h"
|
||||
#include "icons/back.h"
|
||||
|
||||
// local includes
|
||||
#include "accessors/settingsaccessors.h"
|
||||
#include "actions/ledstripblinkactions.h"
|
||||
#include "displays/menus/ledstripmenu.h"
|
||||
#include "ledstrip.h"
|
||||
#include "ledstripdefines.h"
|
||||
#include "bobbycheckbox.h"
|
||||
@ -42,7 +41,7 @@ LedstripSelectBlinkMenu::LedstripSelectBlinkMenu()
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_ANIMATION_BLINKBOTH>, LedstripAnimationBlinkBothAction>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_LEDSTRIP_EN_BLINK_ANIM>, BobbyCheckbox, LedstripEnableBlinkAnimationAccessor>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_LEDSTRIP_VISUALIZE_BLINK>, BobbyCheckbox, LedstripEnableVisualizeBlinkAnimationAccessor>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BACK>, SwitchScreenAction<LedstripMenu>, StaticMenuItemIcon<&espgui::icons::back>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BACK>, PopScreenAction, StaticMenuItemIcon<&espgui::icons::back>>>();
|
||||
}
|
||||
|
||||
std::string LedstripSelectBlinkMenu::text() const
|
||||
@ -52,7 +51,7 @@ std::string LedstripSelectBlinkMenu::text() const
|
||||
|
||||
void LedstripSelectBlinkMenu::back()
|
||||
{
|
||||
espgui::switchScreen<LedstripMenu>();
|
||||
espgui::popScreen();
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
@ -1,14 +1,14 @@
|
||||
#include "ledstripselectotamode.h"
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include "actions/switchscreenaction.h"
|
||||
#include "actions/pushscreenaction.h"
|
||||
#include "actions/popscreenaction.h"
|
||||
#include "icons/back.h"
|
||||
|
||||
// local includes
|
||||
#include "ledstrip.h"
|
||||
#include "newsettings.h"
|
||||
#include "utils.h"
|
||||
#include "ledstripmenu.h"
|
||||
|
||||
namespace {
|
||||
constexpr char TEXT_BLINKANIMATION[] = "Blink animation";
|
||||
@ -34,7 +34,7 @@ LedstripOtaAnimationChangeMenu::LedstripOtaAnimationChangeMenu()
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_OTAANIM_NONE>, LedstripChangeOtaAnimModeAction<OtaAnimationModes::None>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_OTAANIM_PROGRESS>, LedstripChangeOtaAnimModeAction<OtaAnimationModes::GreenProgressBar>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_OTAANIM_COLOR>, LedstripChangeOtaAnimModeAction<OtaAnimationModes::ColorChangeAll>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BACK>, SwitchScreenAction<LedstripMenu>, StaticMenuItemIcon<&espgui::icons::back>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BACK>, PopScreenAction, StaticMenuItemIcon<&espgui::icons::back>>>();
|
||||
}
|
||||
|
||||
std::string LedstripOtaAnimationChangeMenu::text() const
|
||||
@ -44,5 +44,5 @@ std::string LedstripOtaAnimationChangeMenu::text() const
|
||||
|
||||
void LedstripOtaAnimationChangeMenu::back()
|
||||
{
|
||||
espgui::switchScreen<LedstripMenu>();
|
||||
espgui::popScreen();
|
||||
}
|
||||
|
@ -1,11 +1,12 @@
|
||||
#include "mainmenu.h"
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include "actions/switchscreenaction.h"
|
||||
#include "icons/back.h"
|
||||
#include <actions/pushscreenaction.h>
|
||||
#include <actions/popscreenaction.h>
|
||||
#include <icons/back.h>
|
||||
#include <tftinstance.h>
|
||||
|
||||
// local includes
|
||||
#include "displays/statusdisplay.h"
|
||||
#include "displays/menus/selectmodemenu.h"
|
||||
#include "displays/menus/selectmodemenu.h"
|
||||
#include "displays/menus/ledstripmenu.h"
|
||||
@ -45,7 +46,7 @@
|
||||
#include "icons/statistics.h"
|
||||
#include "icons/greenpass.h"
|
||||
#include "icons/time.h"
|
||||
#include "tftinstance.h"
|
||||
#include "displays/statusdisplay.h"
|
||||
|
||||
namespace {
|
||||
constexpr char TAG[] = "BOBBY";
|
||||
@ -84,40 +85,40 @@ MainMenu::MainMenu()
|
||||
using namespace espgui;
|
||||
|
||||
// constructMenuItem<makeComponent<MenuItem, mainmenu::CurrentTimeText, DummyAction, StaticMenuItemIcon<&bobbyicons::time>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_STATUS>, SwitchScreenAction<StatusDisplay>, StaticMenuItemIcon<&espgui::icons::back>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_STATUS>, PushScreenAction<StatusDisplay>, StaticMenuItemIcon<&espgui::icons::back>>>();
|
||||
if (configs.feature.ledstrip.isEnabled.value)
|
||||
{
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_LEDSTRIP>, SwitchScreenAction<LedstripMenu>, StaticMenuItemIcon<&bobbyicons::neopixel>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_LEDSTRIP>, PushScreenAction<LedstripMenu>, StaticMenuItemIcon<&bobbyicons::neopixel>>>();
|
||||
}
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_STATISTICSMENU>, SwitchScreenAction<StatisticsMenu>, StaticMenuItemIcon<&bobbyicons::statistics>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_SELECTMODE>, SwitchScreenAction<SelectModeMenu>, StaticMenuItemIcon<&bobbyicons::modes>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_STATISTICSMENU>, PushScreenAction<StatisticsMenu>, StaticMenuItemIcon<&bobbyicons::statistics>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_SELECTMODE>, PushScreenAction<SelectModeMenu>, StaticMenuItemIcon<&bobbyicons::modes>>>();
|
||||
if (SHOWITEM) { constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_MODESETTINGS>, ModeSettingsAction>>(); }
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BATTERY>, SwitchScreenAction<BatteryMenu>, StaticMenuItemIcon<&bobbyicons::battery>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_SETTINGS>, SwitchScreenAction<SettingsMenu>, StaticMenuItemIcon<&bobbyicons::settings>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_GREENPASS>, SwitchScreenAction<GreenPassMenu>, StaticMenuItemIcon<&bobbyicons::greenpass>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_LOCKVEHICLE>, SwitchScreenAction<Lockscreen>, StaticMenuItemIcon<&bobbyicons::lock>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BATTERY>, PushScreenAction<BatteryMenu>, StaticMenuItemIcon<&bobbyicons::battery>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_SETTINGS>, PushScreenAction<SettingsMenu>, StaticMenuItemIcon<&bobbyicons::settings>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_GREENPASS>, PushScreenAction<GreenPassMenu>, StaticMenuItemIcon<&bobbyicons::greenpass>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_LOCKVEHICLE>, PushScreenAction<Lockscreen>, StaticMenuItemIcon<&bobbyicons::lock>>>();
|
||||
if (configs.feature.garage.isEnabled.value && configs.feature.esp_now.isEnabled.value)
|
||||
{
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_GARAGE>, SwitchScreenAction<GarageMenu>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_GARAGE>, PushScreenAction<GarageMenu>>>();
|
||||
}
|
||||
if (configs.feature.ota.isEnabled.value)
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_UPDATE>, SwitchScreenAction<OtaMenu>, StaticMenuItemIcon<&bobbyicons::update>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_GRAPHS>, SwitchScreenAction<GraphsMenu>, StaticMenuItemIcon<&bobbyicons::graph>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_UPDATE>, PushScreenAction<OtaMenu>, StaticMenuItemIcon<&bobbyicons::update>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_GRAPHS>, PushScreenAction<GraphsMenu>, StaticMenuItemIcon<&bobbyicons::graph>>>();
|
||||
#if defined(FEATURE_CAN) && defined(FEATURE_POWERSUPPLY)
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_POWERSUPPLY>, SwitchScreenAction<PowerSupplyDisplay>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_POWERSUPPLY>, PushScreenAction<PowerSupplyDisplay>>>();
|
||||
#endif
|
||||
#ifdef FEATURE_MOSFETS
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_MOSFETS>, SwitchScreenAction<MosfetsMenu>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_MOSFETS>, PushScreenAction<MosfetsMenu>>>();
|
||||
#endif
|
||||
#if defined(FEATURE_BLUETOOTH) && defined(FEATURE_BMS)
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BMS>, SwitchScreenAction<BmsMenu>, StaticMenuItemIcon<&bobbyicons::bms>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BMS>, PushScreenAction<BmsMenu>, StaticMenuItemIcon<&bobbyicons::bms>>>();
|
||||
#endif
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_DEMOS>, SwitchScreenAction<DemosMenu>, StaticMenuItemIcon<&bobbyicons::demos>>>();
|
||||
if (SHOWITEM) { constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_PROFILES>, SwitchScreenAction<ProfilesMenu>, StaticMenuItemIcon<&bobbyicons::presets>>>(); }
|
||||
if (SHOWITEM) { constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_MANAGEPROFILESMENU>,SwitchScreenAction<ManageProfilesMenu>, StaticMenuItemIcon<&bobbyicons::presets>>>(); }
|
||||
if (SHOWITEM) { constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_DEBUG>, SwitchScreenAction<DebugMenu>>>(); }
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_POWEROFF>, SwitchScreenAction<PoweroffDisplay>, StaticMenuItemIcon<&bobbyicons::poweroff>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_CONFISCATIONMODE>, SwitchScreenAction<ConfiscationDisplay>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_DEMOS>, PushScreenAction<DemosMenu>, StaticMenuItemIcon<&bobbyicons::demos>>>();
|
||||
if (SHOWITEM) { constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_PROFILES>, PushScreenAction<ProfilesMenu>, StaticMenuItemIcon<&bobbyicons::presets>>>(); }
|
||||
if (SHOWITEM) { constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_MANAGEPROFILESMENU>,PushScreenAction<ManageProfilesMenu>, StaticMenuItemIcon<&bobbyicons::presets>>>(); }
|
||||
if (SHOWITEM) { constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_DEBUG>, PushScreenAction<DebugMenu>>>(); }
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_POWEROFF>, PushScreenAction<PoweroffDisplay>, StaticMenuItemIcon<&bobbyicons::poweroff>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_CONFISCATIONMODE>, PushScreenAction<ConfiscationDisplay>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_REBOOT>, RebootAction, StaticMenuItemIcon<&bobbyicons::reboot>>>();
|
||||
//#ifdef MAINMENU_PLUGIN
|
||||
// GMEN1
|
||||
@ -131,5 +132,5 @@ std::string MainMenu::text() const
|
||||
|
||||
void MainMenu::back()
|
||||
{
|
||||
espgui::switchScreen<StatusDisplay>();
|
||||
espgui::popScreen();
|
||||
}
|
||||
|
@ -3,14 +3,14 @@
|
||||
// 3rdparty lib includes
|
||||
#include "changevaluedisplay.h"
|
||||
#include "menuitem.h"
|
||||
#include "actions/switchscreenaction.h"
|
||||
#include "actions/pushscreenaction.h"
|
||||
#include "actions/popscreenaction.h"
|
||||
#include "icons/back.h"
|
||||
|
||||
// local includes
|
||||
#include "displays/bobbychangevaluedisplay.h"
|
||||
#include "utils.h"
|
||||
#include "accessors/settingsaccessors.h"
|
||||
#include "displays/menus/modessettingsmenu.h"
|
||||
|
||||
namespace {
|
||||
constexpr char TEXT_MOTORTESTMODESETTINGS[] = "Motortest mode seetings";
|
||||
@ -22,16 +22,16 @@ using MotortestMultiplikatorChangeDisplay = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<uint8_t>,
|
||||
espgui::StaticText<TEXT_MOTORTESTMULTIPLIKATOR>,
|
||||
MotortestModeMultiplikatorAccessor,
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<MotortestModeSettingsMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<MotortestModeSettingsMenu>>
|
||||
espgui::ConfirmActionInterface<espgui::PopScreenAction>,
|
||||
espgui::BackActionInterface<espgui::PopScreenAction>
|
||||
>;
|
||||
|
||||
using MotortestMaxPwmChangeDisplay = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<uint16_t>,
|
||||
espgui::StaticText<TEXT_MOTORTESTMAXPWM>,
|
||||
MotortestMaxPwmAccessor,
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<MotortestModeSettingsMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<MotortestModeSettingsMenu>>
|
||||
espgui::ConfirmActionInterface<espgui::PopScreenAction>,
|
||||
espgui::BackActionInterface<espgui::PopScreenAction>
|
||||
>;
|
||||
} // namespace
|
||||
|
||||
@ -39,9 +39,9 @@ using namespace espgui;
|
||||
|
||||
MotortestModeSettingsMenu::MotortestModeSettingsMenu()
|
||||
{
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_MOTORTESTMULTIPLIKATOR>, SwitchScreenAction<MotortestMultiplikatorChangeDisplay>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_MOTORTESTMAXPWM>, SwitchScreenAction<MotortestMaxPwmChangeDisplay>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BACK>, SwitchScreenAction<ModesSettingsMenu>, StaticMenuItemIcon<&espgui::icons::back>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_MOTORTESTMULTIPLIKATOR>, PushScreenAction<MotortestMultiplikatorChangeDisplay>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_MOTORTESTMAXPWM>, PushScreenAction<MotortestMaxPwmChangeDisplay>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BACK>, PopScreenAction, StaticMenuItemIcon<&espgui::icons::back>>>();
|
||||
}
|
||||
|
||||
std::string MotortestModeSettingsMenu::text() const
|
||||
@ -51,5 +51,5 @@ std::string MotortestModeSettingsMenu::text() const
|
||||
|
||||
void MotortestModeSettingsMenu::back()
|
||||
{
|
||||
switchScreen<ModesSettingsMenu>();
|
||||
popScreen();
|
||||
}
|
||||
|
@ -2,9 +2,10 @@
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include <actions/multiaction.h>
|
||||
#include <actions/switchscreenaction.h>
|
||||
#include <actions/popscreenaction.h>
|
||||
#include <icons/back.h>
|
||||
#include <textwithvaluehelper.h>
|
||||
#include <actions/pushscreenaction.h>
|
||||
|
||||
// local includes
|
||||
#include "utils.h"
|
||||
@ -20,7 +21,7 @@
|
||||
#include "modes/wheelchairmode.h"
|
||||
#endif
|
||||
#include "accessors/globalaccessors.h"
|
||||
#include "displays/menus/mainmenu.h"
|
||||
#include "mainmenu.h"
|
||||
|
||||
namespace {
|
||||
constexpr char TEXT_SELECTMODE[] = "Select mode";
|
||||
@ -60,19 +61,19 @@ using namespace espgui;
|
||||
|
||||
SelectModeMenu::SelectModeMenu()
|
||||
{
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_DEFAULT>, MultiAction<SetDefaultModeAction, SwitchScreenAction<MainMenu>>>>();
|
||||
if (!simplified) { constructMenuItem<makeComponent<MenuItem, TextWithValueHelper<TEXT_TEMPOMAT, AvgSpeedAccessor>, MultiAction<SetTempomatModeAction, SwitchScreenAction<MainMenu>>>>(); }
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_LARSM>, MultiAction<SetLarsmModeAction, SwitchScreenAction<MainMenu>>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_MICK>, MultiAction<SetMickModeAction, SwitchScreenAction<MainMenu>>>>();
|
||||
if (!simplified) { constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_REMOTECONTROL>, MultiAction<SetRemoteControlModeAction, SwitchScreenAction<MainMenu>>>>(); }
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_DEFAULT>, MultiAction<SetDefaultModeAction, PushScreenAction<MainMenu>>>>();
|
||||
if (!simplified) { constructMenuItem<makeComponent<MenuItem, TextWithValueHelper<TEXT_TEMPOMAT, AvgSpeedAccessor>, MultiAction<SetTempomatModeAction, PushScreenAction<MainMenu>>>>(); }
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_LARSM>, MultiAction<SetLarsmModeAction, PushScreenAction<MainMenu>>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_MICK>, MultiAction<SetMickModeAction, PushScreenAction<MainMenu>>>>();
|
||||
if (!simplified) { constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_REMOTECONTROL>, MultiAction<SetRemoteControlModeAction, PushScreenAction<MainMenu>>>>(); }
|
||||
#ifdef FEATURE_GAMETRAK
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_GAMETRAK>, MultiAction<SetGametrakModeAction, SwitchScreenAction<MainMenu>>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_GAMETRAK>, MultiAction<SetGametrakModeAction, PopScreenAction>>>();
|
||||
#endif
|
||||
if (!simplified) { constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_MOTORTEST>, MultiAction<SetMotorTestModeAction, SwitchScreenAction<MainMenu>>>>(); }
|
||||
if (!simplified) { constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_MOTORTEST>, MultiAction<SetMotorTestModeAction, PushScreenAction<MainMenu>>>>(); }
|
||||
#ifdef FEATURE_JOYSTICK
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_WHEELCHAIR>, MultiAction<SetWheelchairModeAction, SwitchScreenAction<MainMenu>>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_WHEELCHAIR>, MultiAction<SetWheelchairModeAction, PushScreenAction<MainMenu>>>>();
|
||||
#endif
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BACK>, SwitchScreenAction<MainMenu>, StaticMenuItemIcon<&espgui::icons::back>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BACK>, PushScreenAction<MainMenu>, StaticMenuItemIcon<&espgui::icons::back>>>();
|
||||
}
|
||||
|
||||
std::string SelectModeMenu::text() const
|
||||
@ -113,5 +114,5 @@ void SelectModeMenu::start()
|
||||
|
||||
void SelectModeMenu::back()
|
||||
{
|
||||
switchScreen<MainMenu>();
|
||||
popScreen();
|
||||
}
|
||||
|
@ -3,13 +3,12 @@
|
||||
// 3rdparty lib includes
|
||||
#include <menuitem.h>
|
||||
#include "actions/dummyaction.h"
|
||||
#include "actions/switchscreenaction.h"
|
||||
#include "actions/popscreenaction.h"
|
||||
#include "actioninterface.h"
|
||||
#include "fmt/core.h"
|
||||
#include "icons/back.h"
|
||||
|
||||
// local includes
|
||||
#include "mainmenu.h"
|
||||
#include "utils.h"
|
||||
#include "icons/time.h"
|
||||
#include "icons/reboot.h"
|
||||
@ -187,7 +186,7 @@ StatisticsMenu::StatisticsMenu()
|
||||
constructMenuItem<makeComponent<MenuItem, EmptyText, DummyAction>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_STATSSAVE>, SaveKilometersAction, StaticMenuItemIcon<&bobbyicons::update>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_STATSCLEAR>, ClearCurrentStatsAction, StaticMenuItemIcon<&bobbyicons::reboot>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BACK>, SwitchScreenAction<MainMenu>, StaticMenuItemIcon<&espgui::icons::back>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BACK>, PopScreenAction, StaticMenuItemIcon<&espgui::icons::back>>>();
|
||||
}
|
||||
|
||||
std::string StatisticsMenu::text() const
|
||||
@ -197,5 +196,5 @@ std::string StatisticsMenu::text() const
|
||||
|
||||
void StatisticsMenu::back()
|
||||
{
|
||||
espgui::switchScreen<MainMenu>();
|
||||
espgui::popScreen();
|
||||
}
|
||||
|
@ -3,7 +3,8 @@
|
||||
// 3rdparty lib includes
|
||||
#include <changevaluedisplay.h>
|
||||
#include <menuitem.h>
|
||||
#include <actions/switchscreenaction.h>
|
||||
#include <actions/pushscreenaction.h>
|
||||
#include <actions/popscreenaction.h>
|
||||
#include <icons/back.h>
|
||||
#include <textwithvaluehelper.h>
|
||||
|
||||
@ -14,7 +15,6 @@
|
||||
#include "accessors/settingsaccessors.h"
|
||||
#include "accessors/globalaccessors.h"
|
||||
#include "actions/tempomatmodeapplycurrentpeedaction.h"
|
||||
#include "displays/menus/modessettingsmenu.h"
|
||||
|
||||
namespace {
|
||||
constexpr char TEXT_TEMPOMATMODESETTINGS[] = "Tempomat mode settings";
|
||||
@ -27,16 +27,16 @@ using TempomatModeCruiseMotTgtChangeDisplay = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<int16_t>,
|
||||
espgui::StaticText<TEXT_NCRUISEMOTTGT>,
|
||||
TempomatModeCruiseMotTgtAccessor,
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<TempomatModeSettingsMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<TempomatModeSettingsMenu>>
|
||||
espgui::ConfirmActionInterface<espgui::PopScreenAction>,
|
||||
espgui::BackActionInterface<espgui::PopScreenAction>
|
||||
>;
|
||||
|
||||
using TempomatModeModelModeChangeScreen = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<UnifiedModelMode>,
|
||||
espgui::StaticText<TEXT_MODELMODE>,
|
||||
TempomatModeModelModeAccessor,
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<TempomatModeSettingsMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<TempomatModeSettingsMenu>>
|
||||
espgui::ConfirmActionInterface<espgui::PopScreenAction>,
|
||||
espgui::BackActionInterface<espgui::PopScreenAction>
|
||||
>;
|
||||
} // namespace
|
||||
|
||||
@ -45,9 +45,9 @@ using namespace espgui;
|
||||
TempomatModeSettingsMenu::TempomatModeSettingsMenu()
|
||||
{
|
||||
constructMenuItem<makeComponent<MenuItem, TextWithValueHelper<TEXT_APPLY, AvgSpeedAccessor>, TempomatModeApplyCurrentSpeedAction>>();
|
||||
constructMenuItem<makeComponent<MenuItem, TextWithValueHelper<TEXT_NCRUISEMOTTGT, TempomatModeCruiseMotTgtAccessor>, SwitchScreenAction<TempomatModeModelModeChangeScreen>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_MODELMODE>, SwitchScreenAction<TempomatModeModelModeChangeScreen>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BACK>, SwitchScreenAction<ModesSettingsMenu>, StaticMenuItemIcon<&espgui::icons::back>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, TextWithValueHelper<TEXT_NCRUISEMOTTGT, TempomatModeCruiseMotTgtAccessor>, PushScreenAction<TempomatModeModelModeChangeScreen>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_MODELMODE>, PushScreenAction<TempomatModeModelModeChangeScreen>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BACK>, PopScreenAction, StaticMenuItemIcon<&espgui::icons::back>>>();
|
||||
}
|
||||
|
||||
std::string TempomatModeSettingsMenu::text() const
|
||||
@ -57,5 +57,5 @@ std::string TempomatModeSettingsMenu::text() const
|
||||
|
||||
void TempomatModeSettingsMenu::back()
|
||||
{
|
||||
switchScreen<ModesSettingsMenu>();
|
||||
popScreen();
|
||||
}
|
||||
|
@ -4,11 +4,12 @@
|
||||
#include <configwrapper.h>
|
||||
#include <fmt/core.h>
|
||||
#include <icons/back.h>
|
||||
#include <actions/dummyaction.h>
|
||||
#include <actions/switchscreenaction.h>
|
||||
#include <actions/popscreenaction.h>
|
||||
|
||||
// local includes
|
||||
#include "globals.h"
|
||||
#include "actions/dummyaction.h"
|
||||
#include "actions/switchscreenaction.h"
|
||||
#include "displays/bobbymenudisplay.h"
|
||||
#include "bobbyerrorhandler.h"
|
||||
|
||||
@ -57,7 +58,7 @@ private:
|
||||
ConfigWrapper<TEnum>* m_config;
|
||||
};
|
||||
|
||||
template<typename TEnum, typename TMenu>
|
||||
template<typename TEnum>
|
||||
class TypeSafeChangeMenu :
|
||||
public BobbyMenuDisplay
|
||||
{
|
||||
@ -71,7 +72,7 @@ public:
|
||||
iterateEnum<TEnum>::iterate([&](TEnum enum_value, const auto &string_value){
|
||||
constructMenuItem<TypesafeEnumSetterMenuItem<TEnum>>(enum_value, m_config);
|
||||
});
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BACK>, SwitchScreenAction<TMenu>, StaticMenuItemIcon<&espgui::icons::back>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BACK>, PopScreenAction, StaticMenuItemIcon<&espgui::icons::back>>>();
|
||||
}
|
||||
|
||||
std::string text() const override
|
||||
@ -81,7 +82,7 @@ public:
|
||||
|
||||
void back() override
|
||||
{
|
||||
espgui::switchScreen<TMenu>();
|
||||
espgui::popScreen();
|
||||
}
|
||||
private:
|
||||
ConfigWrapper<TEnum>* m_config;
|
||||
@ -102,7 +103,47 @@ public:
|
||||
|
||||
void triggered() override
|
||||
{
|
||||
espgui::switchScreen<typesafeenumchangemenu::TypeSafeChangeMenu<TEnum, TMenu>>(m_config);
|
||||
espgui::switchScreen<typesafeenumchangemenu::TypeSafeChangeMenu<TEnum>>(m_config);
|
||||
}
|
||||
private:
|
||||
ConfigWrapper<TEnum>* m_config;
|
||||
};
|
||||
|
||||
template<typename TEnum, const char *Ttext>
|
||||
class PopScreenTypeSafeChangeMenuItem : public espgui::MenuItem
|
||||
{
|
||||
public:
|
||||
PopScreenTypeSafeChangeMenuItem(ConfigWrapper<TEnum>* config) : m_config{config} {}
|
||||
|
||||
static constexpr const char *STATIC_TEXT = Ttext;
|
||||
std::string text() const override
|
||||
{
|
||||
return Ttext;
|
||||
}
|
||||
|
||||
void triggered() override
|
||||
{
|
||||
espgui::popScreen();
|
||||
}
|
||||
private:
|
||||
ConfigWrapper<TEnum>* m_config;
|
||||
};
|
||||
|
||||
template<typename TEnum, const char *Ttext>
|
||||
class PushScreenTypeSafeChangeMenuItem : public espgui::MenuItem
|
||||
{
|
||||
public:
|
||||
PushScreenTypeSafeChangeMenuItem(ConfigWrapper<TEnum>* config) : m_config{config} {}
|
||||
|
||||
static constexpr const char *STATIC_TEXT = Ttext;
|
||||
std::string text() const override
|
||||
{
|
||||
return Ttext;
|
||||
}
|
||||
|
||||
void triggered() override
|
||||
{
|
||||
espgui::pushScreen<typesafeenumchangemenu::TypeSafeChangeMenu<TEnum>>(m_config);
|
||||
}
|
||||
private:
|
||||
ConfigWrapper<TEnum>* m_config;
|
||||
|
@ -57,14 +57,9 @@ void MetersDisplay::buttonPressed(espgui::Button button)
|
||||
|
||||
switch (button)
|
||||
{
|
||||
using espgui::Button;
|
||||
case Button::Left:
|
||||
case Button::Right:
|
||||
switchScreen<MainMenu>();
|
||||
break;
|
||||
case Button::Up:
|
||||
switchScreen<StatusDisplay>();
|
||||
break;
|
||||
using espgui::Button;
|
||||
case Button::Right: pushScreen<MainMenu>(); break;
|
||||
case Button::Up: switchScreen<StatusDisplay>(); break;
|
||||
case Button::Down:
|
||||
#ifdef FEATURE_BMS
|
||||
switchScreen<BmsDisplay>();
|
||||
@ -72,5 +67,6 @@ void MetersDisplay::buttonPressed(espgui::Button button)
|
||||
switchScreen<StatusDisplay>();
|
||||
#endif
|
||||
break;
|
||||
default:;
|
||||
}
|
||||
}
|
||||
|
@ -230,9 +230,7 @@ void StatusDisplay::buttonPressed(espgui::Button button)
|
||||
switch (button)
|
||||
{
|
||||
using espgui::Button;
|
||||
case Button::Right:
|
||||
switchScreen<MainMenu>();
|
||||
break;
|
||||
case Button::Right: pushScreen<MainMenu>(); break;
|
||||
case Button::Up:
|
||||
if (simplified)
|
||||
return;
|
||||
|
@ -35,7 +35,7 @@ using namespace std::chrono_literals;
|
||||
namespace {
|
||||
espchrono::millis_clock::time_point lastStatsPush;
|
||||
std::optional<espchrono::millis_clock::time_point> lastStatsUpdate;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
extern "C" void app_main()
|
||||
{
|
||||
|
Reference in New Issue
Block a user