Made bluetooth related features optional to save some storage
This commit is contained in:
@ -20,7 +20,6 @@ platform_packages =
|
||||
lib_deps =
|
||||
TFT_eSPI
|
||||
https://github.com/Ferdi265/cxx-ring-buffer
|
||||
https://github.com/0xFEEDC0DE64/optional
|
||||
|
||||
lib_compat_mode = strict
|
||||
build_unflags =
|
||||
@ -152,7 +151,8 @@ build_flags =
|
||||
-DDEFAULT_GASMAX=3700
|
||||
-DDEFAULT_BREMSMIN=1300
|
||||
-DDEFAULT_BREMSMAX=4000
|
||||
-DFEATURE_BMS
|
||||
; -DFEATURE_BLUETOOTH
|
||||
; -DFEATURE_BMS
|
||||
; -DFEATURE_GAMETRAK
|
||||
; -DPINS_GAMETRAKX=34
|
||||
; -DPINS_GAMETRAKY=39
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include "globals.h"
|
||||
|
||||
namespace {
|
||||
#ifdef FEATURE_BLUETOOTH
|
||||
class BluetoothBeginAction : public virtual ActionInterface
|
||||
{
|
||||
public:
|
||||
@ -18,4 +19,5 @@ public:
|
||||
}
|
||||
}
|
||||
};
|
||||
#endif
|
||||
}
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include "globals.h"
|
||||
|
||||
namespace {
|
||||
#ifdef FEATURE_BLUETOOTH
|
||||
class BluetoothBeginMasterAction : public virtual ActionInterface
|
||||
{
|
||||
public:
|
||||
@ -18,4 +19,5 @@ public:
|
||||
}
|
||||
}
|
||||
};
|
||||
#endif
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
#include "globals.h"
|
||||
|
||||
namespace {
|
||||
#ifdef FEATURE_BMS
|
||||
#if defined(FEATURE_BLUETOOTH) && defined(FEATURE_BMS)
|
||||
class BluetoothConnectBmsAction : public virtual ActionInterface
|
||||
{
|
||||
public:
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include "globals.h"
|
||||
|
||||
namespace {
|
||||
#ifdef FEATURE_BLUETOOTH
|
||||
class BluetoothDisconnectAction : public virtual ActionInterface
|
||||
{
|
||||
public:
|
||||
@ -18,4 +19,5 @@ public:
|
||||
}
|
||||
}
|
||||
};
|
||||
#endif
|
||||
}
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include "globals.h"
|
||||
|
||||
namespace {
|
||||
#ifdef FEATURE_BLUETOOTH
|
||||
class BluetoothEndAction : public virtual ActionInterface
|
||||
{
|
||||
public:
|
||||
@ -12,4 +13,5 @@ public:
|
||||
bluetoothSerial.end();
|
||||
}
|
||||
};
|
||||
#endif
|
||||
}
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include "globals.h"
|
||||
|
||||
namespace {
|
||||
#ifdef FEATURE_BLUETOOTH
|
||||
class BluetoothFlushAction : public virtual ActionInterface
|
||||
{
|
||||
public:
|
||||
@ -12,4 +13,5 @@ public:
|
||||
bluetoothSerial.flush();
|
||||
}
|
||||
};
|
||||
#endif
|
||||
}
|
||||
|
@ -3,10 +3,12 @@
|
||||
#include <cstdint>
|
||||
|
||||
namespace {
|
||||
#ifdef FEATURE_BLUETOOTH
|
||||
enum class BluetoothMode : uint8_t
|
||||
{
|
||||
Off,
|
||||
Master,
|
||||
Slave
|
||||
};
|
||||
#endif
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include "utils.h"
|
||||
|
||||
namespace {
|
||||
#ifdef FEATURE_BLUETOOTH
|
||||
template<const char *Ttext, typename TreturnType, TreturnType (BluetoothSerial::*Tmethod)()>
|
||||
using BluetoothStatusTextHelper = StatusTextHelper<Ttext, BluetoothSerial, &bluetoothSerial, TreturnType, Tmethod>;
|
||||
|
||||
@ -34,4 +35,5 @@ class BluetoothIsReadyMasterText : public virtual TextInterface {
|
||||
public:
|
||||
String text() const override { return String{"isReady (M): "} + toString(bluetoothSerial.isReady(true)); }
|
||||
};
|
||||
#endif
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include "types.h"
|
||||
|
||||
namespace {
|
||||
#ifdef FEATURE_BMS
|
||||
#if defined(FEATURE_BLUETOOTH) && defined(FEATURE_BMS)
|
||||
namespace bms {
|
||||
constexpr auto autoReconnect = false; // causes hangs when not available
|
||||
|
||||
|
@ -136,7 +136,9 @@ void ChangeValueDisplay<Tvalue>::confirm()
|
||||
}
|
||||
|
||||
#include "changevaluedisplay_bool.h"
|
||||
#ifdef FEATURE_BLUETOOTH
|
||||
#include "changevaluedisplay_bluetoothmode.h"
|
||||
#endif
|
||||
#include "changevaluedisplay_controlmode.h"
|
||||
#include "changevaluedisplay_controltype.h"
|
||||
#include "changevaluedisplay_larsmmode_mode.h"
|
||||
|
@ -8,9 +8,12 @@
|
||||
#include "actions/backproxyaction.h"
|
||||
#include "icons/back.h"
|
||||
#include "texts.h"
|
||||
#ifdef FEATURE_BLUETOOTH
|
||||
#include "bluetoothmode.h"
|
||||
#endif
|
||||
|
||||
namespace {
|
||||
#ifdef FEATURE_BLUETOOTH
|
||||
template<>
|
||||
class ChangeValueDisplay<BluetoothMode> :
|
||||
public MenuDisplay,
|
||||
@ -83,4 +86,5 @@ void ChangeValueDisplay<BluetoothMode>::start()
|
||||
setSelectedIndex(4);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ class MetersDisplay;
|
||||
class StatusDisplay;
|
||||
}
|
||||
namespace {
|
||||
#ifdef FEATURE_BMS
|
||||
#if defined(FEATURE_BLUETOOTH) && defined(FEATURE_BMS)
|
||||
class BmsDisplay : public Display, public ConfirmActionInterface<SwitchScreenAction<MainMenu>>, public DummyBack
|
||||
{
|
||||
public:
|
||||
|
@ -5,11 +5,13 @@
|
||||
#include "staticmenudefinition.h"
|
||||
#include "menuitem.h"
|
||||
#include "actions/dummyaction.h"
|
||||
#ifdef FEATURE_BLUETOOTH
|
||||
#include "actions/bluetoothbeginaction.h"
|
||||
#include "actions/bluetoothbeginmasteraction.h"
|
||||
#include "actions/bluetoothflushaction.h"
|
||||
#include "actions/bluetoothendaction.h"
|
||||
#include "actions/bluetoothdisconnectaction.h"
|
||||
#endif
|
||||
#include "actions/switchscreenaction.h"
|
||||
#include "bluetoothtexthelpers.h"
|
||||
#include "settingsaccessors.h"
|
||||
@ -21,6 +23,7 @@ class SettingsMenu;
|
||||
}
|
||||
|
||||
namespace {
|
||||
#ifdef FEATURE_BLUETOOTH
|
||||
class BluetoothSettingsMenu;
|
||||
|
||||
using AutoBluetoothModeChangeDisplay = makeComponent<
|
||||
@ -50,4 +53,5 @@ class BluetoothSettingsMenu :
|
||||
makeComponent<MenuItem, StaticText<TEXT_BACK>, SwitchScreenAction<SettingsMenu>, StaticMenuItemIcon<&icons::back>>
|
||||
>
|
||||
{};
|
||||
#endif
|
||||
}
|
||||
|
@ -4,8 +4,10 @@
|
||||
#include "staticmenudefinition.h"
|
||||
#include "utils.h"
|
||||
#include "menuitem.h"
|
||||
#ifdef FEATURE_BLUETOOTH
|
||||
#include "actions/bluetoothconnectbmsaction.h"
|
||||
#include "actions/bluetoothdisconnectaction.h"
|
||||
#endif
|
||||
#include "actions/dummyaction.h"
|
||||
#include "actions/bmsturnonchargeaction.h"
|
||||
#include "actions/bmsturnoffchargeaction.h"
|
||||
@ -21,7 +23,7 @@ class MainMenu;
|
||||
}
|
||||
|
||||
namespace {
|
||||
#ifdef FEATURE_BMS
|
||||
#if defined(FEATURE_BLUETOOTH) && defined(FEATURE_BMS)
|
||||
class BmsMenu :
|
||||
public MenuDisplay,
|
||||
public StaticText<TEXT_BMS>,
|
||||
|
@ -9,7 +9,9 @@
|
||||
#include "actions/switchscreenaction.h"
|
||||
#include "checkboxicon.h"
|
||||
#include "icons/wifi.h"
|
||||
#ifdef FEATURE_BLUETOOTH
|
||||
#include "icons/bluetooth.h"
|
||||
#endif
|
||||
#include "icons/hardware.h"
|
||||
#include "icons/buzzer.h"
|
||||
#include "icons/info.h"
|
||||
@ -40,11 +42,13 @@ class SettingsMenu :
|
||||
public StaticMenuDefinition<
|
||||
makeComponent<MenuItem, StaticText<TEXT_LIMITSSETTINGS>, SwitchScreenAction<LimitsSettingsMenu>>,
|
||||
makeComponent<MenuItem, StaticText<TEXT_WIFISETTINGS>, SwitchScreenAction<WifiSettingsMenu>, StaticMenuItemIcon<&icons::wifi>>,
|
||||
#ifdef FEATURE_BLUETOOTH
|
||||
makeComponent<MenuItem, StaticText<TEXT_BLUETOOTHSETTINGS>, SwitchScreenAction<BluetoothSettingsMenu>, StaticMenuItemIcon<&icons::bluetooth>>,
|
||||
#endif
|
||||
makeComponent<MenuItem, StaticText<TEXT_MODESSETTINGS>, SwitchScreenAction<ModesSettingsMenu>>,
|
||||
makeComponent<MenuItem, StaticText<TEXT_CONTROLLERHARDWARESETTINGS>, SwitchScreenAction<ControllerHardwareSettingsMenu>, StaticMenuItemIcon<&icons::hardware>>,
|
||||
makeComponent<MenuItem, StaticText<TEXT_BOARDCOMPUTERHARDWARESETTINGS>, SwitchScreenAction<BoardcomputerHardwareSettingsMenu>, StaticMenuItemIcon<&icons::hardware>>,
|
||||
#ifdef FEATURE_BMS
|
||||
#if defined(FEATURE_BLUETOOTH) && defined(FEATURE_BMS)
|
||||
makeComponent<MenuItem, StaticText<TEXT_AUTOCONNECTBMS>, ToggleBoolAction, CheckboxIcon, AutoConnectBmsAccessor>,
|
||||
#endif
|
||||
makeComponent<MenuItem, StaticText<TEXT_BUZZER>, SwitchScreenAction<BuzzerMenu>, StaticMenuItemIcon<&icons::buzzer>>,
|
||||
|
@ -2,7 +2,9 @@
|
||||
|
||||
#include <array>
|
||||
|
||||
#ifdef FEATURE_BLUETOOTH
|
||||
#include <BluetoothSerial.h>
|
||||
#endif
|
||||
#include <WiFiType.h>
|
||||
#include <TFT_eSPI.h>
|
||||
#include <SPI.h>
|
||||
@ -57,7 +59,9 @@ struct {
|
||||
int last{0};
|
||||
} performance;
|
||||
|
||||
#ifdef FEATURE_BLUETOOTH
|
||||
BluetoothSerial bluetoothSerial;
|
||||
#endif
|
||||
|
||||
TFT_eSPI tft = TFT_eSPI();
|
||||
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
namespace {
|
||||
namespace icons {
|
||||
#ifdef FEATURE_BLUETOOTH
|
||||
const Icon<24, 24> bluetooth{{
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x120F, 0x1A50, 0x0000, 0x01CF, 0x2AB1, 0x3B12, 0x4333, 0x4333, 0x3AF2, 0x2AB1, 0x01EF, // 0x0010 (16) pixels
|
||||
0x0000, 0x1A50, 0x1210, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1210, 0x018E, 0x0007, 0x2AB1, // 0x0020 (32) pixels
|
||||
@ -42,5 +43,6 @@ const Icon<24, 24> bluetooth{{
|
||||
0x19ED, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0x0230 (560) pixels
|
||||
0x00A6, 0x21EC, 0x2A6F, 0x32B1, 0x32B1, 0x2A6F, 0x19EC, 0x00A6, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0x0240 (576) pixels
|
||||
}};
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -23,9 +23,11 @@
|
||||
#include "presets.h"
|
||||
#include "statistics.h"
|
||||
#include "actions/wifisoftapaction.h"
|
||||
#ifdef FEATURE_BLUETOOTH
|
||||
#include "actions/bluetoothbeginaction.h"
|
||||
#include "actions/bluetoothbeginmasteraction.h"
|
||||
#include "actions/bluetoothconnectbmsaction.h"
|
||||
#endif
|
||||
#include "bobby_webserver.h"
|
||||
#include "types.h"
|
||||
|
||||
@ -123,6 +125,7 @@ void setup()
|
||||
if (!WiFi.begin("realraum", "r3alraum"))
|
||||
Serial.println("Could not begin WiFi");
|
||||
|
||||
#ifdef FEATURE_BLUETOOTH
|
||||
if (settings.bluetoothSettings.autoBluetoothMode == BluetoothMode::Master)
|
||||
{
|
||||
bootLabel.redraw("bluetooth begin master");
|
||||
@ -140,6 +143,7 @@ void setup()
|
||||
bootLabel.redraw("bluetooth begin");
|
||||
BluetoothBeginAction{}.triggered();
|
||||
}
|
||||
#endif
|
||||
|
||||
bootLabel.redraw("front Serial begin");
|
||||
controllers.front.serial.get().begin(38400, SERIAL_8N1, PINS_RX1, PINS_TX1);
|
||||
|
@ -56,9 +56,11 @@ constexpr Settings::WifiSettings defaultWifiSettings {
|
||||
.autoEnableAp = true
|
||||
};
|
||||
|
||||
#ifdef FEATURE_BLUETOOTH
|
||||
constexpr Settings::BluetoothSettings defaultBluetoothSettings {
|
||||
.autoBluetoothMode = BluetoothMode::Master
|
||||
};
|
||||
#endif
|
||||
|
||||
constexpr Settings::ControllerHardware spinnerControllerHardware {
|
||||
.enableFrontLeft = true,
|
||||
@ -156,7 +158,9 @@ constexpr Settings defaultSettings{
|
||||
.reverseBeepDuration1 = 500,
|
||||
.limits = defaultLimits,
|
||||
.wifiSettings = defaultWifiSettings,
|
||||
#ifdef FEATURE_BLUETOOTH
|
||||
.bluetoothSettings = defaultBluetoothSettings,
|
||||
#endif
|
||||
.controllerHardware = defaultControllerHardware,
|
||||
.boardcomputerHardware = defaultBoardcomputerHardware,
|
||||
.defaultMode = defaultDefaultMode,
|
||||
|
@ -1,10 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
#include <include/tl/optional.hpp>
|
||||
#include <optional>
|
||||
|
||||
#include "displays/menus/aboutmenu.h"
|
||||
#include "displays/menus/accesspointwifisettingsmenu.h"
|
||||
#ifdef FEATURE_BLUETOOTH
|
||||
#include "displays/menus/bluetoothsettingsmenu.h"
|
||||
#endif
|
||||
#include "displays/menus/bmsmenu.h"
|
||||
#include "displays/menus/buzzermenu.h"
|
||||
#include "displays/menus/commanddebugmenu.h"
|
||||
@ -64,9 +66,11 @@ union X {
|
||||
|
||||
AboutMenu aboutMenu;
|
||||
AccessPointWifiSettingsMenu accessPointWifiSettingsMenu;
|
||||
#ifdef FEATURE_BLUETOOTH
|
||||
BluetoothSettingsMenu bluetoothSettingsMenu;
|
||||
#ifdef FEATURE_BMS
|
||||
BmsMenu bmsMenu;
|
||||
#endif
|
||||
#endif
|
||||
BuzzerMenu buzzerMenu;
|
||||
FrontCommandDebugMenu frontCommandDebugMenu;
|
||||
@ -135,7 +139,9 @@ union X {
|
||||
|
||||
AutoWifiModeChangeDisplay autoWifiModeChangeDisplay;
|
||||
|
||||
#ifdef FEATURE_BLUETOOTH
|
||||
AutoBluetoothModeChangeDisplay autoBluetoothModeChangeDisplay;
|
||||
#endif
|
||||
|
||||
FrontFreqChangeScreen changeFrontFreq;
|
||||
FrontPatternChangeScreen changeFrontPattern;
|
||||
@ -222,10 +228,12 @@ union X {
|
||||
template<typename T> T &getRefByType() = delete;
|
||||
template<> decltype(displays.aboutMenu) &getRefByType<decltype(displays.aboutMenu)>() { return displays.aboutMenu; }
|
||||
template<> decltype(displays.accessPointWifiSettingsMenu) &getRefByType<decltype(displays.accessPointWifiSettingsMenu)>() { return displays.accessPointWifiSettingsMenu; }
|
||||
#ifdef FEATURE_BLUETOOTH
|
||||
template<> decltype(displays.bluetoothSettingsMenu) &getRefByType<decltype(displays.bluetoothSettingsMenu)>() { return displays.bluetoothSettingsMenu; }
|
||||
#ifdef FEATURE_BMS
|
||||
template<> decltype(displays.bmsMenu) &getRefByType<decltype(displays.bmsMenu)>() { return displays.bmsMenu; }
|
||||
#endif
|
||||
#endif
|
||||
template<> decltype(displays.buzzerMenu) &getRefByType<decltype(displays.buzzerMenu)>() { return displays.buzzerMenu; }
|
||||
template<> decltype(displays.boardcomputerHardwareSettingsMenu) &getRefByType<decltype(displays.boardcomputerHardwareSettingsMenu)>() { return displays.boardcomputerHardwareSettingsMenu; }
|
||||
template<> decltype(displays.controllerHardwareSettingsMenu) &getRefByType<decltype(displays.controllerHardwareSettingsMenu)>() { return displays.controllerHardwareSettingsMenu; }
|
||||
@ -294,7 +302,9 @@ template<> decltype(displays.updateDisplay) &
|
||||
|
||||
template<> decltype(displays.autoWifiModeChangeDisplay) &getRefByType<decltype(displays.autoWifiModeChangeDisplay)>() { return displays.autoWifiModeChangeDisplay; }
|
||||
|
||||
#ifdef FEATURE_BLUETOOTH
|
||||
template<> decltype(displays.autoBluetoothModeChangeDisplay) &getRefByType<decltype(displays.autoBluetoothModeChangeDisplay)>() { return displays.autoBluetoothModeChangeDisplay; }
|
||||
#endif
|
||||
|
||||
template<> decltype(displays.changeFrontFreq) &getRefByType<decltype(displays.changeFrontFreq)>() { return displays.changeFrontFreq; }
|
||||
template<> decltype(displays.changeFrontPattern) &getRefByType<decltype(displays.changeFrontPattern)>() { return displays.changeFrontPattern; }
|
||||
|
@ -6,7 +6,9 @@
|
||||
|
||||
#include "bobbycar-protocol/protocol.h"
|
||||
|
||||
#ifdef FEATURE_BLUETOOTH
|
||||
#include "bluetoothmode.h"
|
||||
#endif
|
||||
#include "unifiedmodelmode.h"
|
||||
|
||||
namespace {
|
||||
@ -37,9 +39,11 @@ struct Settings
|
||||
bool autoEnableAp;
|
||||
} wifiSettings;
|
||||
|
||||
#ifdef FEATURE_BLUETOOTH
|
||||
struct BluetoothSettings {
|
||||
BluetoothMode autoBluetoothMode;
|
||||
} bluetoothSettings;
|
||||
#endif
|
||||
|
||||
struct ControllerHardware {
|
||||
bool enableFrontLeft, enableFrontRight, enableBackLeft, enableBackRight;
|
||||
@ -119,7 +123,9 @@ void Settings::executeForEverySetting(T &&callable)
|
||||
callable("fieldWeakMax", limits.fieldWeakMax);
|
||||
callable("phaseAdvMax", limits.phaseAdvMax);
|
||||
|
||||
#ifdef FEATURE_BLUETOOTH
|
||||
callable("autoBluetoothMo", bluetoothSettings.autoBluetoothMode);
|
||||
#endif
|
||||
|
||||
callable("autoWifiMode", wifiSettings.autoWifiMode);
|
||||
callable("autoEnableAp", wifiSettings.autoEnableAp);
|
||||
|
@ -35,7 +35,9 @@ struct PhaseAdvMaxAccessor : public RefAccessorSaveSettings<int16_t> { int16_t &
|
||||
struct AutoWifiModeAccessor : public RefAccessorSaveSettings<wifi_mode_t> { wifi_mode_t &getRef() const override { return settings.wifiSettings.autoWifiMode; } };
|
||||
struct AutoEnableApAccessor : public RefAccessorSaveSettings<bool> { bool &getRef() const override { return settings.wifiSettings.autoEnableAp; } };
|
||||
|
||||
#ifdef FEATURE_BLUETOOTH
|
||||
struct AutoBluetoothModeAccessor : public RefAccessorSaveSettings<BluetoothMode> { BluetoothMode &getRef() const override { return settings.bluetoothSettings.autoBluetoothMode; } };
|
||||
#endif
|
||||
|
||||
struct FrontLeftEnabledAccessor : public RefAccessorSaveSettings<bool> { bool &getRef() const override { return settings.controllerHardware.enableFrontLeft; } };
|
||||
struct FrontRightEnabledAccessor : public RefAccessorSaveSettings<bool> { bool &getRef() const override { return settings.controllerHardware.enableFrontRight; } };
|
||||
|
@ -6,10 +6,12 @@
|
||||
#include <nvs_flash.h>
|
||||
#include <nvs.h>
|
||||
|
||||
#include <include/tl/optional.hpp>
|
||||
#include <optional>
|
||||
|
||||
#include "settings.h"
|
||||
#ifdef FEATURE_BLUETOOTH
|
||||
#include "bluetoothmode.h"
|
||||
#endif
|
||||
#include "unifiedmodelmode.h"
|
||||
|
||||
namespace {
|
||||
@ -23,14 +25,14 @@ public:
|
||||
bool load(Settings &settings);
|
||||
bool save(Settings &settings);
|
||||
|
||||
tl::optional<uint8_t> currentlyOpenProfileIndex() const;
|
||||
std::optional<uint8_t> currentlyOpenProfileIndex() const;
|
||||
|
||||
private:
|
||||
struct CurrentlyOpenProfile {
|
||||
nvs_handle handle;
|
||||
uint8_t profileIndex;
|
||||
};
|
||||
tl::optional<CurrentlyOpenProfile> m_profile;
|
||||
std::optional<CurrentlyOpenProfile> m_profile;
|
||||
};
|
||||
|
||||
bool SettingsPersister::init()
|
||||
@ -95,7 +97,7 @@ void SettingsPersister::closeProfile()
|
||||
|
||||
nvs_close(m_profile->handle);
|
||||
|
||||
m_profile = tl::nullopt;
|
||||
m_profile = std::nullopt;
|
||||
}
|
||||
|
||||
template<typename T> struct nvsGetterHelper;
|
||||
@ -137,6 +139,7 @@ template<> struct nvsGetterHelper<LarsmModeMode> { static esp_err_t nvs_get(nvs_
|
||||
*out_value = LarsmModeMode(tempValue);
|
||||
return err;
|
||||
}};
|
||||
#ifdef FEATURE_BLUETOOTH
|
||||
template<> struct nvsGetterHelper<BluetoothMode> { static esp_err_t nvs_get(nvs_handle handle, const char* key, BluetoothMode* out_value)
|
||||
{
|
||||
uint8_t tempValue;
|
||||
@ -145,6 +148,7 @@ template<> struct nvsGetterHelper<BluetoothMode> { static esp_err_t nvs_get(nvs_
|
||||
*out_value = BluetoothMode(tempValue);
|
||||
return err;
|
||||
}};
|
||||
#endif
|
||||
template<> struct nvsGetterHelper<UnifiedModelMode> { static esp_err_t nvs_get(nvs_handle handle, const char* key, UnifiedModelMode* out_value)
|
||||
{
|
||||
uint8_t tempValue;
|
||||
@ -205,10 +209,12 @@ template<> struct nvsSetterHelper<LarsmModeMode> { static esp_err_t nvs_set(nvs_
|
||||
{
|
||||
return nvs_set_u8(handle, key, uint8_t(value));
|
||||
}};
|
||||
#ifdef FEATURE_BLUETOOTH
|
||||
template<> struct nvsSetterHelper<BluetoothMode> { static esp_err_t nvs_set(nvs_handle handle, const char* key, BluetoothMode value)
|
||||
{
|
||||
return nvs_set_u8(handle, key, uint8_t(value));
|
||||
}};
|
||||
#endif
|
||||
template<> struct nvsSetterHelper<UnifiedModelMode> { static esp_err_t nvs_set(nvs_handle handle, const char* key, UnifiedModelMode value)
|
||||
{
|
||||
return nvs_set_u8(handle, key, uint8_t(value));
|
||||
@ -242,11 +248,11 @@ bool SettingsPersister::save(Settings &settings)
|
||||
return result;
|
||||
}
|
||||
|
||||
tl::optional<uint8_t> SettingsPersister::currentlyOpenProfileIndex() const
|
||||
std::optional<uint8_t> SettingsPersister::currentlyOpenProfileIndex() const
|
||||
{
|
||||
if (m_profile)
|
||||
return m_profile->profileIndex;
|
||||
|
||||
return tl::nullopt;
|
||||
return std::nullopt;
|
||||
}
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ constexpr char TEXT_WIFISOFTAPDISCONNECTWIFIOFF[] = "softAPdisconnect() wifioff"
|
||||
constexpr char TEXT_WIFISOFTAPENABLEIPV6[] = "softAPenableIpV6()";
|
||||
//constexpr char TEXT_BACK[] = "Back";
|
||||
|
||||
#ifdef FEATURE_BLUETOOTH
|
||||
//BluetoothSettingsMenu
|
||||
constexpr char TEXT_BLUETOOTHSETTINGS[] = "Bluetooth settings";
|
||||
constexpr char TEXT_BLUETOOTHBEGIN[] = "begin()";
|
||||
@ -24,6 +25,7 @@ constexpr char TEXT_AUTOBLUETOOTHMODE[] = "Auto bluetooth mode";
|
||||
//constexpr char TEXT_BACK[] = "Back";
|
||||
|
||||
//BmsMenu
|
||||
#ifdef FEATURE_BMS
|
||||
constexpr char TEXT_BMS[] = "BMS";
|
||||
constexpr char TEXT_CONNECTBMS[] = "Connect BMS";
|
||||
constexpr char TEXT_DISCONNECTBMS[] = "Disonnect BMS";
|
||||
@ -32,6 +34,8 @@ constexpr char TEXT_TURNOFFCHARGE[] = "Turn off charge";
|
||||
constexpr char TEXT_TURNONDISCHARGE[] = "Turn on discharge";
|
||||
constexpr char TEXT_TURNOFFDISCHARGE[] = "Turn off discharge";
|
||||
//constexpr char TEXT_BACK[] = "Back";
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//DebugMenu
|
||||
constexpr char TEXT_LOADSETTINGS[] = "Load settings";
|
||||
|
Reference in New Issue
Block a user