@@ -23,8 +23,6 @@ public:
|
|||||||
virtual int shownValue() const = 0;
|
virtual int shownValue() const = 0;
|
||||||
virtual void setShownValue(int value) = 0;
|
virtual void setShownValue(int value) = 0;
|
||||||
|
|
||||||
virtual void confirm() = 0;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Label m_titleLabel{5, 5}; // 230, 25
|
Label m_titleLabel{5, 5}; // 230, 25
|
||||||
Label m_valueLabel{26, 81}; // 188, 53
|
Label m_valueLabel{26, 81}; // 188, 53
|
||||||
@@ -55,13 +53,11 @@ public:
|
|||||||
void redraw() override;
|
void redraw() override;
|
||||||
|
|
||||||
void rotate(int offset) override;
|
void rotate(int offset) override;
|
||||||
void button() override;
|
void confirm() override;
|
||||||
|
|
||||||
int shownValue() const { return m_value; }
|
int shownValue() const { return m_value; }
|
||||||
void setShownValue(int value) { m_value = value; }
|
void setShownValue(int value) { m_value = value; }
|
||||||
|
|
||||||
void confirm() override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Tvalue m_value{};
|
Tvalue m_value{};
|
||||||
|
|
||||||
@@ -132,12 +128,6 @@ void ChangeValueDisplay<Tvalue>::rotate(int offset)
|
|||||||
m_rotateOffset += offset;
|
m_rotateOffset += offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Tvalue>
|
|
||||||
void ChangeValueDisplay<Tvalue>::button()
|
|
||||||
{
|
|
||||||
m_pressed = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename Tvalue>
|
template<typename Tvalue>
|
||||||
void ChangeValueDisplay<Tvalue>::confirm()
|
void ChangeValueDisplay<Tvalue>::confirm()
|
||||||
{
|
{
|
||||||
|
@@ -7,10 +7,10 @@ namespace {
|
|||||||
class DemoDisplay : public Display, public virtual ActionInterface
|
class DemoDisplay : public Display, public virtual ActionInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void button() override;
|
void confirm() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
void DemoDisplay::button()
|
void DemoDisplay::confirm()
|
||||||
{
|
{
|
||||||
triggered();
|
triggered();
|
||||||
}
|
}
|
||||||
|
@@ -9,7 +9,35 @@ class ChangeValueDisplayInterface;
|
|||||||
}
|
}
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
class Display {
|
class ConfirmInterface {
|
||||||
|
public:
|
||||||
|
virtual void confirm() {}
|
||||||
|
};
|
||||||
|
|
||||||
|
class BackInterface {
|
||||||
|
public:
|
||||||
|
virtual void back() {}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
class ConfirmActionInterface : public virtual ConfirmInterface
|
||||||
|
{
|
||||||
|
T m_action;
|
||||||
|
|
||||||
|
public:
|
||||||
|
void confirm() override { m_action.triggered(); }
|
||||||
|
};
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
class BackActionInterface : public virtual BackInterface
|
||||||
|
{
|
||||||
|
T m_action;
|
||||||
|
|
||||||
|
public:
|
||||||
|
void back() override { m_action.triggered(); }
|
||||||
|
};
|
||||||
|
|
||||||
|
class Display : public virtual ConfirmInterface, public virtual BackInterface {
|
||||||
public:
|
public:
|
||||||
virtual ~Display() = default;
|
virtual ~Display() = default;
|
||||||
|
|
||||||
@@ -20,7 +48,6 @@ public:
|
|||||||
virtual void stop() {}
|
virtual void stop() {}
|
||||||
|
|
||||||
virtual void rotate(int offset) {}
|
virtual void rotate(int offset) {}
|
||||||
virtual void button() {}
|
|
||||||
|
|
||||||
virtual TextInterface *asTextInterface() { return nullptr; }
|
virtual TextInterface *asTextInterface() { return nullptr; }
|
||||||
virtual const TextInterface *asTextInterface() const { return nullptr; }
|
virtual const TextInterface *asTextInterface() const { return nullptr; }
|
||||||
|
@@ -31,6 +31,8 @@ public:
|
|||||||
void redraw() override;
|
void redraw() override;
|
||||||
void stop() override;
|
void stop() override;
|
||||||
|
|
||||||
|
void back() override;
|
||||||
|
|
||||||
void triggered() override;
|
void triggered() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -97,6 +99,12 @@ void CalibrateDisplay::stop()
|
|||||||
currentMode = m_oldMode;
|
currentMode = m_oldMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CalibrateDisplay::back()
|
||||||
|
{
|
||||||
|
if (!m_bootup)
|
||||||
|
switchScreen<BoardcomputerHardwareSettingsMenu>();
|
||||||
|
}
|
||||||
|
|
||||||
void CalibrateDisplay::triggered()
|
void CalibrateDisplay::triggered()
|
||||||
{
|
{
|
||||||
if (m_bootup)
|
if (m_bootup)
|
||||||
|
@@ -13,7 +13,7 @@ class GraphsMenu;
|
|||||||
}
|
}
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
class DualGraphDisplay : public DemoDisplay, public SwitchScreenAction<GraphsMenu>
|
class DualGraphDisplay : public DemoDisplay, public SwitchScreenAction<GraphsMenu>, public BackActionInterface<SwitchScreenAction<GraphsMenu>>
|
||||||
{
|
{
|
||||||
using Base = DemoDisplay;
|
using Base = DemoDisplay;
|
||||||
|
|
||||||
|
@@ -14,7 +14,7 @@ class DemosMenu;
|
|||||||
}
|
}
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
class GameOfLifeDisplay : public DemoDisplay, public SwitchScreenAction<DemosMenu>
|
class GameOfLifeDisplay : public DemoDisplay, public SwitchScreenAction<DemosMenu>, public BackActionInterface<SwitchScreenAction<DemosMenu>>
|
||||||
{
|
{
|
||||||
using Base = DemoDisplay;
|
using Base = DemoDisplay;
|
||||||
|
|
||||||
|
@@ -30,7 +30,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
template<size_t COUNT>
|
template<size_t COUNT>
|
||||||
class GraphDisplay : public DemoDisplay, public SwitchScreenAction<GraphsMenu>, public virtual TextInterface, public virtual MultiStatisticsInterface<COUNT>
|
class GraphDisplay : public DemoDisplay, public SwitchScreenAction<GraphsMenu>, public virtual TextInterface, public BackActionInterface<SwitchScreenAction<GraphsMenu>>, public virtual MultiStatisticsInterface<COUNT>
|
||||||
{
|
{
|
||||||
using Base = DemoDisplay;
|
using Base = DemoDisplay;
|
||||||
|
|
||||||
|
@@ -29,7 +29,7 @@ public:
|
|||||||
void redraw() override;
|
void redraw() override;
|
||||||
void stop() override;
|
void stop() override;
|
||||||
|
|
||||||
void button() override;
|
void confirm() override;
|
||||||
void rotate(int offset) override;
|
void rotate(int offset) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -146,7 +146,7 @@ void Lockscreen::stop()
|
|||||||
currentMode = m_oldMode;
|
currentMode = m_oldMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Lockscreen::button()
|
void Lockscreen::confirm()
|
||||||
{
|
{
|
||||||
m_pressed = true;
|
m_pressed = true;
|
||||||
}
|
}
|
||||||
|
@@ -20,6 +20,7 @@ constexpr char TEXT_ESPINFO[] = "ESP info:";
|
|||||||
class AboutMenu :
|
class AboutMenu :
|
||||||
public MenuDisplay,
|
public MenuDisplay,
|
||||||
public StaticText<TEXT_ABOUT>,
|
public StaticText<TEXT_ABOUT>,
|
||||||
|
public BackActionInterface<SwitchScreenAction<SettingsMenu>>,
|
||||||
public StaticMenuDefinition<
|
public StaticMenuDefinition<
|
||||||
makeComponent<MenuItem, StaticText<TEXT_VERSION>, DummyAction>,
|
makeComponent<MenuItem, StaticText<TEXT_VERSION>, DummyAction>,
|
||||||
makeComponent<MenuItem, StaticText<nullptr>, DummyAction>,
|
makeComponent<MenuItem, StaticText<nullptr>, DummyAction>,
|
||||||
|
@@ -50,6 +50,7 @@ public:
|
|||||||
class AccessPointWifiSettingsMenu :
|
class AccessPointWifiSettingsMenu :
|
||||||
public MenuDisplay,
|
public MenuDisplay,
|
||||||
public StaticText<TEXT_ACCESSPOINTWIFISETTINGS>,
|
public StaticText<TEXT_ACCESSPOINTWIFISETTINGS>,
|
||||||
|
public BackActionInterface<SwitchScreenAction<WifiSettingsMenu>>,
|
||||||
public StaticMenuDefinition<
|
public StaticMenuDefinition<
|
||||||
makeComponent<MenuItem, WifiSoftApGetStationNumText, StaticFont<2>, DisabledColor, DummyAction>,
|
makeComponent<MenuItem, WifiSoftApGetStationNumText, StaticFont<2>, DisabledColor, DummyAction>,
|
||||||
makeComponent<MenuItem, WifiSoftApIpText, StaticFont<2>, DisabledColor, DummyAction>,
|
makeComponent<MenuItem, WifiSoftApIpText, StaticFont<2>, DisabledColor, DummyAction>,
|
||||||
|
@@ -22,6 +22,7 @@ namespace {
|
|||||||
class BluetoothSettingsMenu :
|
class BluetoothSettingsMenu :
|
||||||
public MenuDisplay,
|
public MenuDisplay,
|
||||||
public StaticText<TEXT_BLUETOOTHSETTINGS>,
|
public StaticText<TEXT_BLUETOOTHSETTINGS>,
|
||||||
|
public BackActionInterface<SwitchScreenAction<SettingsMenu>>,
|
||||||
public StaticMenuDefinition<
|
public StaticMenuDefinition<
|
||||||
makeComponent<MenuItem, BluetoothAvailableText, DisabledColor, DummyAction>,
|
makeComponent<MenuItem, BluetoothAvailableText, DisabledColor, DummyAction>,
|
||||||
makeComponent<MenuItem, BluetoothHasClientText, DisabledColor, DummyAction>,
|
makeComponent<MenuItem, BluetoothHasClientText, DisabledColor, DummyAction>,
|
||||||
|
@@ -24,6 +24,7 @@ namespace {
|
|||||||
class BmsMenu :
|
class BmsMenu :
|
||||||
public MenuDisplay,
|
public MenuDisplay,
|
||||||
public StaticText<TEXT_BMS>,
|
public StaticText<TEXT_BMS>,
|
||||||
|
public BackActionInterface<SwitchScreenAction<MainMenu>>,
|
||||||
public StaticMenuDefinition<
|
public StaticMenuDefinition<
|
||||||
makeComponent<MenuItem, StaticText<TEXT_CONNECTBMS>, BluetoothConnectBmsAction>,
|
makeComponent<MenuItem, StaticText<TEXT_CONNECTBMS>, BluetoothConnectBmsAction>,
|
||||||
makeComponent<MenuItem, StaticText<TEXT_DISCONNECTBMS>, BluetoothDisconnectAction>,
|
makeComponent<MenuItem, StaticText<TEXT_DISCONNECTBMS>, BluetoothDisconnectAction>,
|
||||||
|
@@ -28,15 +28,46 @@ public:
|
|||||||
String text() const override { return String{"brems: "} + raw_brems + ": " + brems; }
|
String text() const override { return String{"brems: "} + raw_brems + ": " + brems; }
|
||||||
};
|
};
|
||||||
|
|
||||||
using SampleCountChangeScreen = makeComponent<ChangeValueDisplay<int16_t>, StaticText<TEXT_SETSAMPLECOUNT>, SampleCountAccessor, SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>;
|
using SampleCountChangeScreen = makeComponent<
|
||||||
using GasMinChangeScreen = makeComponent<ChangeValueDisplay<int16_t>, StaticText<TEXT_SETGASMIN>, GasMinAccessor, SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>;
|
ChangeValueDisplay<int16_t>,
|
||||||
using GasMaxChangeScreen = makeComponent<ChangeValueDisplay<int16_t>, StaticText<TEXT_SETGASMAX>, GasMaxAccessor, SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>;
|
StaticText<TEXT_SETSAMPLECOUNT>,
|
||||||
using BremsMinChangeScreen = makeComponent<ChangeValueDisplay<int16_t>, StaticText<TEXT_SETBREMSMIN>, BremsMinAccessor, SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>;
|
SampleCountAccessor,
|
||||||
using BremsMaxChangeScreen = makeComponent<ChangeValueDisplay<int16_t>, StaticText<TEXT_SETBREMSMAX>, BremsMaxAccessor, SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>;
|
BackActionInterface<SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>,
|
||||||
|
SwitchScreenAction<BoardcomputerHardwareSettingsMenu>
|
||||||
|
>;
|
||||||
|
using GasMinChangeScreen = makeComponent<
|
||||||
|
ChangeValueDisplay<int16_t>,
|
||||||
|
StaticText<TEXT_SETGASMIN>,
|
||||||
|
GasMinAccessor,
|
||||||
|
BackActionInterface<SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>,
|
||||||
|
SwitchScreenAction<BoardcomputerHardwareSettingsMenu>
|
||||||
|
>;
|
||||||
|
using GasMaxChangeScreen = makeComponent<
|
||||||
|
ChangeValueDisplay<int16_t>,
|
||||||
|
StaticText<TEXT_SETGASMAX>,
|
||||||
|
GasMaxAccessor,
|
||||||
|
BackActionInterface<SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>,
|
||||||
|
SwitchScreenAction<BoardcomputerHardwareSettingsMenu>
|
||||||
|
>;
|
||||||
|
using BremsMinChangeScreen = makeComponent<
|
||||||
|
ChangeValueDisplay<int16_t>,
|
||||||
|
StaticText<TEXT_SETBREMSMIN>,
|
||||||
|
BremsMinAccessor,
|
||||||
|
BackActionInterface<SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>,
|
||||||
|
SwitchScreenAction<BoardcomputerHardwareSettingsMenu>
|
||||||
|
>;
|
||||||
|
using BremsMaxChangeScreen = makeComponent<
|
||||||
|
ChangeValueDisplay<int16_t>,
|
||||||
|
StaticText<TEXT_SETBREMSMAX>,
|
||||||
|
BremsMaxAccessor,
|
||||||
|
BackActionInterface<SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>,
|
||||||
|
SwitchScreenAction<BoardcomputerHardwareSettingsMenu>
|
||||||
|
>;
|
||||||
|
|
||||||
class BoardcomputerHardwareSettingsMenu :
|
class BoardcomputerHardwareSettingsMenu :
|
||||||
public MenuDisplay,
|
public MenuDisplay,
|
||||||
public StaticText<TEXT_BOARDCOMPUTERHARDWARESETTINGS>,
|
public StaticText<TEXT_BOARDCOMPUTERHARDWARESETTINGS>,
|
||||||
|
public BackActionInterface<SwitchScreenAction<SettingsMenu>>,
|
||||||
public StaticMenuDefinition<
|
public StaticMenuDefinition<
|
||||||
makeComponent<MenuItem, GasText, DisabledColor, StaticFont<2>, DummyAction>,
|
makeComponent<MenuItem, GasText, DisabledColor, StaticFont<2>, DummyAction>,
|
||||||
makeComponent<MenuItem, BremsText, DisabledColor, StaticFont<2>, DummyAction>,
|
makeComponent<MenuItem, BremsText, DisabledColor, StaticFont<2>, DummyAction>,
|
||||||
|
@@ -20,25 +20,74 @@ class SettingsMenu;
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
struct FrontFreqAccessor : public RefAccessor<uint8_t> { uint8_t &getRef() const override { return front.command.buzzer.freq; } };
|
struct FrontFreqAccessor : public RefAccessor<uint8_t> { uint8_t &getRef() const override { return front.command.buzzer.freq; } };
|
||||||
using FrontFreqChangeScreen = makeComponent<ChangeValueDisplay<uint8_t>, StaticText<TEXT_FRONTFREQ>, FrontFreqAccessor, SwitchScreenAction<BuzzerMenu>>;
|
using FrontFreqChangeScreen = makeComponent<
|
||||||
|
ChangeValueDisplay<uint8_t>,
|
||||||
|
StaticText<TEXT_FRONTFREQ>,
|
||||||
|
FrontFreqAccessor,
|
||||||
|
BackActionInterface<SwitchScreenAction<BuzzerMenu>>,
|
||||||
|
SwitchScreenAction<BuzzerMenu>
|
||||||
|
>;
|
||||||
|
|
||||||
struct FrontPatternAccessor : public RefAccessor<uint8_t> { uint8_t &getRef() const override { return front.command.buzzer.pattern; } };
|
struct FrontPatternAccessor : public RefAccessor<uint8_t> { uint8_t &getRef() const override { return front.command.buzzer.pattern; } };
|
||||||
using FrontPatternChangeScreen = makeComponent<ChangeValueDisplay<uint8_t>, StaticText<TEXT_FRONTPATTERN>, FrontPatternAccessor, SwitchScreenAction<BuzzerMenu>>;
|
using FrontPatternChangeScreen = makeComponent<
|
||||||
|
ChangeValueDisplay<uint8_t>,
|
||||||
|
StaticText<TEXT_FRONTPATTERN>,
|
||||||
|
FrontPatternAccessor,
|
||||||
|
BackActionInterface<SwitchScreenAction<BuzzerMenu>>,
|
||||||
|
SwitchScreenAction<BuzzerMenu>
|
||||||
|
>;
|
||||||
|
|
||||||
struct BackFreqAccessor : public RefAccessor<uint8_t> { uint8_t &getRef() const override { return back.command.buzzer.freq; } };
|
struct BackFreqAccessor : public RefAccessor<uint8_t> { uint8_t &getRef() const override { return back.command.buzzer.freq; } };
|
||||||
using BackFreqChangeScreen = makeComponent<ChangeValueDisplay<uint8_t>, StaticText<TEXT_BACKFREQ>, BackFreqAccessor, SwitchScreenAction<BuzzerMenu>>;
|
using BackFreqChangeScreen = makeComponent<
|
||||||
|
ChangeValueDisplay<uint8_t>,
|
||||||
|
StaticText<TEXT_BACKFREQ>,
|
||||||
|
BackFreqAccessor,
|
||||||
|
BackActionInterface<SwitchScreenAction<BuzzerMenu>>,
|
||||||
|
SwitchScreenAction<BuzzerMenu>
|
||||||
|
>;
|
||||||
|
|
||||||
struct BackPatternAccessor : public RefAccessor<uint8_t> { uint8_t &getRef() const override { return back.command.buzzer.pattern; } };
|
struct BackPatternAccessor : public RefAccessor<uint8_t> { uint8_t &getRef() const override { return back.command.buzzer.pattern; } };
|
||||||
using BackPatternChangeScreen = makeComponent<ChangeValueDisplay<uint8_t>, StaticText<TEXT_BACKPATTERN>, BackPatternAccessor, SwitchScreenAction<BuzzerMenu>>;
|
using BackPatternChangeScreen = makeComponent<
|
||||||
|
ChangeValueDisplay<uint8_t>,
|
||||||
|
StaticText<TEXT_BACKPATTERN>,
|
||||||
|
BackPatternAccessor,
|
||||||
|
BackActionInterface<SwitchScreenAction<BuzzerMenu>>,
|
||||||
|
SwitchScreenAction<BuzzerMenu>
|
||||||
|
>;
|
||||||
|
|
||||||
using ReverseBeepFreq0ChangeScreen = makeComponent<ChangeValueDisplay<uint8_t>, StaticText<TEXT_REVERSEBEEPFREQ0>, ReverseBeepFreq0Accessor, SwitchScreenAction<BuzzerMenu>>;
|
using ReverseBeepFreq0ChangeScreen = makeComponent<
|
||||||
using ReverseBeepFreq1ChangeScreen = makeComponent<ChangeValueDisplay<uint8_t>, StaticText<TEXT_REVERSEBEEPFREQ1>, ReverseBeepFreq1Accessor, SwitchScreenAction<BuzzerMenu>>;
|
ChangeValueDisplay<uint8_t>,
|
||||||
using ReverseBeepDuration0ChangeScreen = makeComponent<ChangeValueDisplay<int16_t>, StaticText<TEXT_REVERSEBEEPDURATION0>, ReverseBeepDuration0Accessor, SwitchScreenAction<BuzzerMenu>>;
|
StaticText<TEXT_REVERSEBEEPFREQ0>,
|
||||||
using ReverseBeepDuration1ChangeScreen = makeComponent<ChangeValueDisplay<int16_t>, StaticText<TEXT_REVERSEBEEPDURATION1>, ReverseBeepDuration1Accessor, SwitchScreenAction<BuzzerMenu>>;
|
ReverseBeepFreq0Accessor,
|
||||||
|
BackActionInterface<SwitchScreenAction<BuzzerMenu>>,
|
||||||
|
SwitchScreenAction<BuzzerMenu>
|
||||||
|
>;
|
||||||
|
using ReverseBeepFreq1ChangeScreen = makeComponent<
|
||||||
|
ChangeValueDisplay<uint8_t>,
|
||||||
|
StaticText<TEXT_REVERSEBEEPFREQ1>,
|
||||||
|
ReverseBeepFreq1Accessor,
|
||||||
|
BackActionInterface<SwitchScreenAction<BuzzerMenu>>,
|
||||||
|
SwitchScreenAction<BuzzerMenu>
|
||||||
|
>;
|
||||||
|
using ReverseBeepDuration0ChangeScreen = makeComponent<
|
||||||
|
ChangeValueDisplay<int16_t>,
|
||||||
|
StaticText<TEXT_REVERSEBEEPDURATION0>,
|
||||||
|
ReverseBeepDuration0Accessor,
|
||||||
|
BackActionInterface<SwitchScreenAction<BuzzerMenu>>,
|
||||||
|
SwitchScreenAction<BuzzerMenu>
|
||||||
|
>;
|
||||||
|
using ReverseBeepDuration1ChangeScreen = makeComponent<
|
||||||
|
ChangeValueDisplay<int16_t>,
|
||||||
|
StaticText<TEXT_REVERSEBEEPDURATION1>,
|
||||||
|
ReverseBeepDuration1Accessor,
|
||||||
|
BackActionInterface<SwitchScreenAction<BuzzerMenu>>,
|
||||||
|
SwitchScreenAction<BuzzerMenu>
|
||||||
|
>;
|
||||||
|
|
||||||
class BuzzerMenu :
|
class BuzzerMenu :
|
||||||
public MenuDisplay,
|
public MenuDisplay,
|
||||||
public StaticText<TEXT_BUZZER>,
|
public StaticText<TEXT_BUZZER>,
|
||||||
|
public BackActionInterface<SwitchScreenAction<SettingsMenu>>,
|
||||||
public StaticMenuDefinition<
|
public StaticMenuDefinition<
|
||||||
makeComponent<MenuItem, StaticText<TEXT_FRONTFREQ>, SwitchScreenAction<FrontFreqChangeScreen>>,
|
makeComponent<MenuItem, StaticText<TEXT_FRONTFREQ>, SwitchScreenAction<FrontFreqChangeScreen>>,
|
||||||
makeComponent<MenuItem, StaticText<TEXT_FRONTPATTERN>, SwitchScreenAction<FrontPatternChangeScreen>>,
|
makeComponent<MenuItem, StaticText<TEXT_FRONTPATTERN>, SwitchScreenAction<FrontPatternChangeScreen>>,
|
||||||
|
@@ -19,6 +19,7 @@ template<const char *Ttext, typename Ttexts>
|
|||||||
class CommandDebugMenu :
|
class CommandDebugMenu :
|
||||||
public MenuDisplay,
|
public MenuDisplay,
|
||||||
public StaticText<Ttext>,
|
public StaticText<Ttext>,
|
||||||
|
public BackActionInterface<SwitchScreenAction<DebugMenu>>,
|
||||||
public StaticMenuDefinition<
|
public StaticMenuDefinition<
|
||||||
makeComponent<MenuItem, typename Ttexts::BuzzerFreqText, DisabledColor, DummyAction>,
|
makeComponent<MenuItem, typename Ttexts::BuzzerFreqText, DisabledColor, DummyAction>,
|
||||||
makeComponent<MenuItem, typename Ttexts::BuzzerPatternText, DisabledColor, DummyAction>,
|
makeComponent<MenuItem, typename Ttexts::BuzzerPatternText, DisabledColor, DummyAction>,
|
||||||
|
@@ -23,13 +23,33 @@ class SettingsMenu;
|
|||||||
}
|
}
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
using WheelDiameterMmChangeScreen = makeComponent<ChangeValueDisplay<int16_t>, StaticText<TEXT_WHEELDIAMETERMM>, WheelDiameterMmAccessor, SwitchScreenAction<ControllerHardwareSettingsMenu>>;
|
using WheelDiameterMmChangeScreen = makeComponent<
|
||||||
using WheelDiameterInchChangeScreen = makeComponent<ChangeValueDisplay<float>, StaticText<TEXT_WHEELDIAMETERINCH>, WheelDiameterInchAccessor, RatioNumberStep<float, std::ratio<1,10>>, SwitchScreenAction<ControllerHardwareSettingsMenu>>;
|
ChangeValueDisplay<int16_t>,
|
||||||
using NumMagnetPolesChangeScreen = makeComponent<ChangeValueDisplay<int16_t>, StaticText<TEXT_NUMMAGNETPOLES>, NumMagnetPolesAccessor, SwitchScreenAction<ControllerHardwareSettingsMenu>>;
|
StaticText<TEXT_WHEELDIAMETERMM>,
|
||||||
|
WheelDiameterMmAccessor,
|
||||||
|
BackActionInterface<SwitchScreenAction<ControllerHardwareSettingsMenu>>,
|
||||||
|
SwitchScreenAction<ControllerHardwareSettingsMenu>
|
||||||
|
>;
|
||||||
|
using WheelDiameterInchChangeScreen = makeComponent<
|
||||||
|
ChangeValueDisplay<float>,
|
||||||
|
StaticText<TEXT_WHEELDIAMETERINCH>,
|
||||||
|
WheelDiameterInchAccessor,
|
||||||
|
RatioNumberStep<float, std::ratio<1,10>>,
|
||||||
|
BackActionInterface<SwitchScreenAction<ControllerHardwareSettingsMenu>>,
|
||||||
|
SwitchScreenAction<ControllerHardwareSettingsMenu>
|
||||||
|
>;
|
||||||
|
using NumMagnetPolesChangeScreen = makeComponent<
|
||||||
|
ChangeValueDisplay<int16_t>,
|
||||||
|
StaticText<TEXT_NUMMAGNETPOLES>,
|
||||||
|
NumMagnetPolesAccessor,
|
||||||
|
BackActionInterface<SwitchScreenAction<ControllerHardwareSettingsMenu>>,
|
||||||
|
SwitchScreenAction<ControllerHardwareSettingsMenu>
|
||||||
|
>;
|
||||||
|
|
||||||
class ControllerHardwareSettingsMenu :
|
class ControllerHardwareSettingsMenu :
|
||||||
public MenuDisplay,
|
public MenuDisplay,
|
||||||
public StaticText<TEXT_CONTROLLERHARDWARESETTINGS>,
|
public StaticText<TEXT_CONTROLLERHARDWARESETTINGS>,
|
||||||
|
public BackActionInterface<SwitchScreenAction<SettingsMenu>>,
|
||||||
public StaticMenuDefinition<
|
public StaticMenuDefinition<
|
||||||
makeComponent<MenuItem, StaticText<TEXT_SETENABLED>, SwitchScreenAction<EnableMenu>>,
|
makeComponent<MenuItem, StaticText<TEXT_SETENABLED>, SwitchScreenAction<EnableMenu>>,
|
||||||
makeComponent<MenuItem, StaticText<TEXT_SETINVERTED>, SwitchScreenAction<InvertMenu>>,
|
makeComponent<MenuItem, StaticText<TEXT_SETINVERTED>, SwitchScreenAction<InvertMenu>>,
|
||||||
|
@@ -36,6 +36,7 @@ namespace {
|
|||||||
class DebugMenu :
|
class DebugMenu :
|
||||||
public MenuDisplay,
|
public MenuDisplay,
|
||||||
public StaticText<TEXT_DEBUG>,
|
public StaticText<TEXT_DEBUG>,
|
||||||
|
public BackActionInterface<SwitchScreenAction<MainMenu>>,
|
||||||
public StaticMenuDefinition<
|
public StaticMenuDefinition<
|
||||||
makeComponent<MenuItem, StaticText<TEXT_LOADSETTINGS>, LoadSettingsAction>,
|
makeComponent<MenuItem, StaticText<TEXT_LOADSETTINGS>, LoadSettingsAction>,
|
||||||
makeComponent<MenuItem, StaticText<TEXT_SAVESETTINGS>, SaveSettingsAction>,
|
makeComponent<MenuItem, StaticText<TEXT_SAVESETTINGS>, SaveSettingsAction>,
|
||||||
|
@@ -18,20 +18,81 @@ class ModesSettingsMenu;
|
|||||||
}
|
}
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
using DefaultModeCtrlTypChangeDisplay = makeComponent<ChangeValueDisplay<ControlType>, StaticText<TEXT_SETCONTROLTYPE>, DefaultModeCtrlTypAccessor, SwitchScreenAction<DefaultModeSettingsMenu>>;
|
using DefaultModeCtrlTypChangeDisplay = makeComponent<
|
||||||
using DefaultModeCtrlModChangeDisplay = makeComponent<ChangeValueDisplay<ControlMode>, StaticText<TEXT_SETCONTROLMODE>, DefaultModeCtrlModAccessor, SwitchScreenAction<DefaultModeSettingsMenu>>;
|
ChangeValueDisplay<ControlType>,
|
||||||
using DefaultModeSmoothingChangeDisplay = makeComponent<ChangeValueDisplay<int16_t>, StaticText<TEXT_SETSMOOTHING>, DefaultModeSmoothingAccessor, SwitchScreenAction<DefaultModeSettingsMenu>>;
|
StaticText<TEXT_SETCONTROLTYPE>,
|
||||||
using DefaultModeFrontPercentageChangeDisplay = makeComponent<ChangeValueDisplay<int16_t>, StaticText<TEXT_SETFRONTPERCENTAGE>, DefaultModeFrontPercentageAccessor, SwitchScreenAction<DefaultModeSettingsMenu>>;
|
DefaultModeCtrlTypAccessor,
|
||||||
using DefaultModeBackPercentageChangeDisplay = makeComponent<ChangeValueDisplay<int16_t>, StaticText<TEXT_SETBACKPERCENTAGE>, DefaultModeBackPercentageAccessor, SwitchScreenAction<DefaultModeSettingsMenu>>;
|
BackActionInterface<SwitchScreenAction<DefaultModeSettingsMenu>>,
|
||||||
using DefaultModeAddSchwelleChangeDisplay = makeComponent<ChangeValueDisplay<int16_t>, StaticText<TEXT_SETADDSCHWELLE>, DefaultModeAddSchwelleAccessor, SwitchScreenAction<DefaultModeSettingsMenu>>;
|
SwitchScreenAction<DefaultModeSettingsMenu>
|
||||||
using DefaultModeGas1WertChangeDisplay = makeComponent<ChangeValueDisplay<int16_t>, StaticText<TEXT_SETGAS1WERT>, DefaultModeGas1WertAccessor, SwitchScreenAction<DefaultModeSettingsMenu>>;
|
>;
|
||||||
using DefaultModeGas2WertChangeDisplay = makeComponent<ChangeValueDisplay<int16_t>, StaticText<TEXT_SETGAS2WERT>, DefaultModeGas2WertAccessor, SwitchScreenAction<DefaultModeSettingsMenu>>;
|
using DefaultModeCtrlModChangeDisplay = makeComponent<
|
||||||
using DefaultModeBrems1WertChangeDisplay = makeComponent<ChangeValueDisplay<int16_t>, StaticText<TEXT_SETBREMS1WERT>, DefaultModeBrems1WertAccessor, SwitchScreenAction<DefaultModeSettingsMenu>>;
|
ChangeValueDisplay<ControlMode>,
|
||||||
using DefaultModeBrems2WertChangeDisplay = makeComponent<ChangeValueDisplay<int16_t>, StaticText<TEXT_SETBREMS2WERT>, DefaultModeBrems2WertAccessor, SwitchScreenAction<DefaultModeSettingsMenu>>;
|
StaticText<TEXT_SETCONTROLMODE>,
|
||||||
|
DefaultModeCtrlModAccessor,
|
||||||
|
BackActionInterface<SwitchScreenAction<DefaultModeSettingsMenu>>,
|
||||||
|
SwitchScreenAction<DefaultModeSettingsMenu>
|
||||||
|
>;
|
||||||
|
using DefaultModeSmoothingChangeDisplay = makeComponent<
|
||||||
|
ChangeValueDisplay<int16_t>,
|
||||||
|
StaticText<TEXT_SETSMOOTHING>,
|
||||||
|
DefaultModeSmoothingAccessor,
|
||||||
|
BackActionInterface<SwitchScreenAction<DefaultModeSettingsMenu>>,
|
||||||
|
SwitchScreenAction<DefaultModeSettingsMenu>
|
||||||
|
>;
|
||||||
|
using DefaultModeFrontPercentageChangeDisplay = makeComponent<
|
||||||
|
ChangeValueDisplay<int16_t>,
|
||||||
|
StaticText<TEXT_SETFRONTPERCENTAGE>,
|
||||||
|
DefaultModeFrontPercentageAccessor,
|
||||||
|
BackActionInterface<SwitchScreenAction<DefaultModeSettingsMenu>>,
|
||||||
|
SwitchScreenAction<DefaultModeSettingsMenu>
|
||||||
|
>;
|
||||||
|
using DefaultModeBackPercentageChangeDisplay = makeComponent<
|
||||||
|
ChangeValueDisplay<int16_t>,
|
||||||
|
StaticText<TEXT_SETBACKPERCENTAGE>,
|
||||||
|
DefaultModeBackPercentageAccessor,
|
||||||
|
BackActionInterface<SwitchScreenAction<DefaultModeSettingsMenu>>,
|
||||||
|
SwitchScreenAction<DefaultModeSettingsMenu>
|
||||||
|
>;
|
||||||
|
using DefaultModeAddSchwelleChangeDisplay = makeComponent<
|
||||||
|
ChangeValueDisplay<int16_t>,
|
||||||
|
StaticText<TEXT_SETADDSCHWELLE>,
|
||||||
|
DefaultModeAddSchwelleAccessor,
|
||||||
|
BackActionInterface<SwitchScreenAction<DefaultModeSettingsMenu>>,
|
||||||
|
SwitchScreenAction<DefaultModeSettingsMenu>
|
||||||
|
>;
|
||||||
|
using DefaultModeGas1WertChangeDisplay = makeComponent<
|
||||||
|
ChangeValueDisplay<int16_t>,
|
||||||
|
StaticText<TEXT_SETGAS1WERT>,
|
||||||
|
DefaultModeGas1WertAccessor,
|
||||||
|
BackActionInterface<SwitchScreenAction<DefaultModeSettingsMenu>>,
|
||||||
|
SwitchScreenAction<DefaultModeSettingsMenu>
|
||||||
|
>;
|
||||||
|
using DefaultModeGas2WertChangeDisplay = makeComponent<
|
||||||
|
ChangeValueDisplay<int16_t>,
|
||||||
|
StaticText<TEXT_SETGAS2WERT>,
|
||||||
|
DefaultModeGas2WertAccessor,
|
||||||
|
BackActionInterface<SwitchScreenAction<DefaultModeSettingsMenu>>,
|
||||||
|
SwitchScreenAction<DefaultModeSettingsMenu>
|
||||||
|
>;
|
||||||
|
using DefaultModeBrems1WertChangeDisplay = makeComponent<
|
||||||
|
ChangeValueDisplay<int16_t>,
|
||||||
|
StaticText<TEXT_SETBREMS1WERT>,
|
||||||
|
DefaultModeBrems1WertAccessor,
|
||||||
|
BackActionInterface<SwitchScreenAction<DefaultModeSettingsMenu>>,
|
||||||
|
SwitchScreenAction<DefaultModeSettingsMenu>
|
||||||
|
>;
|
||||||
|
using DefaultModeBrems2WertChangeDisplay = makeComponent<
|
||||||
|
ChangeValueDisplay<int16_t>,
|
||||||
|
StaticText<TEXT_SETBREMS2WERT>,
|
||||||
|
DefaultModeBrems2WertAccessor,
|
||||||
|
BackActionInterface<SwitchScreenAction<DefaultModeSettingsMenu>>,
|
||||||
|
SwitchScreenAction<DefaultModeSettingsMenu>
|
||||||
|
>;
|
||||||
|
|
||||||
class DefaultModeSettingsMenu :
|
class DefaultModeSettingsMenu :
|
||||||
public MenuDisplay,
|
public MenuDisplay,
|
||||||
public StaticText<TEXT_DEFAULTMODESETTIGNS>,
|
public StaticText<TEXT_DEFAULTMODESETTIGNS>,
|
||||||
|
public BackActionInterface<SwitchScreenAction<ModesSettingsMenu>>,
|
||||||
public StaticMenuDefinition<
|
public StaticMenuDefinition<
|
||||||
makeComponent<MenuItem, StaticText<TEXT_SETCONTROLTYPE>, SwitchScreenAction<DefaultModeCtrlTypChangeDisplay>>,
|
makeComponent<MenuItem, StaticText<TEXT_SETCONTROLTYPE>, SwitchScreenAction<DefaultModeCtrlTypChangeDisplay>>,
|
||||||
makeComponent<MenuItem, StaticText<TEXT_SETCONTROLMODE>, SwitchScreenAction<DefaultModeCtrlModChangeDisplay>>,
|
makeComponent<MenuItem, StaticText<TEXT_SETCONTROLMODE>, SwitchScreenAction<DefaultModeCtrlModChangeDisplay>>,
|
||||||
|
@@ -20,6 +20,7 @@ namespace {
|
|||||||
class DemosMenu :
|
class DemosMenu :
|
||||||
public MenuDisplay,
|
public MenuDisplay,
|
||||||
public StaticText<TEXT_DEMOS>,
|
public StaticText<TEXT_DEMOS>,
|
||||||
|
public BackActionInterface<SwitchScreenAction<MainMenu>>,
|
||||||
public StaticMenuDefinition<
|
public StaticMenuDefinition<
|
||||||
makeComponent<MenuItem, StaticText<TEXT_STARFIELD>, SwitchScreenAction<StarfieldDisplay>>,
|
makeComponent<MenuItem, StaticText<TEXT_STARFIELD>, SwitchScreenAction<StarfieldDisplay>>,
|
||||||
makeComponent<MenuItem, StaticText<TEXT_PINGPONG>, SwitchScreenAction<PingPongDisplay>>,
|
makeComponent<MenuItem, StaticText<TEXT_PINGPONG>, SwitchScreenAction<PingPongDisplay>>,
|
||||||
|
@@ -121,6 +121,7 @@ constexpr char TEXT_DEBUGTOGGLE[] = "Toggle";
|
|||||||
class DynamicDebugMenu :
|
class DynamicDebugMenu :
|
||||||
public MenuDisplay,
|
public MenuDisplay,
|
||||||
public RandomText,
|
public RandomText,
|
||||||
|
public BackActionInterface<SwitchScreenAction<DebugMenu>>,
|
||||||
public StaticMenuDefinition<
|
public StaticMenuDefinition<
|
||||||
// dummy items to allow for scrolling
|
// dummy items to allow for scrolling
|
||||||
makeComponent<MenuItem, StaticText<TEXT_DUMMYITEM>, DummyAction>,
|
makeComponent<MenuItem, StaticText<TEXT_DUMMYITEM>, DummyAction>,
|
||||||
|
@@ -19,6 +19,7 @@ namespace {
|
|||||||
class EnableMenu :
|
class EnableMenu :
|
||||||
public MenuDisplay,
|
public MenuDisplay,
|
||||||
public StaticText<TEXT_SETENABLED>,
|
public StaticText<TEXT_SETENABLED>,
|
||||||
|
public BackActionInterface<SwitchScreenAction<ControllerHardwareSettingsMenu>>,
|
||||||
public StaticMenuDefinition<
|
public StaticMenuDefinition<
|
||||||
makeComponent<MenuItem, StaticText<TEXT_ENABLEFRONTLEFT>, ToggleBoolAction, CheckboxIcon, FrontLeftEnabledAccessor>,
|
makeComponent<MenuItem, StaticText<TEXT_ENABLEFRONTLEFT>, ToggleBoolAction, CheckboxIcon, FrontLeftEnabledAccessor>,
|
||||||
makeComponent<MenuItem, StaticText<TEXT_ENABLEFRONTRIGHT>, ToggleBoolAction, CheckboxIcon, FrontRightEnabledAccessor>,
|
makeComponent<MenuItem, StaticText<TEXT_ENABLEFRONTRIGHT>, ToggleBoolAction, CheckboxIcon, FrontRightEnabledAccessor>,
|
||||||
|
@@ -20,6 +20,7 @@ template<const char *Ttext, typename Ttexts, template<int> class ColorInterface>
|
|||||||
class FeedbackDebugMenu :
|
class FeedbackDebugMenu :
|
||||||
public MenuDisplay,
|
public MenuDisplay,
|
||||||
public StaticText<Ttext>,
|
public StaticText<Ttext>,
|
||||||
|
public BackActionInterface<SwitchScreenAction<DebugMenu>>,
|
||||||
public StaticMenuDefinition<
|
public StaticMenuDefinition<
|
||||||
makeComponent<MenuItem, typename Ttexts::BatVoltageText, ColorInterface<TFT_DARKGREY>, DummyAction>,
|
makeComponent<MenuItem, typename Ttexts::BatVoltageText, ColorInterface<TFT_DARKGREY>, DummyAction>,
|
||||||
makeComponent<MenuItem, typename Ttexts::BatVoltageFixedText, ColorInterface<TFT_DARKGREY>, DummyAction>,
|
makeComponent<MenuItem, typename Ttexts::BatVoltageFixedText, ColorInterface<TFT_DARKGREY>, DummyAction>,
|
||||||
|
@@ -39,7 +39,13 @@ struct WifiModeAccessor : public virtual AccessorInterface<wifi_mode_t>
|
|||||||
// TODO: better error handling
|
// TODO: better error handling
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
using WifiModeChangeScreen = makeComponent<ChangeValueDisplay<wifi_mode_t>, StaticText<TEXT_WIFICHANGEMODE>, WifiModeAccessor, SwitchScreenAction<GenericWifiSettingsMenu>>;
|
using WifiModeChangeScreen = makeComponent<
|
||||||
|
ChangeValueDisplay<wifi_mode_t>,
|
||||||
|
StaticText<TEXT_WIFICHANGEMODE>,
|
||||||
|
WifiModeAccessor,
|
||||||
|
BackActionInterface<SwitchScreenAction<GenericWifiSettingsMenu>>,
|
||||||
|
SwitchScreenAction<GenericWifiSettingsMenu>
|
||||||
|
>;
|
||||||
|
|
||||||
struct WifiSleepAccessor : public virtual AccessorInterface<bool>
|
struct WifiSleepAccessor : public virtual AccessorInterface<bool>
|
||||||
{
|
{
|
||||||
@@ -62,11 +68,18 @@ struct WifiTxPowerAccessor : public virtual AccessorInterface<wifi_power_t>
|
|||||||
// TODO: better error handling
|
// TODO: better error handling
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
using WifiTxPowerChangeScreen = makeComponent<ChangeValueDisplay<wifi_power_t>, StaticText<TEXT_WIFICHANGETXPOWER>, WifiTxPowerAccessor, SwitchScreenAction<GenericWifiSettingsMenu>>;
|
using WifiTxPowerChangeScreen = makeComponent<
|
||||||
|
ChangeValueDisplay<wifi_power_t>,
|
||||||
|
StaticText<TEXT_WIFICHANGETXPOWER>,
|
||||||
|
WifiTxPowerAccessor,
|
||||||
|
BackActionInterface<SwitchScreenAction<GenericWifiSettingsMenu>>,
|
||||||
|
SwitchScreenAction<GenericWifiSettingsMenu>
|
||||||
|
>;
|
||||||
|
|
||||||
class GenericWifiSettingsMenu :
|
class GenericWifiSettingsMenu :
|
||||||
public MenuDisplay,
|
public MenuDisplay,
|
||||||
public StaticText<TEXT_GENERICWIFISETTINGS>,
|
public StaticText<TEXT_GENERICWIFISETTINGS>,
|
||||||
|
public BackActionInterface<SwitchScreenAction<WifiSettingsMenu>>,
|
||||||
public StaticMenuDefinition<
|
public StaticMenuDefinition<
|
||||||
makeComponent<MenuItem, WifiStatusBitsText, DisabledColor, DummyAction>,
|
makeComponent<MenuItem, WifiStatusBitsText, DisabledColor, DummyAction>,
|
||||||
makeComponent<MenuItem, WifiChannelText, DisabledColor, DummyAction>,
|
makeComponent<MenuItem, WifiChannelText, DisabledColor, DummyAction>,
|
||||||
|
@@ -48,6 +48,7 @@ using MotorCurrentsGraphDisplay = makeComponent<GraphDisplay<4>, StaticText<TEXT
|
|||||||
class GraphsMenu :
|
class GraphsMenu :
|
||||||
public MenuDisplay,
|
public MenuDisplay,
|
||||||
public StaticText<TEXT_GRAPHS>,
|
public StaticText<TEXT_GRAPHS>,
|
||||||
|
public BackActionInterface<SwitchScreenAction<MainMenu>>,
|
||||||
public StaticMenuDefinition<
|
public StaticMenuDefinition<
|
||||||
makeComponent<MenuItem, StaticText<TEXT_GAS>, SwitchScreenAction<GasGraphDisplay>>,
|
makeComponent<MenuItem, StaticText<TEXT_GAS>, SwitchScreenAction<GasGraphDisplay>>,
|
||||||
makeComponent<MenuItem, StaticText<TEXT_BREMS>, SwitchScreenAction<BremsGraphDisplay>>,
|
makeComponent<MenuItem, StaticText<TEXT_BREMS>, SwitchScreenAction<BremsGraphDisplay>>,
|
||||||
|
@@ -19,6 +19,7 @@ namespace {
|
|||||||
class InvertMenu :
|
class InvertMenu :
|
||||||
public MenuDisplay,
|
public MenuDisplay,
|
||||||
public StaticText<TEXT_SETINVERTED>,
|
public StaticText<TEXT_SETINVERTED>,
|
||||||
|
public BackActionInterface<SwitchScreenAction<ControllerHardwareSettingsMenu>>,
|
||||||
public StaticMenuDefinition<
|
public StaticMenuDefinition<
|
||||||
makeComponent<MenuItem, StaticText<TEXT_INVERTFRONTLEFT>, ToggleBoolAction, CheckboxIcon, FrontLeftInvertedAccessor>,
|
makeComponent<MenuItem, StaticText<TEXT_INVERTFRONTLEFT>, ToggleBoolAction, CheckboxIcon, FrontLeftInvertedAccessor>,
|
||||||
makeComponent<MenuItem, StaticText<TEXT_INVERTFRONTRIGHT>, ToggleBoolAction, CheckboxIcon, FrontRightInvertedAccessor>,
|
makeComponent<MenuItem, StaticText<TEXT_INVERTFRONTRIGHT>, ToggleBoolAction, CheckboxIcon, FrontRightInvertedAccessor>,
|
||||||
|
@@ -16,12 +16,25 @@ class ModesSettingsMenu;
|
|||||||
}
|
}
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
using LarsmModeModeChangeDisplay = makeComponent<ChangeValueDisplay<LarsmModeMode>, StaticText<TEXT_LARSMMODECHANGEMODE>, LarsmModeModeAccessor, SwitchScreenAction<LarsmModeSettingsMenu>>;
|
using LarsmModeModeChangeDisplay = makeComponent<
|
||||||
using LarsmModeIterationsChangeDisplay = makeComponent<ChangeValueDisplay<uint8_t>, StaticText<TEXT_LARSMMODECHANGEITERATIONS>, LarsmModeIterationsAccessor, SwitchScreenAction<LarsmModeSettingsMenu>>;
|
ChangeValueDisplay<LarsmModeMode>,
|
||||||
|
StaticText<TEXT_LARSMMODECHANGEMODE>,
|
||||||
|
LarsmModeModeAccessor,
|
||||||
|
BackActionInterface<SwitchScreenAction<LarsmModeSettingsMenu>>,
|
||||||
|
SwitchScreenAction<LarsmModeSettingsMenu>
|
||||||
|
>;
|
||||||
|
using LarsmModeIterationsChangeDisplay = makeComponent<
|
||||||
|
ChangeValueDisplay<uint8_t>,
|
||||||
|
StaticText<TEXT_LARSMMODECHANGEITERATIONS>,
|
||||||
|
LarsmModeIterationsAccessor,
|
||||||
|
BackActionInterface<SwitchScreenAction<LarsmModeSettingsMenu>>,
|
||||||
|
SwitchScreenAction<LarsmModeSettingsMenu>
|
||||||
|
>;
|
||||||
|
|
||||||
class LarsmModeSettingsMenu :
|
class LarsmModeSettingsMenu :
|
||||||
public MenuDisplay,
|
public MenuDisplay,
|
||||||
public StaticText<TEXT_LARSMMODESETTINGS>,
|
public StaticText<TEXT_LARSMMODESETTINGS>,
|
||||||
|
public BackActionInterface<SwitchScreenAction<ModesSettingsMenu>>,
|
||||||
public StaticMenuDefinition<
|
public StaticMenuDefinition<
|
||||||
makeComponent<MenuItem, StaticText<TEXT_LARSMMODECHANGEMODE>, SwitchScreenAction<LarsmModeModeChangeDisplay>>,
|
makeComponent<MenuItem, StaticText<TEXT_LARSMMODECHANGEMODE>, SwitchScreenAction<LarsmModeModeChangeDisplay>>,
|
||||||
makeComponent<MenuItem, StaticText<TEXT_LARSMMODECHANGEITERATIONS>, SwitchScreenAction<LarsmModeIterationsChangeDisplay>>,
|
makeComponent<MenuItem, StaticText<TEXT_LARSMMODECHANGEITERATIONS>, SwitchScreenAction<LarsmModeIterationsChangeDisplay>>,
|
||||||
|
@@ -16,16 +16,53 @@ class SettingsMenu;
|
|||||||
}
|
}
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
using IMotMaxChangeScreen = makeComponent<ChangeValueDisplay<int16_t>, StaticText<TEXT_SETIMOTMAX>, IMotMaxAccessor, SwitchScreenAction<LimitsSettingsMenu>>;
|
using IMotMaxChangeScreen = makeComponent<
|
||||||
using IDcMaxChangeScreen = makeComponent<ChangeValueDisplay<int16_t>, StaticText<TEXT_SETIDCMAX>, IDcMaxAccessor, SwitchScreenAction<LimitsSettingsMenu>>;
|
ChangeValueDisplay<int16_t>,
|
||||||
using NMotMaxKmhChangeScreen = makeComponent<ChangeValueDisplay<int16_t>, StaticText<TEXT_SETNMOTMAXKMH>, NMotMaxKmhAccessor, SwitchScreenAction<LimitsSettingsMenu>>;
|
StaticText<TEXT_SETIMOTMAX>,
|
||||||
using NMotMaxRpmChangeScreen = makeComponent<ChangeValueDisplay<int16_t>, StaticText<TEXT_SETNMOTMAX>, NMotMaxRpmAccessor, SwitchScreenAction<LimitsSettingsMenu>>;
|
IMotMaxAccessor,
|
||||||
using FieldWeakMaxChangeScreen = makeComponent<ChangeValueDisplay<int16_t>, StaticText<TEXT_SETFIELDWEAKMAX>, FieldWeakMaxAccessor, SwitchScreenAction<LimitsSettingsMenu>>;
|
BackActionInterface<SwitchScreenAction<LimitsSettingsMenu>>,
|
||||||
using PhaseAdvMaxChangeScreen = makeComponent<ChangeValueDisplay<int16_t>, StaticText<TEXT_SETPHASEADVMAX>, PhaseAdvMaxAccessor, SwitchScreenAction<LimitsSettingsMenu>>;
|
SwitchScreenAction<LimitsSettingsMenu>
|
||||||
|
>;
|
||||||
|
using IDcMaxChangeScreen = makeComponent<
|
||||||
|
ChangeValueDisplay<int16_t>,
|
||||||
|
StaticText<TEXT_SETIDCMAX>,
|
||||||
|
IDcMaxAccessor,
|
||||||
|
BackActionInterface<SwitchScreenAction<LimitsSettingsMenu>>,
|
||||||
|
SwitchScreenAction<LimitsSettingsMenu>
|
||||||
|
>;
|
||||||
|
using NMotMaxKmhChangeScreen = makeComponent<
|
||||||
|
ChangeValueDisplay<int16_t>,
|
||||||
|
StaticText<TEXT_SETNMOTMAXKMH>,
|
||||||
|
NMotMaxKmhAccessor,
|
||||||
|
BackActionInterface<SwitchScreenAction<LimitsSettingsMenu>>,
|
||||||
|
SwitchScreenAction<LimitsSettingsMenu>
|
||||||
|
>;
|
||||||
|
using NMotMaxRpmChangeScreen = makeComponent<
|
||||||
|
ChangeValueDisplay<int16_t>,
|
||||||
|
StaticText<TEXT_SETNMOTMAX>,
|
||||||
|
NMotMaxRpmAccessor,
|
||||||
|
BackActionInterface<SwitchScreenAction<LimitsSettingsMenu>>,
|
||||||
|
SwitchScreenAction<LimitsSettingsMenu>
|
||||||
|
>;
|
||||||
|
using FieldWeakMaxChangeScreen = makeComponent<
|
||||||
|
ChangeValueDisplay<int16_t>,
|
||||||
|
StaticText<TEXT_SETFIELDWEAKMAX>,
|
||||||
|
FieldWeakMaxAccessor,
|
||||||
|
BackActionInterface<SwitchScreenAction<LimitsSettingsMenu>>,
|
||||||
|
SwitchScreenAction<LimitsSettingsMenu>
|
||||||
|
>;
|
||||||
|
using PhaseAdvMaxChangeScreen = makeComponent<
|
||||||
|
ChangeValueDisplay<int16_t>,
|
||||||
|
StaticText<TEXT_SETPHASEADVMAX>,
|
||||||
|
PhaseAdvMaxAccessor,
|
||||||
|
BackActionInterface<SwitchScreenAction<LimitsSettingsMenu>>,
|
||||||
|
SwitchScreenAction<LimitsSettingsMenu>
|
||||||
|
>;
|
||||||
|
|
||||||
class LimitsSettingsMenu :
|
class LimitsSettingsMenu :
|
||||||
public MenuDisplay,
|
public MenuDisplay,
|
||||||
public StaticText<TEXT_LIMITSSETTINGS>,
|
public StaticText<TEXT_LIMITSSETTINGS>,
|
||||||
|
public BackActionInterface<SwitchScreenAction<SettingsMenu>>,
|
||||||
public StaticMenuDefinition<
|
public StaticMenuDefinition<
|
||||||
makeComponent<MenuItem, StaticText<TEXT_SETIMOTMAX>, SwitchScreenAction<IMotMaxChangeScreen>>,
|
makeComponent<MenuItem, StaticText<TEXT_SETIMOTMAX>, SwitchScreenAction<IMotMaxChangeScreen>>,
|
||||||
makeComponent<MenuItem, StaticText<TEXT_SETIDCMAX>, SwitchScreenAction<IDcMaxChangeScreen>>,
|
makeComponent<MenuItem, StaticText<TEXT_SETIDCMAX>, SwitchScreenAction<IDcMaxChangeScreen>>,
|
||||||
|
@@ -34,6 +34,7 @@ namespace {
|
|||||||
class MainMenu :
|
class MainMenu :
|
||||||
public MenuDisplay,
|
public MenuDisplay,
|
||||||
public StaticText<TEXT_MAINMENU>,
|
public StaticText<TEXT_MAINMENU>,
|
||||||
|
public BackActionInterface<SwitchScreenAction<StatusDisplay>>,
|
||||||
public StaticMenuDefinition<
|
public StaticMenuDefinition<
|
||||||
makeComponent<MenuItem, StaticText<TEXT_STATUS>, SwitchScreenAction<StatusDisplay>, StaticMenuItemIcon<&icons::back>>,
|
makeComponent<MenuItem, StaticText<TEXT_STATUS>, SwitchScreenAction<StatusDisplay>, StaticMenuItemIcon<&icons::back>>,
|
||||||
makeComponent<MenuItem, StaticText<TEXT_SELECTMODE>, SwitchScreenAction<SelectModeMenu>, StaticMenuItemIcon<&icons::modes>>,
|
makeComponent<MenuItem, StaticText<TEXT_SELECTMODE>, SwitchScreenAction<SelectModeMenu>, StaticMenuItemIcon<&icons::modes>>,
|
||||||
|
@@ -18,6 +18,7 @@ namespace {
|
|||||||
class ModesSettingsMenu :
|
class ModesSettingsMenu :
|
||||||
public MenuDisplay,
|
public MenuDisplay,
|
||||||
public StaticText<TEXT_MODESSETTINGS>,
|
public StaticText<TEXT_MODESSETTINGS>,
|
||||||
|
public BackActionInterface<SwitchScreenAction<SettingsMenu>>,
|
||||||
public StaticMenuDefinition<
|
public StaticMenuDefinition<
|
||||||
makeComponent<MenuItem, StaticText<TEXT_DEFAULTMODESETTIGNS>, SwitchScreenAction<DefaultModeSettingsMenu>>,
|
makeComponent<MenuItem, StaticText<TEXT_DEFAULTMODESETTIGNS>, SwitchScreenAction<DefaultModeSettingsMenu>>,
|
||||||
makeComponent<MenuItem, StaticText<TEXT_TEMPOMATMODESETTINGS>, SwitchScreenAction<TempomatModeSettingsMenu>>,
|
makeComponent<MenuItem, StaticText<TEXT_TEMPOMATMODESETTINGS>, SwitchScreenAction<TempomatModeSettingsMenu>>,
|
||||||
|
@@ -20,6 +20,7 @@ template<const char *Ttext, typename Ttexts, template<int> class ColorInterface>
|
|||||||
class MotorFeedbackDebugMenu :
|
class MotorFeedbackDebugMenu :
|
||||||
public MenuDisplay,
|
public MenuDisplay,
|
||||||
public StaticText<Ttext>,
|
public StaticText<Ttext>,
|
||||||
|
public BackActionInterface<SwitchScreenAction<DebugMenu>>,
|
||||||
public StaticMenuDefinition<
|
public StaticMenuDefinition<
|
||||||
makeComponent<MenuItem, typename Ttexts::AngleText, ColorInterface<TFT_DARKGREY>, DummyAction>,
|
makeComponent<MenuItem, typename Ttexts::AngleText, ColorInterface<TFT_DARKGREY>, DummyAction>,
|
||||||
makeComponent<MenuItem, typename Ttexts::SpeedText, ColorInterface<TFT_DARKGREY>, DummyAction>,
|
makeComponent<MenuItem, typename Ttexts::SpeedText, ColorInterface<TFT_DARKGREY>, DummyAction>,
|
||||||
|
@@ -19,6 +19,7 @@ template<const char *Ttext, typename Ttexts>
|
|||||||
class MotorStateDebugMenu :
|
class MotorStateDebugMenu :
|
||||||
public MenuDisplay,
|
public MenuDisplay,
|
||||||
public StaticText<Ttext>,
|
public StaticText<Ttext>,
|
||||||
|
public BackActionInterface<SwitchScreenAction<DebugMenu>>,
|
||||||
public StaticMenuDefinition<
|
public StaticMenuDefinition<
|
||||||
makeComponent<MenuItem, typename Ttexts::EnableText, DisabledColor, DummyAction>,
|
makeComponent<MenuItem, typename Ttexts::EnableText, DisabledColor, DummyAction>,
|
||||||
makeComponent<MenuItem, typename Ttexts::PwmText, DisabledColor, DummyAction>,
|
makeComponent<MenuItem, typename Ttexts::PwmText, DisabledColor, DummyAction>,
|
||||||
|
@@ -18,20 +18,37 @@ class MainMenu;
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
template<const Settings *preset>
|
template<const Settings *preset>
|
||||||
class ApplyPresetAction : public virtual ActionInterface {public: void triggered() override { settings = *preset; saveSettings(); } };
|
class ApplyPresetAction : public virtual ActionInterface
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
void triggered() override { settings = *preset; saveSettings(); }
|
||||||
|
};
|
||||||
|
|
||||||
template<const Settings::Limits *preset>
|
template<const Settings::Limits *preset>
|
||||||
class ApplyLimitsPresetAction : public virtual ActionInterface {public: void triggered() override { settings.limits = *preset; saveSettings(); } };
|
class ApplyLimitsPresetAction : public virtual ActionInterface
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
void triggered() override { settings.limits = *preset; saveSettings(); }
|
||||||
|
};
|
||||||
|
|
||||||
template<const Settings::ControllerHardware *preset>
|
template<const Settings::ControllerHardware *preset>
|
||||||
class ApplyControllerHardwarePresetAction : public virtual ActionInterface {public: void triggered() override { settings.controllerHardware = *preset; saveSettings(); } };
|
class ApplyControllerHardwarePresetAction : public virtual ActionInterface
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
void triggered() override { settings.controllerHardware = *preset; saveSettings(); }
|
||||||
|
};
|
||||||
|
|
||||||
template<const Settings::BoardcomputerHardware *preset>
|
template<const Settings::BoardcomputerHardware *preset>
|
||||||
class ApplyBoardcomputerHardwarePresetAction : public virtual ActionInterface {public: void triggered() override { settings.boardcomputerHardware = *preset; saveSettings(); } };
|
class ApplyBoardcomputerHardwarePresetAction : public virtual ActionInterface
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
void triggered() override { settings.boardcomputerHardware = *preset; saveSettings(); }
|
||||||
|
};
|
||||||
|
|
||||||
class PresetsMenu :
|
class PresetsMenu :
|
||||||
public MenuDisplay,
|
public MenuDisplay,
|
||||||
public StaticText<TEXT_PRESETS>,
|
public StaticText<TEXT_PRESETS>,
|
||||||
|
public BackActionInterface<SwitchScreenAction<MainMenu>>,
|
||||||
public StaticMenuDefinition<
|
public StaticMenuDefinition<
|
||||||
makeComponent<MenuItem, StaticText<TEXT_DEFAULTEVERYTHING>, ApplyPresetAction<&presets::defaultSettings>>,
|
makeComponent<MenuItem, StaticText<TEXT_DEFAULTEVERYTHING>, ApplyPresetAction<&presets::defaultSettings>>,
|
||||||
makeComponent<MenuItem, StaticText<TEXT_DEFAULTLIMITS>, ApplyLimitsPresetAction<&presets::defaultLimits>>,
|
makeComponent<MenuItem, StaticText<TEXT_DEFAULTLIMITS>, ApplyLimitsPresetAction<&presets::defaultLimits>>,
|
||||||
|
@@ -31,6 +31,7 @@ using SetLarsmModeAction = SetterAction<ModeInterface*, currentMode, LarsmMode*,
|
|||||||
class SelectModeMenu :
|
class SelectModeMenu :
|
||||||
public MenuDisplay,
|
public MenuDisplay,
|
||||||
public StaticText<TEXT_SELECTMODE>,
|
public StaticText<TEXT_SELECTMODE>,
|
||||||
|
public BackActionInterface<SwitchScreenAction<MainMenu>>,
|
||||||
public StaticMenuDefinition<
|
public StaticMenuDefinition<
|
||||||
makeComponent<MenuItem, StaticText<TEXT_DEFAULT>, MultiAction<SetDefaultModeAction, SwitchScreenAction<MainMenu>>>,
|
makeComponent<MenuItem, StaticText<TEXT_DEFAULT>, MultiAction<SetDefaultModeAction, SwitchScreenAction<MainMenu>>>,
|
||||||
makeComponent<MenuItem, StaticText<TEXT_TEMPOMAT>, MultiAction<SetTempomatModeAction, SwitchScreenAction<MainMenu>>>,
|
makeComponent<MenuItem, StaticText<TEXT_TEMPOMAT>, MultiAction<SetTempomatModeAction, SwitchScreenAction<MainMenu>>>,
|
||||||
|
@@ -37,6 +37,7 @@ struct BackLedAccessor : public RefAccessor<bool> { bool &getRef() const overrid
|
|||||||
class SettingsMenu :
|
class SettingsMenu :
|
||||||
public MenuDisplay,
|
public MenuDisplay,
|
||||||
public StaticText<TEXT_SETTINGS>,
|
public StaticText<TEXT_SETTINGS>,
|
||||||
|
public BackActionInterface<SwitchScreenAction<MainMenu>>,
|
||||||
public StaticMenuDefinition<
|
public StaticMenuDefinition<
|
||||||
makeComponent<MenuItem, StaticText<TEXT_LIMITSSETTINGS>, SwitchScreenAction<LimitsSettingsMenu>>,
|
makeComponent<MenuItem, StaticText<TEXT_LIMITSSETTINGS>, SwitchScreenAction<LimitsSettingsMenu>>,
|
||||||
makeComponent<MenuItem, StaticText<TEXT_WIFISETTINGS>, SwitchScreenAction<WifiSettingsMenu>, StaticMenuItemIcon<&icons::wifi>>,
|
makeComponent<MenuItem, StaticText<TEXT_WIFISETTINGS>, SwitchScreenAction<WifiSettingsMenu>, StaticMenuItemIcon<&icons::wifi>>,
|
||||||
|
@@ -112,6 +112,7 @@ public:
|
|||||||
class StationWifiSettingsMenu :
|
class StationWifiSettingsMenu :
|
||||||
public MenuDisplay,
|
public MenuDisplay,
|
||||||
public StaticText<TEXT_STATIONWIFISETTINGS>,
|
public StaticText<TEXT_STATIONWIFISETTINGS>,
|
||||||
|
public BackActionInterface<SwitchScreenAction<WifiSettingsMenu>>,
|
||||||
public StaticMenuDefinition<
|
public StaticMenuDefinition<
|
||||||
makeComponent<MenuItem, StaticText<TEXT_WIFIRECONNECT>, WifiReconnectAction>,
|
makeComponent<MenuItem, StaticText<TEXT_WIFIRECONNECT>, WifiReconnectAction>,
|
||||||
makeComponent<MenuItem, StaticText<TEXT_WIFIDISCONNECT>, WifiDisconnectAction>,
|
makeComponent<MenuItem, StaticText<TEXT_WIFIDISCONNECT>, WifiDisconnectAction>,
|
||||||
|
@@ -16,12 +16,25 @@ class ModesSettingsMenu;
|
|||||||
}
|
}
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
using TempomatModeCtrlTypChangeScreen = makeComponent<ChangeValueDisplay<ControlType>, StaticText<TEXT_SETCONTROLMODE>, TempomatModeCtrlTypAccessor, SwitchScreenAction<TempomatModeSettingsMenu>>;
|
using TempomatModeCtrlTypChangeScreen = makeComponent<
|
||||||
using TempomatModeCtrlModChangeScreen = makeComponent<ChangeValueDisplay<ControlMode>, StaticText<TEXT_SETCONTROLMODE>, TempomatModeCtrlModAccessor, SwitchScreenAction<TempomatModeSettingsMenu>>;
|
ChangeValueDisplay<ControlType>,
|
||||||
|
StaticText<TEXT_SETCONTROLMODE>,
|
||||||
|
TempomatModeCtrlTypAccessor,
|
||||||
|
BackActionInterface<SwitchScreenAction<TempomatModeSettingsMenu>>,
|
||||||
|
SwitchScreenAction<TempomatModeSettingsMenu>
|
||||||
|
>;
|
||||||
|
using TempomatModeCtrlModChangeScreen = makeComponent<
|
||||||
|
ChangeValueDisplay<ControlMode>,
|
||||||
|
StaticText<TEXT_SETCONTROLMODE>,
|
||||||
|
TempomatModeCtrlModAccessor,
|
||||||
|
BackActionInterface<SwitchScreenAction<TempomatModeSettingsMenu>>,
|
||||||
|
SwitchScreenAction<TempomatModeSettingsMenu>
|
||||||
|
>;
|
||||||
|
|
||||||
class TempomatModeSettingsMenu :
|
class TempomatModeSettingsMenu :
|
||||||
public MenuDisplay,
|
public MenuDisplay,
|
||||||
public StaticText<TEXT_TEMPOMATMODESETTINGS>,
|
public StaticText<TEXT_TEMPOMATMODESETTINGS>,
|
||||||
|
public BackActionInterface<SwitchScreenAction<ModesSettingsMenu>>,
|
||||||
public StaticMenuDefinition<
|
public StaticMenuDefinition<
|
||||||
makeComponent<MenuItem, StaticText<TEXT_SETCONTROLTYPE>, SwitchScreenAction<TempomatModeCtrlTypChangeScreen>>,
|
makeComponent<MenuItem, StaticText<TEXT_SETCONTROLTYPE>, SwitchScreenAction<TempomatModeCtrlTypChangeScreen>>,
|
||||||
makeComponent<MenuItem, StaticText<TEXT_SETCONTROLMODE>, SwitchScreenAction<TempomatModeCtrlModChangeScreen>>,
|
makeComponent<MenuItem, StaticText<TEXT_SETCONTROLMODE>, SwitchScreenAction<TempomatModeCtrlModChangeScreen>>,
|
||||||
|
@@ -18,7 +18,7 @@ class WifiSettingsMenu;
|
|||||||
}
|
}
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
class WifiScanMenu : public MenuDisplay
|
class WifiScanMenu : public MenuDisplay, public BackActionInterface<SwitchScreenAction<WifiSettingsMenu>>
|
||||||
{
|
{
|
||||||
using Base = MenuDisplay;
|
using Base = MenuDisplay;
|
||||||
|
|
||||||
|
@@ -20,6 +20,7 @@ namespace {
|
|||||||
class WifiSettingsMenu :
|
class WifiSettingsMenu :
|
||||||
public MenuDisplay,
|
public MenuDisplay,
|
||||||
public StaticText<TEXT_WIFISETTINGS>,
|
public StaticText<TEXT_WIFISETTINGS>,
|
||||||
|
public BackActionInterface<SwitchScreenAction<SettingsMenu>>,
|
||||||
public StaticMenuDefinition<
|
public StaticMenuDefinition<
|
||||||
makeComponent<MenuItem, StaticText<TEXT_GENERICWIFISETTINGS>, SwitchScreenAction<GenericWifiSettingsMenu>>,
|
makeComponent<MenuItem, StaticText<TEXT_GENERICWIFISETTINGS>, SwitchScreenAction<GenericWifiSettingsMenu>>,
|
||||||
makeComponent<MenuItem, StaticText<TEXT_STATIONWIFISETTINGS>, SwitchScreenAction<StationWifiSettingsMenu>>,
|
makeComponent<MenuItem, StaticText<TEXT_STATIONWIFISETTINGS>, SwitchScreenAction<StationWifiSettingsMenu>>,
|
||||||
|
@@ -16,7 +16,7 @@ class BmsDisplay;
|
|||||||
}
|
}
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
class MetersDisplay : public DemoDisplay, public SwitchScreenAction<MainMenu>
|
class MetersDisplay : public DemoDisplay, public SwitchScreenAction<MainMenu>, public BackActionInterface<SwitchScreenAction<MainMenu>>
|
||||||
{
|
{
|
||||||
using Base = DemoDisplay;
|
using Base = DemoDisplay;
|
||||||
|
|
||||||
|
@@ -13,7 +13,7 @@ class DemosMenu;
|
|||||||
}
|
}
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
class PingPongDisplay : public DemoDisplay, public SwitchScreenAction<DemosMenu>
|
class PingPongDisplay : public DemoDisplay, public SwitchScreenAction<DemosMenu>, public BackActionInterface<SwitchScreenAction<DemosMenu>>
|
||||||
{
|
{
|
||||||
using Base = DemoDisplay;
|
using Base = DemoDisplay;
|
||||||
|
|
||||||
|
@@ -13,7 +13,7 @@ class DemosMenu;
|
|||||||
}
|
}
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
class SpiroDisplay : public DemoDisplay, public SwitchScreenAction<DemosMenu>
|
class SpiroDisplay : public DemoDisplay, public SwitchScreenAction<DemosMenu>, public BackActionInterface<SwitchScreenAction<DemosMenu>>
|
||||||
{
|
{
|
||||||
using Base = DemoDisplay;
|
using Base = DemoDisplay;
|
||||||
|
|
||||||
|
@@ -13,7 +13,7 @@ class DemosMenu;
|
|||||||
}
|
}
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
class StarfieldDisplay : public DemoDisplay, public SwitchScreenAction<DemosMenu>
|
class StarfieldDisplay : public DemoDisplay, public SwitchScreenAction<DemosMenu>, public BackActionInterface<SwitchScreenAction<DemosMenu>>
|
||||||
{
|
{
|
||||||
using Base = DemoDisplay;
|
using Base = DemoDisplay;
|
||||||
|
|
||||||
|
@@ -148,8 +148,8 @@ void StatusDisplay::redraw()
|
|||||||
m_labelBrems.redraw(String{brems});
|
m_labelBrems.redraw(String{brems});
|
||||||
m_progressBarBrems.redraw(brems);
|
m_progressBarBrems.redraw(brems);
|
||||||
|
|
||||||
m_frontStatus.redraw(front);
|
m_frontStatus.redraw(::front);
|
||||||
m_backStatus.redraw(back);
|
m_backStatus.redraw(::back);
|
||||||
|
|
||||||
tft.setTextFont(2);
|
tft.setTextFont(2);
|
||||||
m_labelWifiStatus.redraw(toString(WiFi.status()));
|
m_labelWifiStatus.redraw(toString(WiFi.status()));
|
||||||
|
@@ -27,7 +27,7 @@ public:
|
|||||||
void start() override;
|
void start() override;
|
||||||
void initScreen() override;
|
void initScreen() override;
|
||||||
void redraw() override;
|
void redraw() override;
|
||||||
void button() override;
|
void confirm() override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
bool m_finished;
|
bool m_finished;
|
||||||
@@ -85,7 +85,7 @@ void UpdateDisplay::redraw()
|
|||||||
m_progressBar.redraw(float(m_progress) / m_total * 100.f);
|
m_progressBar.redraw(float(m_progress) / m_total * 100.f);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateDisplay::button()
|
void UpdateDisplay::confirm()
|
||||||
{
|
{
|
||||||
if (m_finished)
|
if (m_finished)
|
||||||
switchScreen<StatusDisplay>();
|
switchScreen<StatusDisplay>();
|
||||||
|
@@ -58,7 +58,9 @@ void updateDpad()
|
|||||||
if (!std::get<ButtonDown>(lastState) && std::get<ButtonDown>(state))
|
if (!std::get<ButtonDown>(lastState) && std::get<ButtonDown>(state))
|
||||||
InputDispatcher::rotate(1);
|
InputDispatcher::rotate(1);
|
||||||
if (std::get<ButtonConfirm>(lastState) != std::get<ButtonConfirm>(state))
|
if (std::get<ButtonConfirm>(lastState) != std::get<ButtonConfirm>(state))
|
||||||
InputDispatcher::button(std::get<ButtonConfirm>(state));
|
InputDispatcher::confirmButton(std::get<ButtonConfirm>(state));
|
||||||
|
if (std::get<ButtonBack>(lastState) != std::get<ButtonBack>(state))
|
||||||
|
InputDispatcher::backButton(std::get<ButtonBack>(state));
|
||||||
|
|
||||||
lastState = state;
|
lastState = state;
|
||||||
}
|
}
|
||||||
|
@@ -75,7 +75,9 @@ void updateDpadHack()
|
|||||||
if (!std::get<ButtonDown>(lastState) && std::get<ButtonDown>(state))
|
if (!std::get<ButtonDown>(lastState) && std::get<ButtonDown>(state))
|
||||||
InputDispatcher::rotate(1);
|
InputDispatcher::rotate(1);
|
||||||
if (std::get<ButtonConfirm>(lastState) != std::get<ButtonConfirm>(state))
|
if (std::get<ButtonConfirm>(lastState) != std::get<ButtonConfirm>(state))
|
||||||
InputDispatcher::button(std::get<ButtonConfirm>(state));
|
InputDispatcher::confirmButton(std::get<ButtonConfirm>(state));
|
||||||
|
if (std::get<ButtonBack>(lastState) != std::get<ButtonBack>(state))
|
||||||
|
InputDispatcher::backButton(std::get<ButtonBack>(state));
|
||||||
|
|
||||||
lastState = state;
|
lastState = state;
|
||||||
}
|
}
|
||||||
|
@@ -42,8 +42,10 @@ Display *currentDisplay{};
|
|||||||
|
|
||||||
int rotated{};
|
int rotated{};
|
||||||
bool requestFullRedraw{};
|
bool requestFullRedraw{};
|
||||||
bool buttonLongPressed{};
|
bool confirmButtonPressed{};
|
||||||
bool buttonPressed{};
|
bool confirmButtonLongPressed{};
|
||||||
|
bool backButtonPressed{};
|
||||||
|
bool backButtonLongPressed{};
|
||||||
|
|
||||||
class InputDispatcher
|
class InputDispatcher
|
||||||
{
|
{
|
||||||
@@ -53,7 +55,7 @@ public:
|
|||||||
rotated += offset;
|
rotated += offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void button(bool pressed)
|
static void confirmButton(bool pressed)
|
||||||
{
|
{
|
||||||
static unsigned long pressBegin = 0;
|
static unsigned long pressBegin = 0;
|
||||||
|
|
||||||
@@ -65,15 +67,36 @@ public:
|
|||||||
{
|
{
|
||||||
const auto duration = now - pressBegin;
|
const auto duration = now - pressBegin;
|
||||||
|
|
||||||
if (duration < 1000)
|
if (duration < 500)
|
||||||
buttonPressed = true;
|
confirmButtonPressed = true;
|
||||||
else if (duration < 3000)
|
else if (duration < 2000)
|
||||||
buttonLongPressed = true;
|
confirmButtonLongPressed = true;
|
||||||
else
|
else
|
||||||
requestFullRedraw = true;
|
requestFullRedraw = true;
|
||||||
|
|
||||||
pressBegin = 0;
|
pressBegin = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void backButton(bool pressed)
|
||||||
|
{
|
||||||
|
static unsigned long pressBegin = 0;
|
||||||
|
|
||||||
|
const auto now = millis();
|
||||||
|
|
||||||
|
if (pressed)
|
||||||
|
pressBegin = now;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const auto duration = now - pressBegin;
|
||||||
|
|
||||||
|
if (duration < 500)
|
||||||
|
backButtonPressed = true;
|
||||||
|
else
|
||||||
|
backButtonLongPressed = true;
|
||||||
|
|
||||||
|
pressBegin = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@@ -22,7 +22,7 @@ public:
|
|||||||
void stop() override;
|
void stop() override;
|
||||||
|
|
||||||
void rotate(int offset) override;
|
void rotate(int offset) override;
|
||||||
void button() override;
|
void confirm() override;
|
||||||
|
|
||||||
virtual void itemPressed(int index);
|
virtual void itemPressed(int index);
|
||||||
|
|
||||||
@@ -241,7 +241,7 @@ void MenuDisplay::rotate(int offset)
|
|||||||
m_rotateOffset += offset;
|
m_rotateOffset += offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuDisplay::button()
|
void MenuDisplay::confirm()
|
||||||
{
|
{
|
||||||
m_pressed = true;
|
m_pressed = true;
|
||||||
}
|
}
|
||||||
|
@@ -345,18 +345,32 @@ void updateDisplay()
|
|||||||
currentDisplay->initScreen();
|
currentDisplay->initScreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (buttonLongPressed)
|
if (confirmButtonPressed)
|
||||||
{
|
{
|
||||||
buttonLongPressed = false;
|
confirmButtonPressed = false;
|
||||||
Serial.println("todo: implement long press");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (buttonPressed)
|
|
||||||
{
|
|
||||||
buttonPressed = false;
|
|
||||||
|
|
||||||
if (currentDisplay)
|
if (currentDisplay)
|
||||||
currentDisplay->button();
|
currentDisplay->confirm();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (confirmButtonLongPressed)
|
||||||
|
{
|
||||||
|
confirmButtonLongPressed = false;
|
||||||
|
Serial.println("todo: implement long press for confirm");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (backButtonPressed)
|
||||||
|
{
|
||||||
|
backButtonPressed = false;
|
||||||
|
|
||||||
|
if (currentDisplay)
|
||||||
|
currentDisplay->back();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (backButtonLongPressed)
|
||||||
|
{
|
||||||
|
backButtonLongPressed = false;
|
||||||
|
Serial.println("todo: implement long press for back");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentDisplay)
|
if (currentDisplay)
|
||||||
|
@@ -83,8 +83,12 @@ void handleSerial()
|
|||||||
InputDispatcher::rotate(1);
|
InputDispatcher::rotate(1);
|
||||||
break;
|
break;
|
||||||
case 'C':
|
case 'C':
|
||||||
InputDispatcher::button(true);
|
InputDispatcher::confirmButton(true);
|
||||||
InputDispatcher::button(false);
|
InputDispatcher::confirmButton(false);
|
||||||
|
break;
|
||||||
|
case 'D':
|
||||||
|
InputDispatcher::backButton(true);
|
||||||
|
InputDispatcher::backButton(false);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -54,7 +54,7 @@ void initWebserver()
|
|||||||
{
|
{
|
||||||
HtmlTag pTag{"p", content};
|
HtmlTag pTag{"p", content};
|
||||||
|
|
||||||
content += "<a href=\"/up\">Up</a> <a href=\"/down\">Down</a> <a href=\"/confirm\">Confirm</a>";
|
content += "<a href=\"/up\">Up</a> <a href=\"/down\">Down</a> <a href=\"/confirm\">Confirm</a> <a href=\"/back\">Back</a>";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (auto constCurrentDisplay = static_cast<const Display *>(currentDisplay))
|
if (auto constCurrentDisplay = static_cast<const Display *>(currentDisplay))
|
||||||
@@ -117,8 +117,17 @@ void initWebserver()
|
|||||||
});
|
});
|
||||||
|
|
||||||
webServer.on("/confirm", HTTP_GET, [](){
|
webServer.on("/confirm", HTTP_GET, [](){
|
||||||
InputDispatcher::button(true);
|
InputDispatcher::confirmButton(true);
|
||||||
InputDispatcher::button(false);
|
InputDispatcher::confirmButton(false);
|
||||||
|
|
||||||
|
webServer.sendHeader("Connection", "close");
|
||||||
|
webServer.sendHeader("Location", "/");
|
||||||
|
webServer.send(302, "text/html", "ok");
|
||||||
|
});
|
||||||
|
|
||||||
|
webServer.on("/back", HTTP_GET, [](){
|
||||||
|
InputDispatcher::backButton(true);
|
||||||
|
InputDispatcher::backButton(false);
|
||||||
|
|
||||||
webServer.sendHeader("Connection", "close");
|
webServer.sendHeader("Connection", "close");
|
||||||
webServer.sendHeader("Location", "/");
|
webServer.sendHeader("Location", "/");
|
||||||
|
Reference in New Issue
Block a user