Implemented error handler in ChangeValueDisplays

This commit is contained in:
2021-12-29 21:53:47 +01:00
parent 855dbca1ca
commit 4b9a36f507
39 changed files with 336 additions and 418 deletions

View File

@ -8,6 +8,7 @@ set(headers
bluetoothtexthelpers.h
bmsutils.h
bobbybuttons.h
bobbyerrorhandler.h
buildserver.h
buttons.h
can.h
@ -107,6 +108,7 @@ set(headers
displays/bobbydisplaywithtitle.h
displays/bobbygraphdisplay.h
displays/bobbymenudisplay.h
displays/bobbypopupdisplay.h
displays/bobbysplitgraphdisplay.h
displays/calibratedisplay.h
displays/calibratevoltagedisplay.h
@ -183,7 +185,6 @@ set(headers
displays/menus/wifistasettingsmenu.h
displays/metersdisplay.h
displays/pingpongdisplay.h
displays/popups/alertdisplay.h
displays/poweroffdisplay.h
displays/powersupplydisplay.h
displays/qrcodedebug.h
@ -241,6 +242,7 @@ set(sources
bluetoothtexthelpers.cpp
bmsutils.cpp
bobbybuttons.cpp
bobbyerrorhandler.cpp
buildserver.cpp
buttons.cpp
can.cpp
@ -337,6 +339,7 @@ set(sources
displays/bobbydisplaywithtitle.cpp
displays/bobbygraphdisplay.cpp
displays/bobbymenudisplay.cpp
displays/bobbypopupdisplay.cpp
displays/bobbysplitgraphdisplay.cpp
displays/calibratedisplay.cpp
displays/calibratevoltagedisplay.cpp
@ -411,7 +414,6 @@ set(sources
displays/menus/wifistasettingsmenu.cpp
displays/metersdisplay.cpp
displays/pingpongdisplay.cpp
displays/popups/alertdisplay.cpp
displays/poweroffdisplay.cpp
displays/powersupplydisplay.cpp
displays/qrcodedebug.cpp

View File

@ -1,5 +1,8 @@
#pragma once
// system includes
#include <cstdint>
// 3rdparty lib includes
#include <accessorinterface.h>
@ -11,7 +14,15 @@
template<typename T>
struct RefAccessorSaveSettings : public virtual espgui::RefAccessor<T>
{
void setValue(T value) override { espgui::RefAccessor<T>::setValue(value); saveSettings(); };
typename espgui::AccessorInterface<T>::setter_result_t setValue(T value) override
{
espgui::RefAccessor<T>::setValue(value);
if (!saveSettings())
return tl::make_unexpected("saveSettings() failed!");
return {};
};
};
template<typename T>
@ -19,6 +30,48 @@ struct NewSettingsAccessor : public virtual espgui::AccessorInterface<T>
{
virtual ConfigWrapper<T>& getConfig() const = 0;
T getValue() const override { return getConfig().value; }
void setValue(T value) override { configs.write_config(getConfig(), value); }
T getValue() const override
{
return getConfig().value;
}
typename espgui::AccessorInterface<T>::setter_result_t setValue(T value) override
{
return configs.write_config(getConfig(), value);
}
};
template<typename T>
struct NewSettingsChronoAdaptorAccessor;
template<>
struct NewSettingsChronoAdaptorAccessor<espchrono::minutes32> : public virtual espgui::AccessorInterface<int32_t>
{
virtual ConfigWrapper<espchrono::minutes32>& getConfig() const = 0;
int32_t getValue() const override
{
return getConfig().value.count();
}
typename espgui::AccessorInterface<int32_t>::setter_result_t setValue(int32_t value) override
{
return configs.write_config(getConfig(), espchrono::minutes32{value});
}
};
template<>
struct NewSettingsChronoAdaptorAccessor<espchrono::milliseconds32> : public virtual espgui::AccessorInterface<int32_t>
{
virtual ConfigWrapper<espchrono::milliseconds32>& getConfig() const = 0;
int32_t getValue() const override
{
return getConfig().value.count();
}
typename espgui::AccessorInterface<int32_t>::setter_result_t setValue(int32_t value) override
{
return configs.write_config(getConfig(), espchrono::milliseconds32{value});
}
};

View File

@ -27,7 +27,13 @@ struct IDcMaxAccessor : public RefAccessorSaveSettings<int16_t> { int16_t &getRe
struct NMotMaxKmhAccessor : public virtual espgui::AccessorInterface<int16_t>
{
int16_t getValue() const override { return convertToKmh(settings.limits.nMotMax); }
void setValue(int16_t value) override { settings.limits.nMotMax = convertFromKmh(value); saveSettings(); }
espgui::AccessorInterface<int16_t>::setter_result_t setValue(int16_t value) override
{
settings.limits.nMotMax = convertFromKmh(value);
if (!saveSettings())
return tl::make_unexpected("saveSettings() failed!");
return {};
}
};
struct NMotMaxRpmAccessor : public RefAccessorSaveSettings<int16_t> { int16_t &getRef() const override { return settings.limits.nMotMax; } };
struct FieldWeakMaxAccessor : public RefAccessorSaveSettings<int16_t> { int16_t &getRef() const override { return settings.limits.fieldWeakMax; } };
@ -50,32 +56,14 @@ struct CloudTransmitTimeoutAccessor : public RefAccessorSaveSettings<int16_t> {
#endif
// Time
struct TimezoneOffsetAccessor : public virtual espgui::AccessorInterface<int32_t>
{
int32_t getValue() const override { return configs.timezoneOffset.value.count(); }
void setValue(int32_t value) override { configs.write_config(configs.timezoneOffset, espchrono::minutes32{value}); }
};
struct DaylightSavingModeAccessor : public virtual espgui::AccessorInterface<espchrono::DayLightSavingMode>
{
espchrono::DayLightSavingMode getValue() const override { return configs.timeDst.value; }
void setValue(espchrono::DayLightSavingMode value) override { configs.write_config(configs.timeDst, value); }
};
//struct TimezoneOffsetAccessor : public NewSettingsAccessor<int32_t> { ConfigWrapper<int32_t> &getConfig() const override { return configs.timezoneOffset; } };
struct TimezoneOffsetAccessor : public NewSettingsChronoAdaptorAccessor<espchrono::minutes32> { ConfigWrapper<espchrono::minutes32> &getConfig() const override { return configs.timezoneOffset; } };
struct DaylightSavingModeAccessor : public NewSettingsAccessor<espchrono::DayLightSavingMode> { ConfigWrapper<espchrono::DayLightSavingMode> &getConfig() const override { return configs.timeDst; } };
#ifdef FEATURE_NTP
struct TimeServerEnabledAccessor : public virtual espgui::AccessorInterface<bool>
{
bool getValue() const override { return configs.timeServerEnabled.value; }
void setValue(bool value) override { configs.write_config(configs.timeServerEnabled, value); }
};
struct TimeSyncModeAccessor : public virtual espgui::AccessorInterface<sntp_sync_mode_t>
{
sntp_sync_mode_t getValue() const override { return configs.timeSyncMode.value; }
void setValue(sntp_sync_mode_t value) override { configs.write_config(configs.timeSyncMode, value); }
};
struct TimeSyncIntervalAccessor : public virtual espgui::AccessorInterface<int32_t>
{
int32_t getValue() const override { return configs.timeSyncInterval.value.count(); }
void setValue(int32_t value) override { configs.write_config(configs.timeSyncInterval, espchrono::milliseconds32{value}); }
};
struct TimeServerEnabledAccessor : public NewSettingsAccessor<bool> { ConfigWrapper<bool> &getConfig() const override { return configs.timeServerEnabled; } };
struct TimeSyncModeAccessor : public NewSettingsAccessor<sntp_sync_mode_t> { ConfigWrapper<sntp_sync_mode_t> &getConfig() const override { return configs.timeSyncMode; } };
//struct TimeSyncIntervalAccessor : public NewSettingsAccessor<int32_t> { ConfigWrapper<int32_t> &getConfig() const override { return configs.timeSyncInterval; } };
struct TimeSyncIntervalAccessor : public NewSettingsChronoAdaptorAccessor<espchrono::milliseconds32> { ConfigWrapper<espchrono::milliseconds32> &getConfig() const override { return configs.timeSyncInterval; } };
#endif
// Controller Hardware
@ -93,7 +81,13 @@ struct WheelDiameterMmAccessor : public RefAccessorSaveSettings<int16_t> { int16
struct WheelDiameterInchAccessor : public virtual espgui::AccessorInterface<float>
{
float getValue() const override { return convertToInch(settings.controllerHardware.wheelDiameter); }
void setValue(float value) override { settings.controllerHardware.wheelDiameter = convertFromInch(value); saveSettings(); }
espgui::AccessorInterface<int16_t>::setter_result_t setValue(float value) override
{
settings.controllerHardware.wheelDiameter = convertFromInch(value);
if (!saveSettings())
return tl::make_unexpected("saveSettings() failed!");
return {};
}
};
struct NumMagnetPolesAccessor : public RefAccessorSaveSettings<int16_t> { int16_t &getRef() const override { return settings.controllerHardware.numMagnetPoles; } };
struct SwapFrontBackAccessor : public RefAccessorSaveSettings<bool> {

View File

@ -1,39 +1,3 @@
#include "wifistaconfigaccessors.h"
// local includes
#include "newsettings.h"
using namespace espgui;
bool WifiStaEnabledAccessor::getValue() const { return configs.wifiStaEnabled.value; }
void WifiStaEnabledAccessor::setValue(bool value) { configs.write_config(configs.wifiStaEnabled, value); }
std::string WifiStaConfigSsidAccessor::getValue() const { return configs.wifi_configs[m_index].ssid.value; }
void WifiStaConfigSsidAccessor::setValue(std::string value) { configs.write_config(configs.wifi_configs[m_index].ssid, value); }
std::string WifiStaConfigKeyAccessor::getValue() const { return configs.wifi_configs[m_index].key.value; }
void WifiStaConfigKeyAccessor::setValue(std::string value) { configs.write_config(configs.wifi_configs[m_index].key, value); }
bool WifiStaConfigUseStaticIpAccessor::getValue() const { return configs.wifi_configs[m_index].useStaticIp.value; }
void WifiStaConfigUseStaticIpAccessor::setValue(bool value) { configs.write_config(configs.wifi_configs[m_index].useStaticIp, value); }
wifi_stack::ip_address_t WifiStaConfigStaticIpAccessor::getValue() const { return configs.wifi_configs[m_index].staticIp.value; }
void WifiStaConfigStaticIpAccessor::setValue(wifi_stack::ip_address_t value) { configs.write_config(configs.wifi_configs[m_index].staticIp, value); }
wifi_stack::ip_address_t WifiStaConfigStaticSubnetAccessor::getValue() const { return configs.wifi_configs[m_index].staticSubnet.value; }
void WifiStaConfigStaticSubnetAccessor::setValue(wifi_stack::ip_address_t value) { configs.write_config(configs.wifi_configs[m_index].staticSubnet, value); }
wifi_stack::ip_address_t WifiStaConfigStaticGatewayAccessor::getValue() const { return configs.wifi_configs[m_index].staticGateway.value; }
void WifiStaConfigStaticGatewayAccessor::setValue(wifi_stack::ip_address_t value) { configs.write_config(configs.wifi_configs[m_index].staticGateway, value); }
bool WifiStaConfigUseStaticDnsAccessor::getValue() const { return configs.wifi_configs[m_index].useStaticDns.value; }
void WifiStaConfigUseStaticDnsAccessor::setValue(bool value) { configs.write_config(configs.wifi_configs[m_index].useStaticDns, value); }
wifi_stack::ip_address_t WifiStaConfigStaticDns0Accessor::getValue() const { return configs.wifi_configs[m_index].staticDns0.value; }
void WifiStaConfigStaticDns0Accessor::setValue(wifi_stack::ip_address_t value) { configs.write_config(configs.wifi_configs[m_index].staticDns0, value); }
wifi_stack::ip_address_t WifiStaConfigStaticDns1Accessor::getValue() const { return configs.wifi_configs[m_index].staticDns1.value; }
void WifiStaConfigStaticDns1Accessor::setValue(wifi_stack::ip_address_t value) { configs.write_config(configs.wifi_configs[m_index].staticDns1, value); }
wifi_stack::ip_address_t WifiStaConfigStaticDns2Accessor::getValue() const { return configs.wifi_configs[m_index].staticDns2.value; }
void WifiStaConfigStaticDns2Accessor::setValue(wifi_stack::ip_address_t value) { configs.write_config(configs.wifi_configs[m_index].staticDns2, value); }

View File

@ -9,129 +9,98 @@
#include <accessorinterface.h>
#include <espwifiutils.h>
class WifiStaEnabledAccessor : public virtual espgui::AccessorInterface<bool>
{
public:
bool getValue() const override;
void setValue(bool value) override;
};
// local includes
#include "newsettings.h"
#include "accessorhelpers.h"
class WifiStaConfigSsidAccessor : public virtual espgui::AccessorInterface<std::string>
struct WifiStaEnabledAccessor : public NewSettingsAccessor<bool> { ConfigWrapper<bool> &getConfig() const override { return configs.wifiStaEnabled; } };
class WifiStaConfigSsidAccessor : public virtual NewSettingsAccessor<std::string>
{
public:
WifiStaConfigSsidAccessor(int index) : m_index{index} {}
std::string getValue() const override;
void setValue(std::string value) override;
ConfigWrapper<std::string>& getConfig() const override { return configs.wifi_configs[m_index].ssid; }
private:
const int m_index;
};
class WifiStaConfigKeyAccessor : public virtual espgui::AccessorInterface<std::string>
class WifiStaConfigKeyAccessor : public virtual NewSettingsAccessor<std::string>
{
public:
WifiStaConfigKeyAccessor(int index) : m_index{index} {}
std::string getValue() const override;
void setValue(std::string value) override;
ConfigWrapper<std::string>& getConfig() const override { return configs.wifi_configs[m_index].key; }
private:
const int m_index;
};
class WifiStaConfigUseStaticIpAccessor : public virtual espgui::AccessorInterface<bool>
class WifiStaConfigUseStaticIpAccessor : public virtual NewSettingsAccessor<bool>
{
public:
WifiStaConfigUseStaticIpAccessor(int index) : m_index{index} {}
bool getValue() const override;
void setValue(bool value) override;
ConfigWrapper<bool>& getConfig() const override { return configs.wifi_configs[m_index].useStaticIp; }
private:
const int m_index;
};
class WifiStaConfigStaticIpAccessor : public virtual espgui::AccessorInterface<wifi_stack::ip_address_t>
class WifiStaConfigStaticIpAccessor : public virtual NewSettingsAccessor<wifi_stack::ip_address_t>
{
public:
WifiStaConfigStaticIpAccessor(int index) : m_index{index} {}
wifi_stack::ip_address_t getValue() const override;
void setValue(wifi_stack::ip_address_t value) override;
ConfigWrapper<wifi_stack::ip_address_t>& getConfig() const override { return configs.wifi_configs[m_index].staticIp; }
private:
const int m_index;
};
class WifiStaConfigStaticSubnetAccessor : public virtual espgui::AccessorInterface<wifi_stack::ip_address_t>
class WifiStaConfigStaticSubnetAccessor : public virtual NewSettingsAccessor<wifi_stack::ip_address_t>
{
public:
WifiStaConfigStaticSubnetAccessor(int index) : m_index{index} {}
wifi_stack::ip_address_t getValue() const override;
void setValue(wifi_stack::ip_address_t value) override;
ConfigWrapper<wifi_stack::ip_address_t>& getConfig() const override { return configs.wifi_configs[m_index].staticSubnet; }
private:
const int m_index;
};
class WifiStaConfigStaticGatewayAccessor : public virtual espgui::AccessorInterface<wifi_stack::ip_address_t>
class WifiStaConfigStaticGatewayAccessor : public virtual NewSettingsAccessor<wifi_stack::ip_address_t>
{
public:
WifiStaConfigStaticGatewayAccessor(int index) : m_index{index} {}
wifi_stack::ip_address_t getValue() const override;
void setValue(wifi_stack::ip_address_t value) override;
ConfigWrapper<wifi_stack::ip_address_t>& getConfig() const override { return configs.wifi_configs[m_index].staticGateway; }
private:
const int m_index;
};
class WifiStaConfigUseStaticDnsAccessor : public virtual espgui::AccessorInterface<bool>
class WifiStaConfigUseStaticDnsAccessor : public virtual NewSettingsAccessor<bool>
{
public:
WifiStaConfigUseStaticDnsAccessor(int index) : m_index{index} {}
bool getValue() const override;
void setValue(bool value) override;
ConfigWrapper<bool>& getConfig() const override { return configs.wifi_configs[m_index].useStaticDns; }
private:
const int m_index;
};
class WifiStaConfigStaticDns0Accessor : public virtual espgui::AccessorInterface<wifi_stack::ip_address_t>
class WifiStaConfigStaticDns0Accessor : public virtual NewSettingsAccessor<wifi_stack::ip_address_t>
{
public:
WifiStaConfigStaticDns0Accessor(int index) : m_index{index} {}
wifi_stack::ip_address_t getValue() const override;
void setValue(wifi_stack::ip_address_t value) override;
ConfigWrapper<wifi_stack::ip_address_t>& getConfig() const override { return configs.wifi_configs[m_index].staticDns0; }
private:
const int m_index;
};
class WifiStaConfigStaticDns1Accessor : public virtual espgui::AccessorInterface<wifi_stack::ip_address_t>
class WifiStaConfigStaticDns1Accessor : public virtual NewSettingsAccessor<wifi_stack::ip_address_t>
{
public:
WifiStaConfigStaticDns1Accessor(int index) : m_index{index} {}
wifi_stack::ip_address_t getValue() const override;
void setValue(wifi_stack::ip_address_t value) override;
ConfigWrapper<wifi_stack::ip_address_t>& getConfig() const override { return configs.wifi_configs[m_index].staticDns1; }
private:
const int m_index;
};
class WifiStaConfigStaticDns2Accessor : public virtual espgui::AccessorInterface<wifi_stack::ip_address_t>
class WifiStaConfigStaticDns2Accessor : public virtual NewSettingsAccessor<wifi_stack::ip_address_t>
{
public:
WifiStaConfigStaticDns2Accessor(int index) : m_index{index} {}
wifi_stack::ip_address_t getValue() const override;
void setValue(wifi_stack::ip_address_t value) override;
ConfigWrapper<wifi_stack::ip_address_t>& getConfig() const override { return configs.wifi_configs[m_index].staticDns2; }
private:
const int m_index;
};

View File

@ -0,0 +1,14 @@
#include "bobbyerrorhandler.h"
// 3rdparty lib includes
#include <screenmanager.h>
// local includes
#include "displays/bobbypopupdisplay.h"
void BobbyErrorHandler::errorOccured(std::string &&error)
{
auto newDisplay = std::make_unique<BobbyPopupDisplay>(std::move(error), std::move(espgui::currentDisplay));
newDisplay->initOverlay();
espgui::currentDisplay = std::move(newDisplay);
}

9
main/bobbyerrorhandler.h Normal file
View File

@ -0,0 +1,9 @@
#pragma once
// 3rdparty lib includes
#include <errorhandlerinterface.h>
struct BobbyErrorHandler : public virtual espgui::ErrorHandlerInterface
{
void errorOccured(std::string &&error) override;
};

View File

@ -5,9 +5,12 @@
// local includes
#include "bobbybuttons.h"
#include "bobbyerrorhandler.h"
template<typename Tvalue>
class BobbyChangeValueDisplay : public espgui::ChangeValueDisplay<Tvalue>
class BobbyChangeValueDisplay :
public espgui::ChangeValueDisplay<Tvalue>,
public virtual BobbyErrorHandler
{
using Base = espgui::ChangeValueDisplay<Tvalue>;

View File

@ -1,5 +1,8 @@
#include "bobbydisplay.h"
// local includes
#include "bobbybuttons.h"
void BobbyDisplay::rawButtonPressed(uint8_t button)
{
//Base::rawButtonPressed(button);

View File

@ -3,9 +3,6 @@
// 3rdparty lib includes
#include <display.h>
// local includes
#include "bobbybuttons.h"
class BobbyDisplay : public espgui::Display
{
using Base = espgui::Display;

View File

@ -1,5 +1,8 @@
#include "bobbydisplaywithtitle.h"
// local includes
#include "bobbybuttons.h"
void BobbyDisplayWithTitle::rawButtonPressed(uint8_t button)
{
//Base::rawButtonPressed(button);

View File

@ -3,9 +3,6 @@
// 3rdparty lib includes
#include <displaywithtitle.h>
// local includes
#include "bobbybuttons.h"
class BobbyDisplayWithTitle : public espgui::DisplayWithTitle
{
using Base = espgui::DisplayWithTitle;

View File

@ -1,5 +1,8 @@
#include "bobbymenudisplay.h"
// local includes
#include "bobbybuttons.h"
void BobbyMenuDisplay::rawButtonPressed(uint8_t button)
{
//Base::rawButtonPressed(button);

View File

@ -3,9 +3,6 @@
// 3rdparty lib includes
#include <menudisplay.h>
// local includes
#include "bobbybuttons.h"
class BobbyMenuDisplay : public espgui::MenuDisplay
{
using Base = espgui::MenuDisplay;

View File

@ -0,0 +1,29 @@
#include "bobbypopupdisplay.h"
// local includes
#include "bobbybuttons.h"
void BobbyPopupDisplay::rawButtonPressed(uint8_t button)
{
//Base::rawButtonPressed(button);
if (const auto translated = translateRawButton(button))
buttonPressed(*translated);
}
void BobbyPopupDisplay::rawButtonReleased(uint8_t button)
{
//Base::rawButtonReleased(button);
if (const auto translated = translateRawButton(button))
buttonReleased(*translated);
}
void BobbyPopupDisplay::buttonPressed(espgui::Button button)
{
//Base::buttonPressed(button);
buttonPressedCommon(button);
}
void BobbyPopupDisplay::buttonReleased(espgui::Button button)
{
//Base::buttonReleased(button);
}

View File

@ -0,0 +1,18 @@
#pragma once
// 3rdparty lib includes
#include <popupdisplay.h>
class BobbyPopupDisplay : public espgui::PopupDisplay
{
using Base = espgui::PopupDisplay;
public:
using Base::Base;
void rawButtonPressed(uint8_t button) override;
void rawButtonReleased(uint8_t button) override;
void buttonPressed(espgui::Button button) override;
void buttonReleased(espgui::Button button) override;
};

View File

@ -18,24 +18,24 @@ using BatteryCellSeriesChangeScreen = espgui::makeComponent<
BobbyChangeValueDisplay<uint8_t>,
espgui::StaticText<TEXT_CELL_SERIES>,
BatterySeriesCellsAccessor,
espgui::BackActionInterface<espgui::SwitchScreenAction<BatteryMenu>>,
espgui::SwitchScreenAction<BatteryMenu>
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<BatteryMenu>>,
espgui::BackActionInterface<espgui::SwitchScreenAction<BatteryMenu>>
>;
using BatteryCellParallelChangeScreen = espgui::makeComponent<
BobbyChangeValueDisplay<uint8_t>,
espgui::StaticText<TEXT_CELL_PARALLEL>,
BatteryParallelCellsAccessor,
espgui::BackActionInterface<espgui::SwitchScreenAction<BatteryMenu>>,
espgui::SwitchScreenAction<BatteryMenu>
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<BatteryMenu>>,
espgui::BackActionInterface<espgui::SwitchScreenAction<BatteryMenu>>
>;
using BatteryWHperKMChangeScreen = espgui::makeComponent<
BobbyChangeValueDisplay<uint16_t>,
espgui::StaticText<TEXT_BATTERY_WHKM>,
BatteryWHperKMAccessor,
espgui::BackActionInterface<espgui::SwitchScreenAction<BatteryMenu>>,
espgui::SwitchScreenAction<BatteryMenu>
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<BatteryMenu>>,
espgui::BackActionInterface<espgui::SwitchScreenAction<BatteryMenu>>
>;
using namespace espgui;

View File

@ -48,36 +48,36 @@ using SampleCountChangeScreen = espgui::makeComponent<
BobbyChangeValueDisplay<int16_t>,
espgui::StaticText<TEXT_SAMPLECOUNT>,
SampleCountAccessor,
espgui::BackActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>,
espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>,
espgui::BackActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>
>;
using GasMinChangeScreen = espgui::makeComponent<
BobbyChangeValueDisplay<int16_t>,
espgui::StaticText<TEXT_GASMIN>,
GasMinAccessor,
espgui::BackActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>,
espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>,
espgui::BackActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>
>;
using GasMaxChangeScreen = espgui::makeComponent<
BobbyChangeValueDisplay<int16_t>,
espgui::StaticText<TEXT_GASMAX>,
GasMaxAccessor,
espgui::BackActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>,
espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>,
espgui::BackActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>
>;
using BremsMinChangeScreen = espgui::makeComponent<
BobbyChangeValueDisplay<int16_t>,
espgui::StaticText<TEXT_BREMSMIN>,
BremsMinAccessor,
espgui::BackActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>,
espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>,
espgui::BackActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>
>;
using BremsMaxChangeScreen = espgui::makeComponent<
BobbyChangeValueDisplay<int16_t>,
espgui::StaticText<TEXT_BREMSMAX>,
BremsMaxAccessor,
espgui::BackActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>,
espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>,
espgui::BackActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>
>;
#if defined(FEATURE_DPAD) || defined(FEATURE_DPAD_3WIRESW) || defined(FEATURE_DPAD_5WIRESW) || defined(FEATURE_DPAD_5WIRESW_2OUT) || defined (FEATURE_DPAD_6WIRESW)
@ -85,8 +85,8 @@ using DPadDebounceChangeScreen = espgui::makeComponent<
BobbyChangeValueDisplay<uint8_t>,
espgui::StaticText<TEXT_DPADDEBOUNCE>,
DPadDebounceAccessor,
espgui::BackActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>,
espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>,
espgui::BackActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>
>;
#endif
@ -108,43 +108,43 @@ using GametrakXMinChangeScreen = espgui::makeComponent<
BobbyChangeValueDisplay<int16_t>,
espgui::StaticText<TEXT_SETGAMETRAKXMIN>,
GametrakXMinAccessor,
espgui::BackActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>,
espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>,
espgui::BackActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>
>;
using GametrakXMaxChangeScreen = espgui::makeComponent<
BobbyChangeValueDisplay<int16_t>,
espgui::StaticText<TEXT_SETGAMETRAKXMAX>,
GametrakXMaxAccessor,
espgui::BackActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>,
espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>,
espgui::BackActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>
>;
using GametrakYMinChangeScreen = espgui::makeComponent<
BobbyChangeValueDisplay<int16_t>,
espgui::StaticText<TEXT_SETGAMETRAKYMIN>,
GametrakYMinAccessor,
espgui::BackActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>,
espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>,
espgui::BackActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>
>;
using GametrakYMaxChangeScreen = espgui::makeComponent<
BobbyChangeValueDisplay<int16_t>,
espgui::StaticText<TEXT_SETGAMETRAKYMAX>,
GametrakYMaxAccessor,
espgui::BackActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>,
espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>,
espgui::BackActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>
>;
using GametrakDistMinChangeScreen = espgui::makeComponent<
BobbyChangeValueDisplay<int16_t>,
espgui::StaticText<TEXT_SETGAMETRAKDISTMIN>,
GametrakDistMinAccessor,
espgui::BackActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>,
espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>,
espgui::BackActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>
>;
using GametrakDistMaxChangeScreen = espgui::makeComponent<
BobbyChangeValueDisplay<int16_t>,
espgui::StaticText<TEXT_SETGAMETRAKDISTMAX>,
GametrakDistMaxAccessor,
espgui::BackActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>,
espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>,
espgui::BackActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>
>;
#endif
} // namespace

View File

@ -21,8 +21,8 @@ using FrontFreqChangeScreen = espgui::makeComponent<
BobbyChangeValueDisplay<uint8_t>,
espgui::StaticText<TEXT_FRONTFREQ>,
FrontFreqAccessor,
espgui::BackActionInterface<espgui::SwitchScreenAction<BuzzerMenu>>,
espgui::SwitchScreenAction<BuzzerMenu>
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<BuzzerMenu>>,
espgui::BackActionInterface<espgui::SwitchScreenAction<BuzzerMenu>>
>;
struct FrontPatternAccessor : public espgui::RefAccessor<uint8_t> { uint8_t &getRef() const override { return controllers.front.command.buzzer.pattern; } };
@ -30,8 +30,8 @@ using FrontPatternChangeScreen = espgui::makeComponent<
BobbyChangeValueDisplay<uint8_t>,
espgui::StaticText<TEXT_FRONTPATTERN>,
FrontPatternAccessor,
espgui::BackActionInterface<espgui::SwitchScreenAction<BuzzerMenu>>,
espgui::SwitchScreenAction<BuzzerMenu>
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<BuzzerMenu>>,
espgui::BackActionInterface<espgui::SwitchScreenAction<BuzzerMenu>>
>;
struct BackFreqAccessor : public espgui::RefAccessor<uint8_t> { uint8_t &getRef() const override { return controllers.back.command.buzzer.freq; } };
@ -39,8 +39,8 @@ using BackFreqChangeScreen = espgui::makeComponent<
BobbyChangeValueDisplay<uint8_t>,
espgui::StaticText<TEXT_BACKFREQ>,
BackFreqAccessor,
espgui::BackActionInterface<espgui::SwitchScreenAction<BuzzerMenu>>,
espgui::SwitchScreenAction<BuzzerMenu>
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<BuzzerMenu>>,
espgui::BackActionInterface<espgui::SwitchScreenAction<BuzzerMenu>>
>;
struct BackPatternAccessor : public espgui::RefAccessor<uint8_t> { uint8_t &getRef() const override { return controllers.back.command.buzzer.pattern; } };
@ -48,37 +48,37 @@ using BackPatternChangeScreen = espgui::makeComponent<
BobbyChangeValueDisplay<uint8_t>,
espgui::StaticText<TEXT_BACKPATTERN>,
BackPatternAccessor,
espgui::BackActionInterface<espgui::SwitchScreenAction<BuzzerMenu>>,
espgui::SwitchScreenAction<BuzzerMenu>
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<BuzzerMenu>>,
espgui::BackActionInterface<espgui::SwitchScreenAction<BuzzerMenu>>
>;
using ReverseBeepFreq0ChangeScreen = espgui::makeComponent<
BobbyChangeValueDisplay<uint8_t>,
espgui::StaticText<TEXT_REVERSEBEEPFREQ0>,
ReverseBeepFreq0Accessor,
espgui::BackActionInterface<espgui::SwitchScreenAction<BuzzerMenu>>,
espgui::SwitchScreenAction<BuzzerMenu>
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<BuzzerMenu>>,
espgui::BackActionInterface<espgui::SwitchScreenAction<BuzzerMenu>>
>;
using ReverseBeepFreq1ChangeScreen = espgui::makeComponent<
BobbyChangeValueDisplay<uint8_t>,
espgui::StaticText<TEXT_REVERSEBEEPFREQ1>,
ReverseBeepFreq1Accessor,
espgui::BackActionInterface<espgui::SwitchScreenAction<BuzzerMenu>>,
espgui::SwitchScreenAction<BuzzerMenu>
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<BuzzerMenu>>,
espgui::BackActionInterface<espgui::SwitchScreenAction<BuzzerMenu>>
>;
using ReverseBeepDuration0ChangeScreen = espgui::makeComponent<
BobbyChangeValueDisplay<int16_t>,
espgui::StaticText<TEXT_REVERSEBEEPDURATION0>,
ReverseBeepDuration0Accessor,
espgui::BackActionInterface<espgui::SwitchScreenAction<BuzzerMenu>>,
espgui::SwitchScreenAction<BuzzerMenu>
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<BuzzerMenu>>,
espgui::BackActionInterface<espgui::SwitchScreenAction<BuzzerMenu>>
>;
using ReverseBeepDuration1ChangeScreen = espgui::makeComponent<
BobbyChangeValueDisplay<int16_t>,
espgui::StaticText<TEXT_REVERSEBEEPDURATION1>,
ReverseBeepDuration1Accessor,
espgui::BackActionInterface<espgui::SwitchScreenAction<BuzzerMenu>>,
espgui::SwitchScreenAction<BuzzerMenu>
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<BuzzerMenu>>,
espgui::BackActionInterface<espgui::SwitchScreenAction<BuzzerMenu>>
>;
} // namespace

View File

@ -24,8 +24,8 @@ using CloudTransmitTimeoutChangeScreen = espgui::makeComponent<
BobbyChangeValueDisplay<int16_t>,
espgui::StaticText<TEXT_CLOUDTRANSMITTIMEOUT>,
CloudTransmitTimeoutAccessor,
espgui::BackActionInterface<espgui::SwitchScreenAction<CloudSettingsMenu>>,
espgui::SwitchScreenAction<CloudSettingsMenu>
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<CloudSettingsMenu>>,
espgui::BackActionInterface<espgui::SwitchScreenAction<CloudSettingsMenu>>
>;
struct CloudBufferLengthText : public virtual espgui::TextInterface
@ -41,16 +41,16 @@ using CloudCollectRateChangeDisplay = espgui::makeComponent<
BobbyChangeValueDisplay<int16_t>,
espgui::StaticText<TEXT_CLOUDCOLLECTRATE>,
CloudCollectRateAccessor,
espgui::BackActionInterface<espgui::SwitchScreenAction<CloudSettingsMenu>>,
espgui::SwitchScreenAction<CloudSettingsMenu>
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<CloudSettingsMenu>>,
espgui::BackActionInterface<espgui::SwitchScreenAction<CloudSettingsMenu>>
>;
using CloudSendRateChangeDisplay = espgui::makeComponent<
BobbyChangeValueDisplay<int16_t>,
espgui::StaticText<TEXT_CLOUDSENDRATE>,
CloudSendRateAccessor,
espgui::BackActionInterface<espgui::SwitchScreenAction<CloudSettingsMenu>>,
espgui::SwitchScreenAction<CloudSettingsMenu>
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<CloudSettingsMenu>>,
espgui::BackActionInterface<espgui::SwitchScreenAction<CloudSettingsMenu>>
>;
} // namespace

View File

@ -24,38 +24,38 @@ using WheelDiameterMmChangeScreen = espgui::makeComponent<
BobbyChangeValueDisplay<int16_t>,
espgui::StaticText<TEXT_WHEELDIAMETERMM>,
WheelDiameterMmAccessor,
espgui::BackActionInterface<espgui::SwitchScreenAction<ControllerHardwareSettingsMenu>>,
espgui::SwitchScreenAction<ControllerHardwareSettingsMenu>
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<ControllerHardwareSettingsMenu>>,
espgui::BackActionInterface<espgui::SwitchScreenAction<ControllerHardwareSettingsMenu>>
>;
using WheelDiameterInchChangeScreen = espgui::makeComponent<
BobbyChangeValueDisplay<float>,
espgui::StaticText<TEXT_WHEELDIAMETERINCH>,
WheelDiameterInchAccessor,
espgui::RatioNumberStep<float, std::ratio<1,10>>,
espgui::BackActionInterface<espgui::SwitchScreenAction<ControllerHardwareSettingsMenu>>,
espgui::SwitchScreenAction<ControllerHardwareSettingsMenu>
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<ControllerHardwareSettingsMenu>>,
espgui::BackActionInterface<espgui::SwitchScreenAction<ControllerHardwareSettingsMenu>>
>;
using NumMagnetPolesChangeScreen = espgui::makeComponent<
BobbyChangeValueDisplay<int16_t>,
espgui::StaticText<TEXT_NUMMAGNETPOLES>,
NumMagnetPolesAccessor,
espgui::BackActionInterface<espgui::SwitchScreenAction<ControllerHardwareSettingsMenu>>,
espgui::SwitchScreenAction<ControllerHardwareSettingsMenu>
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<ControllerHardwareSettingsMenu>>,
espgui::BackActionInterface<espgui::SwitchScreenAction<ControllerHardwareSettingsMenu>>
>;
#ifdef FEATURE_CAN
using CanTransmitTimeoutChangeScreen = espgui::makeComponent<
BobbyChangeValueDisplay<int16_t>,
espgui::StaticText<TEXT_CANTRANSMITTIMEOUT>,
CanTransmitTimeoutAccessor,
espgui::BackActionInterface<espgui::SwitchScreenAction<ControllerHardwareSettingsMenu>>,
espgui::SwitchScreenAction<ControllerHardwareSettingsMenu>
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<ControllerHardwareSettingsMenu>>,
espgui::BackActionInterface<espgui::SwitchScreenAction<ControllerHardwareSettingsMenu>>
>;
using CanReceiveTimeoutChangeScreen = espgui::makeComponent<
BobbyChangeValueDisplay<int16_t>,
espgui::StaticText<TEXT_CANRECEIVETIMEOUT>,
CanReceiveTimeoutAccessor,
espgui::BackActionInterface<espgui::SwitchScreenAction<ControllerHardwareSettingsMenu>>,
espgui::SwitchScreenAction<ControllerHardwareSettingsMenu>
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<ControllerHardwareSettingsMenu>>,
espgui::BackActionInterface<espgui::SwitchScreenAction<ControllerHardwareSettingsMenu>>
>;
#endif
} // namespace

View File

@ -28,7 +28,7 @@
#include "displays/menus/dynamicdebugmenu.h"
#include "displays/menus/mainmenu.h"
#include "displays/menus/batterydebugmenu.h"
#include "displays/popups/alertdisplay.cpp"
#include "bobbyerrorhandler.h"
namespace {
class AlertAction : public espgui::MenuItem
@ -37,9 +37,7 @@ public:
std::string text() const override { return "Open popup"; }
void triggered() override
{
auto newDisplay = std::make_unique<AlertDisplay>("Das\nist\nein sehr langer text, der nicht in eine zeile passt", std::move(currentDisplay));
newDisplay->initOverlay();
currentDisplay = std::move(newDisplay);
BobbyErrorHandler{}.errorOccured("Das\nist\nein sehr langer text, der nicht in eine zeile passt");
}
};
} // namespace

View File

@ -37,78 +37,78 @@ using DefaultModeSmoothingChangeDisplay = espgui::makeComponent<
BobbyChangeValueDisplay<int16_t>,
espgui::StaticText<TEXT_SMOOTHINGVAL>,
DefaultModeSmoothingAccessor,
espgui::BackActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>,
espgui::SwitchScreenAction<DefaultModeSettingsMenu>
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>,
espgui::BackActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>
>;
using DefaultModeFwSmoothingLowerLimitChangeDisplay = espgui::makeComponent<
BobbyChangeValueDisplay<int16_t>,
espgui::StaticText<TEXT_FWSMOOTHING_LIMIT>,
DefaultModeEnableFieldWeakSmoothingLowerLimitAccessor,
espgui::BackActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>,
espgui::SwitchScreenAction<DefaultModeSettingsMenu>
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>,
espgui::BackActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>
>;
using DefaultModeFrontPercentageChangeDisplay = espgui::makeComponent<
BobbyChangeValueDisplay<int16_t>,
espgui::StaticText<TEXT_FRONTPERCENTAGE>,
DefaultModeFrontPercentageAccessor,
espgui::BackActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>,
espgui::SwitchScreenAction<DefaultModeSettingsMenu>
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>,
espgui::BackActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>
>;
using DefaultModeBackPercentageChangeDisplay = espgui::makeComponent<
BobbyChangeValueDisplay<int16_t>,
espgui::StaticText<TEXT_BACKPERCENTAGE>,
DefaultModeBackPercentageAccessor,
espgui::BackActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>,
espgui::SwitchScreenAction<DefaultModeSettingsMenu>
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>,
espgui::BackActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>
>;
using DefaultModeAddSchwelleChangeDisplay = espgui::makeComponent<
BobbyChangeValueDisplay<int16_t>,
espgui::StaticText<TEXT_ADDSCHWELLE>,
DefaultModeAddSchwelleAccessor,
espgui::BackActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>,
espgui::SwitchScreenAction<DefaultModeSettingsMenu>
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>,
espgui::BackActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>
>;
using DefaultModeGas1WertChangeDisplay = espgui::makeComponent<
BobbyChangeValueDisplay<int16_t>,
espgui::StaticText<TEXT_ADDGASVAL>,
DefaultModeGas1WertAccessor,
espgui::BackActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>,
espgui::SwitchScreenAction<DefaultModeSettingsMenu>
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>,
espgui::BackActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>
>;
using DefaultModeGas2WertChangeDisplay = espgui::makeComponent<
BobbyChangeValueDisplay<int16_t>,
espgui::StaticText<TEXT_SUBGASVAL>,
DefaultModeGas2WertAccessor,
espgui::BackActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>,
espgui::SwitchScreenAction<DefaultModeSettingsMenu>
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>,
espgui::BackActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>
>;
using DefaultModeBrems1WertChangeDisplay = espgui::makeComponent<
BobbyChangeValueDisplay<int16_t>,
espgui::StaticText<TEXT_ADDBRAKEVAL>,
DefaultModeBrems1WertAccessor,
espgui::BackActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>,
espgui::SwitchScreenAction<DefaultModeSettingsMenu>
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>,
espgui::BackActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>
>;
using DefaultModeBrems2WertChangeDisplay = espgui::makeComponent<
BobbyChangeValueDisplay<int16_t>,
espgui::StaticText<TEXT_SUBBRAKEVAL>,
DefaultModeBrems2WertAccessor,
espgui::BackActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>,
espgui::SwitchScreenAction<DefaultModeSettingsMenu>
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>,
espgui::BackActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>
>;
using DefaultModeHybridActivationLimitChangeDisplay = espgui::makeComponent<
BobbyChangeValueDisplay<int16_t>,
espgui::StaticText<TEXT_HYBRIDACTIVATIONLIMIT>,
DefaultModeHybridActivationLimitAccessor,
espgui::BackActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>,
espgui::SwitchScreenAction<DefaultModeSettingsMenu>
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>,
espgui::BackActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>
>;
using DefaultModeHybridDeactivationLimitChangeDisplay = espgui::makeComponent<
BobbyChangeValueDisplay<int16_t>,
espgui::StaticText<TEXT_HYBRIDDEACTIVATIONLIMIT>,
DefaultModeHybridDeactivationLimitAccessor,
espgui::BackActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>,
espgui::SwitchScreenAction<DefaultModeSettingsMenu>
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>,
espgui::BackActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>
>;
} // namespace

View File

@ -21,8 +21,8 @@ using HandBremsTriggerTimeoutChangeValueDisplay = espgui::makeComponent<
BobbyChangeValueDisplay<uint16_t>,
espgui::StaticText<TEXT_HANDBREMSE_TRIGGERTIMEOUT>,
HandbremsTimeoutAccessor,
espgui::BackActionInterface<espgui::SwitchScreenAction<HandbremsSettingsMenu>>,
espgui::SwitchScreenAction<HandbremsSettingsMenu>
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<HandbremsSettingsMenu>>,
espgui::BackActionInterface<espgui::SwitchScreenAction<HandbremsSettingsMenu>>
>;
using HandBremsModeChangeValueDisplay = espgui::makeComponent<
BobbyChangeValueDisplay<HandbremseMode>,

View File

@ -33,8 +33,8 @@ using LarsmModeIterationsChangeDisplay = espgui::makeComponent<
BobbyChangeValueDisplay<uint8_t>,
espgui::StaticText<TEXT_SETITERATIONS>,
LarsmModeIterationsAccessor,
espgui::BackActionInterface<espgui::SwitchScreenAction<LarsmModeSettingsMenu>>,
espgui::SwitchScreenAction<LarsmModeSettingsMenu>
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<LarsmModeSettingsMenu>>,
espgui::BackActionInterface<espgui::SwitchScreenAction<LarsmModeSettingsMenu>>
>;
} // namespace

View File

@ -30,72 +30,72 @@ using LedsCountChangeScreen = espgui::makeComponent<
BobbyChangeValueDisplay<int16_t>,
espgui::StaticText<TEXT_LEDSCOUNT>,
LedsCountAccessor,
espgui::BackActionInterface<espgui::SwitchScreenAction<LedstripMenu>>,
espgui::SwitchScreenAction<LedstripMenu>
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<LedstripMenu>>,
espgui::BackActionInterface<espgui::SwitchScreenAction<LedstripMenu>>
>;
using CenterOffsetChangeScreen = espgui::makeComponent<
BobbyChangeValueDisplay<int16_t>,
espgui::StaticText<TEXT_CENTEROFFSET>,
CenterOffsetAccessor,
espgui::BackActionInterface<espgui::SwitchScreenAction<LedstripMenu>>,
espgui::SwitchScreenAction<LedstripMenu>
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<LedstripMenu>>,
espgui::BackActionInterface<espgui::SwitchScreenAction<LedstripMenu>>
>;
using SmallOffsetChangeScreen = espgui::makeComponent<
BobbyChangeValueDisplay<int16_t>,
espgui::StaticText<TEXT_SMALLOFFSET>,
SmallOffsetAccessor,
espgui::BackActionInterface<espgui::SwitchScreenAction<LedstripMenu>>,
espgui::SwitchScreenAction<LedstripMenu>
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<LedstripMenu>>,
espgui::BackActionInterface<espgui::SwitchScreenAction<LedstripMenu>>
>;
using BigOffsetChangeScreen = espgui::makeComponent<
BobbyChangeValueDisplay<int16_t>,
espgui::StaticText<TEXT_BIGOFFSET>,
BigOffsetAccessor,
espgui::BackActionInterface<espgui::SwitchScreenAction<LedstripMenu>>,
espgui::SwitchScreenAction<LedstripMenu>
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<LedstripMenu>>,
espgui::BackActionInterface<espgui::SwitchScreenAction<LedstripMenu>>
>;
using DeziampereChangeScreen = espgui::makeComponent<
BobbyChangeValueDisplay<int16_t>,
espgui::StaticText<TEXT_LEDSTRIP_MILLIAMP>,
DeziampereAccessor,
espgui::BackActionInterface<espgui::SwitchScreenAction<LedstripMenu>>,
espgui::SwitchScreenAction<LedstripMenu>
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<LedstripMenu>>,
espgui::BackActionInterface<espgui::SwitchScreenAction<LedstripMenu>>
>;
using StVOOffsetChangeScreen = espgui::makeComponent<
BobbyChangeValueDisplay<int16_t>,
espgui::StaticText<TEXT_STVO_FRONTOFFSET>,
LedsStVOFrontOffsetAccessor,
espgui::BackActionInterface<espgui::SwitchScreenAction<LedstripMenu>>,
espgui::SwitchScreenAction<LedstripMenu>
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<LedstripMenu>>,
espgui::BackActionInterface<espgui::SwitchScreenAction<LedstripMenu>>
>;
using StVOLengthChangeScreen = espgui::makeComponent<
BobbyChangeValueDisplay<int16_t>,
espgui::StaticText<TEXT_STVO_FRONTLENGTH>,
LedsStVOFrontLengthAccessor,
espgui::BackActionInterface<espgui::SwitchScreenAction<LedstripMenu>>,
espgui::SwitchScreenAction<LedstripMenu>
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<LedstripMenu>>,
espgui::BackActionInterface<espgui::SwitchScreenAction<LedstripMenu>>
>;
using animationMultiplierChangeScreen = espgui::makeComponent<
BobbyChangeValueDisplay<int16_t>,
espgui::StaticText<TEXT_ANIMATION_MULTIPLIER>,
AnimationMultiplierAccessor,
espgui::BackActionInterface<espgui::SwitchScreenAction<LedstripMenu>>,
espgui::SwitchScreenAction<LedstripMenu>
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<LedstripMenu>>,
espgui::BackActionInterface<espgui::SwitchScreenAction<LedstripMenu>>
>;
using ledstripBrightnessChangeScreen = espgui::makeComponent<
BobbyChangeValueDisplay<uint8_t>,
espgui::StaticText<TEXT_LEDSTRIP_BRIGHTNESS>,
LedstripBrightnessAccessor,
espgui::BackActionInterface<espgui::SwitchScreenAction<LedstripMenu>>,
espgui::SwitchScreenAction<LedstripMenu>
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<LedstripMenu>>,
espgui::BackActionInterface<espgui::SwitchScreenAction<LedstripMenu>>
>;
class AllCustomLedsOffAction : public virtual espgui::ActionInterface

View File

@ -18,43 +18,43 @@ using IMotMaxChangeScreen = espgui::makeComponent<
BobbyChangeValueDisplay<int16_t>,
espgui::StaticText<TEXT_IMOTMAX>,
IMotMaxAccessor,
espgui::BackActionInterface<espgui::SwitchScreenAction<LimitsSettingsMenu>>,
espgui::SwitchScreenAction<LimitsSettingsMenu>
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<LimitsSettingsMenu>>,
espgui::BackActionInterface<espgui::SwitchScreenAction<LimitsSettingsMenu>>
>;
using IDcMaxChangeScreen = espgui::makeComponent<
BobbyChangeValueDisplay<int16_t>,
espgui::StaticText<TEXT_IDCMAX>,
IDcMaxAccessor,
espgui::BackActionInterface<espgui::SwitchScreenAction<LimitsSettingsMenu>>,
espgui::SwitchScreenAction<LimitsSettingsMenu>
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<LimitsSettingsMenu>>,
espgui::BackActionInterface<espgui::SwitchScreenAction<LimitsSettingsMenu>>
>;
using NMotMaxKmhChangeScreen = espgui::makeComponent<
BobbyChangeValueDisplay<int16_t>,
espgui::StaticText<TEXT_NMOTMAXKMH>,
NMotMaxKmhAccessor,
espgui::BackActionInterface<espgui::SwitchScreenAction<LimitsSettingsMenu>>,
espgui::SwitchScreenAction<LimitsSettingsMenu>
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<LimitsSettingsMenu>>,
espgui::BackActionInterface<espgui::SwitchScreenAction<LimitsSettingsMenu>>
>;
using NMotMaxRpmChangeScreen = espgui::makeComponent<
BobbyChangeValueDisplay<int16_t>,
espgui::StaticText<TEXT_NMOTMAX>,
NMotMaxRpmAccessor,
espgui::BackActionInterface<espgui::SwitchScreenAction<LimitsSettingsMenu>>,
espgui::SwitchScreenAction<LimitsSettingsMenu>
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<LimitsSettingsMenu>>,
espgui::BackActionInterface<espgui::SwitchScreenAction<LimitsSettingsMenu>>
>;
using FieldWeakMaxChangeScreen = espgui::makeComponent<
BobbyChangeValueDisplay<int16_t>,
espgui::StaticText<TEXT_FIELDWEAKMAX>,
FieldWeakMaxAccessor,
espgui::BackActionInterface<espgui::SwitchScreenAction<LimitsSettingsMenu>>,
espgui::SwitchScreenAction<LimitsSettingsMenu>
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<LimitsSettingsMenu>>,
espgui::BackActionInterface<espgui::SwitchScreenAction<LimitsSettingsMenu>>
>;
using PhaseAdvMaxChangeScreen = espgui::makeComponent<
BobbyChangeValueDisplay<int16_t>,
espgui::StaticText<TEXT_PHASEADVMAX>,
PhaseAdvMaxAccessor,
espgui::BackActionInterface<espgui::SwitchScreenAction<LimitsSettingsMenu>>,
espgui::SwitchScreenAction<LimitsSettingsMenu>
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<LimitsSettingsMenu>>,
espgui::BackActionInterface<espgui::SwitchScreenAction<LimitsSettingsMenu>>
>;
} // namespace

View File

@ -20,32 +20,32 @@ using LockscreenPinDigit0ChangeScreen = espgui::makeComponent<
BobbyChangeValueDisplay<int8_t>,
espgui::StaticText<TEXT_PINDIGIT0>,
LockscreenPinDigitAccessor<0>,
espgui::BackActionInterface<espgui::SwitchScreenAction<LockscreenSettingsMenu>>,
espgui::SwitchScreenAction<LockscreenSettingsMenu>
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<LockscreenSettingsMenu>>,
espgui::BackActionInterface<espgui::SwitchScreenAction<LockscreenSettingsMenu>>
>;
using LockscreenPinDigit1ChangeScreen = espgui::makeComponent<
BobbyChangeValueDisplay<int8_t>,
espgui::StaticText<TEXT_PINDIGIT1>,
LockscreenPinDigitAccessor<1>,
espgui::BackActionInterface<espgui::SwitchScreenAction<LockscreenSettingsMenu>>,
espgui::SwitchScreenAction<LockscreenSettingsMenu>
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<LockscreenSettingsMenu>>,
espgui::BackActionInterface<espgui::SwitchScreenAction<LockscreenSettingsMenu>>
>;
using LockscreenPinDigit2ChangeScreen = espgui::makeComponent<
BobbyChangeValueDisplay<int8_t>,
espgui::StaticText<TEXT_PINDIGIT2>,
LockscreenPinDigitAccessor<2>,
espgui::BackActionInterface<espgui::SwitchScreenAction<LockscreenSettingsMenu>>,
espgui::SwitchScreenAction<LockscreenSettingsMenu>
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<LockscreenSettingsMenu>>,
espgui::BackActionInterface<espgui::SwitchScreenAction<LockscreenSettingsMenu>>
>;
using LockscreenPinDigit3ChangeScreen = espgui::makeComponent<
BobbyChangeValueDisplay<int8_t>,
espgui::StaticText<TEXT_PINDIGIT3>,
LockscreenPinDigitAccessor<3>,
espgui::BackActionInterface<espgui::SwitchScreenAction<LockscreenSettingsMenu>>,
espgui::SwitchScreenAction<LockscreenSettingsMenu>
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<LockscreenSettingsMenu>>,
espgui::BackActionInterface<espgui::SwitchScreenAction<LockscreenSettingsMenu>>
>;
} // namespace

View File

@ -14,7 +14,7 @@ class GPIOAccessor : public virtual espgui::AccessorInterface<bool>
{
public:
bool getValue() const override { return digitalRead(PIN); }
void setValue(bool value) override { digitalWrite(PIN, value ? HIGH : LOW); }
espgui::AccessorInterface<bool>::setter_result_t setValue(bool value) override { digitalWrite(PIN, value ? HIGH : LOW); return {}; }
};
using Mosfet0Accessor = GPIOAccessor<PINS_MOSFET0>;

View File

@ -17,16 +17,16 @@ using MotortestMultiplikatorChangeDisplay = espgui::makeComponent<
BobbyChangeValueDisplay<uint8_t>,
espgui::StaticText<TEXT_MOTORTESTMULTIPLIKATOR>,
MotortestModeMultiplikatorAccessor,
espgui::BackActionInterface<espgui::SwitchScreenAction<MotortestModeSettingsMenu>>,
espgui::SwitchScreenAction<MotortestModeSettingsMenu>
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<MotortestModeSettingsMenu>>,
espgui::BackActionInterface<espgui::SwitchScreenAction<MotortestModeSettingsMenu>>
>;
using MotortestMaxPwmChangeDisplay = espgui::makeComponent<
BobbyChangeValueDisplay<uint16_t>,
espgui::StaticText<TEXT_MOTORTESTMAXPWM>,
MotortestMaxPwmAccessor,
espgui::BackActionInterface<espgui::SwitchScreenAction<MotortestModeSettingsMenu>>,
espgui::SwitchScreenAction<MotortestModeSettingsMenu>
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<MotortestModeSettingsMenu>>,
espgui::BackActionInterface<espgui::SwitchScreenAction<MotortestModeSettingsMenu>>
>;
} // namespace

View File

@ -49,7 +49,7 @@ namespace {
struct BacklightAccessor : public virtual espgui::AccessorInterface<bool>
{
bool getValue() const override { return digitalRead(PINS_LEDBACKLIGHT) != ledBacklightInverted; }
void setValue(bool value) override { digitalWrite(PINS_LEDBACKLIGHT, value != ledBacklightInverted); }
espgui::AccessorInterface<bool>::setter_result_t setValue(bool value) override { digitalWrite(PINS_LEDBACKLIGHT, value != ledBacklightInverted); return {}; }
};
#endif
struct FrontLedAccessor : public espgui::RefAccessor<bool> { bool &getRef() const override { return controllers.front.command.led; } };

View File

@ -21,8 +21,8 @@ using TempomatModeCruiseMotTgtChangeDisplay = espgui::makeComponent<
BobbyChangeValueDisplay<int16_t>,
espgui::StaticText<TEXT_NCRUISEMOTTGT>,
TempomatModeCruiseMotTgtAccessor,
espgui::BackActionInterface<espgui::SwitchScreenAction<TempomatModeSettingsMenu>>,
espgui::SwitchScreenAction<TempomatModeSettingsMenu>
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<TempomatModeSettingsMenu>>,
espgui::BackActionInterface<espgui::SwitchScreenAction<TempomatModeSettingsMenu>>
>;
using TempomatModeModelModeChangeScreen = espgui::makeComponent<

View File

@ -16,8 +16,8 @@ using StatsUpdateRateChangeDisplay = espgui::makeComponent<
BobbyChangeValueDisplay<int16_t>,
espgui::StaticText<TEXT_STATSUPDATERATE>,
StatsUpdateRateAccessor,
espgui::BackActionInterface<espgui::SwitchScreenAction<TimersMenu>>,
espgui::SwitchScreenAction<TimersMenu>
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<TimersMenu>>,
espgui::BackActionInterface<espgui::SwitchScreenAction<TimersMenu>>
>;
}

View File

@ -48,8 +48,8 @@ using TimezoneOffsetChangeDisplay = espgui::makeComponent<
BobbyChangeValueDisplay<int32_t>,
espgui::StaticText<TEXT_OFFSET>,
TimezoneOffsetAccessor,
espgui::BackActionInterface<espgui::SwitchScreenAction<TimeSettingsMenu>>,
espgui::SwitchScreenAction<TimeSettingsMenu>
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<TimeSettingsMenu>>,
espgui::BackActionInterface<espgui::SwitchScreenAction<TimeSettingsMenu>>
>;
using DaylightSavingModeChangeDisplay = espgui::makeComponent<
@ -73,8 +73,8 @@ using TimeSyncIntervalChangeDisplay = espgui::makeComponent<
BobbyChangeValueDisplay<int32_t>,
espgui::StaticText<TEXT_NTPINTERVAL>,
TimeSyncIntervalAccessor,
espgui::BackActionInterface<espgui::SwitchScreenAction<TimeSettingsMenu>>,
espgui::SwitchScreenAction<TimeSettingsMenu>
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<TimeSettingsMenu>>,
espgui::BackActionInterface<espgui::SwitchScreenAction<TimeSettingsMenu>>
>;
class NtpSyncStatusText : public virtual espgui::TextInterface

View File

@ -21,8 +21,8 @@ using UdpCloudSendRateChangeDisplay = espgui::makeComponent<
BobbyChangeValueDisplay<int16_t>,
espgui::StaticText<TEXT_UDPSENDRATE>,
UdpCloudSendIntervalAccessor,
espgui::BackActionInterface<espgui::SwitchScreenAction<UdpCloudSettingsMenu>>,
espgui::SwitchScreenAction<UdpCloudSettingsMenu>
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<UdpCloudSettingsMenu>>,
espgui::BackActionInterface<espgui::SwitchScreenAction<UdpCloudSettingsMenu>>
>;
} // namespace

View File

@ -55,8 +55,8 @@ using ApChannelChangeScreen = espgui::makeComponent<
BobbyChangeValueDisplay<uint8_t>,
espgui::StaticText<TEXT_CHANNEL>,
WifiApChannelAccessor,
espgui::BackActionInterface<espgui::SwitchScreenAction<WifiApSettingsMenu>>,
espgui::SwitchScreenAction<WifiApSettingsMenu>
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<WifiApSettingsMenu>>,
espgui::BackActionInterface<espgui::SwitchScreenAction<WifiApSettingsMenu>>
>;
using ApAuthmodeChangeScreen = espgui::makeComponent<

View File

@ -1,105 +0,0 @@
#include "alertdisplay.h"
// 3rdparty lib includes
#include <tftinstance.h>
#include <screenmanager.h>
#include <cppmacros.h>
AlertDisplay::AlertDisplay(std::string &&message, std::unique_ptr<Display> &&lastDisplay) :
m_message{std::move(message)}, m_lastDisplay{std::move(lastDisplay)}
{
}
void AlertDisplay::initScreen()
{
m_lastDisplay->initScreen();
initOverlay();
}
void AlertDisplay::buttonPressed(espgui::Button button)
{
Base::buttonPressed(button);
switch (button)
{
using espgui::Button;
case Button::Left:
case Button::Right:
closeOverlay();
break;
default:;
}
}
void AlertDisplay::initOverlay()
{
constexpr auto leftMargin = 20;
constexpr auto rightMargin = leftMargin;
constexpr auto topMargin = 50;
constexpr auto bottomMargin = topMargin;
const auto width = espgui::tft.width() - leftMargin - rightMargin;
const auto height = espgui::tft.height() - topMargin - bottomMargin;
const auto right = espgui::tft.width() - rightMargin;
const auto bottom = espgui::tft.height() - bottomMargin;
CPP_UNUSED(right)
//espgui::tft.drawRect(leftMargin, topMargin, espgui::tft.width() - leftMargin - rightMargin, espgui::tft.height() - topMargin - bottomMargin, TFT_WHITE);
//espgui::tft.fillRect(leftMargin + 1, topMargin + 1, espgui::tft.width() - leftMargin - rightMargin - 2, espgui::tft.height() - topMargin - bottomMargin - 2, TFT_BLACK);
espgui::tft.drawSunkenRect(leftMargin, topMargin, width, height,
color565(240, 240, 240),
color565(100, 100, 100),
color565(30, 30, 30));
espgui::tft.setTextColor(TFT_WHITE, color565(30, 30, 30));
int x = leftMargin + 5;
int y = topMargin + 5;
for (char c : m_message)
{
if (c == '\n' || x > espgui::tft.width() - rightMargin - 10)
{
x = leftMargin + 5;
y += espgui::tft.fontHeight(4);
}
if (c != '\n')
{
const auto addedWidth = espgui::tft.drawChar(espgui::tft.decodeUTF8(c), x, y, 4);
x += addedWidth;
}
if (y >= espgui::tft.height() - bottomMargin)
break;
}
espgui::tft.setTextColor(TFT_BLACK, color565(170, 170, 170));
espgui::tft.drawSunkenRect(leftMargin + 15, bottom - 40,
(width - 15 - 10 - 15) / 2,
30,
color565(240, 240, 240),
color565(100, 100, 100),
color565(170, 170, 170));
espgui::tft.drawString("Yes", leftMargin + 18, bottom - 37);
espgui::tft.drawSunkenRect(leftMargin + 15 + ((width - 15 - 30 - 15) / 2) + 15, bottom - 40,
(width - 15 - 10 - 15) / 2,
30,
color565(240, 240, 240),
color565(100, 100, 100),
color565(170, 170, 170));
espgui::tft.drawString("No", leftMargin + 18 + ((width - 15 - 30 - 15) / 2) + 15 + 1, bottom - 37);
}
void AlertDisplay::closeOverlay()
{
auto guard = std::move(espgui::currentDisplay);
espgui::currentDisplay = std::move(m_lastDisplay);
espgui::currentDisplay->initScreen();
}

View File

@ -1,30 +0,0 @@
#pragma once
// system includes
#include <memory>
// local includes
#include "displays/bobbydisplay.h"
class AlertDisplay : public BobbyDisplay
{
using Base = BobbyDisplay;
public:
AlertDisplay(std::string &&message, std::unique_ptr<Display> &&lastDisplay);
//void start() override;
void initScreen() override;
//void update() override;
//void redraw() override;
//void stop() override;
void buttonPressed(espgui::Button button) override;
void initOverlay();
void closeOverlay();
private:
std::string m_message;
std::unique_ptr<Display> m_lastDisplay;
};