Moved FEATURE_BLE into config-system
This commit is contained in:
@ -39,7 +39,6 @@ set(BOBBYCAR_BUILDFLAGS
|
||||
# -DFEATURE_MOSFETS
|
||||
-DFEATURE_WEBSERVER
|
||||
-DFEATURE_OTA
|
||||
-DFEATURE_BLE
|
||||
# -DFEATURE_BLUETOOTH
|
||||
# -DFEATURE_BMS
|
||||
# -DFEATURE_GAMETRAK
|
||||
|
@ -39,7 +39,6 @@ set(BOBBYCAR_BUILDFLAGS
|
||||
# -DFEATURE_MOSFETS
|
||||
-DFEATURE_WEBSERVER
|
||||
-DFEATURE_OTA
|
||||
-DFEATURE_BLE
|
||||
# -DFEATURE_BLUETOOTH
|
||||
# -DFEATURE_BMS
|
||||
# -DFEATURE_GAMETRAK
|
||||
|
@ -39,7 +39,6 @@ set(BOBBYCAR_BUILDFLAGS
|
||||
-DFEATURE_MOSFETS
|
||||
-DFEATURE_WEBSERVER
|
||||
-DFEATURE_OTA
|
||||
-DFEATURE_BLE
|
||||
# -DFEATURE_BLUETOOTH
|
||||
# -DFEATURE_BMS
|
||||
# -DFEATURE_GAMETRAK
|
||||
|
@ -39,7 +39,6 @@ set(BOBBYCAR_BUILDFLAGS
|
||||
# -DFEATURE_MOSFETS
|
||||
-DFEATURE_WEBSERVER
|
||||
-DFEATURE_OTA
|
||||
-DFEATURE_BLE
|
||||
# -DFEATURE_BLUETOOTH
|
||||
# -DFEATURE_BMS
|
||||
# -DFEATURE_GAMETRAK
|
||||
|
@ -39,7 +39,6 @@ set(BOBBYCAR_BUILDFLAGS
|
||||
# -DFEATURE_MOSFETS
|
||||
# -DFEATURE_WEBSERVER
|
||||
# -DFEATURE_OTA
|
||||
# -DFEATURE_BLE
|
||||
# -DFEATURE_BLUETOOTH
|
||||
# -DFEATURE_BMS
|
||||
# -DFEATURE_GAMETRAK
|
||||
|
@ -39,7 +39,6 @@ set(BOBBYCAR_BUILDFLAGS
|
||||
# -DFEATURE_MOSFETS
|
||||
-DFEATURE_WEBSERVER
|
||||
-DFEATURE_OTA
|
||||
-DFEATURE_BLE
|
||||
# -DFEATURE_BLUETOOTH
|
||||
# -DFEATURE_BMS
|
||||
# -DFEATURE_GAMETRAK
|
||||
|
@ -38,9 +38,7 @@ struct FieldWeakMaxAccessor : public RefAccessorSaveSettings<int16_t> { int16_t
|
||||
struct PhaseAdvMaxAccessor : public RefAccessorSaveSettings<int16_t> { int16_t &getRef() const override { return profileSettings.limits.phaseAdvMax; } };
|
||||
|
||||
// Bluetooth Low Energy
|
||||
#ifdef FEATURE_BLE
|
||||
struct BleEnabledAccessor : public NewSettingsAccessor<bool> { ConfigWrapper<bool> &getConfig() const override { return configs.bleSettings.bleEnabled; } };
|
||||
#endif
|
||||
|
||||
// Cloud
|
||||
struct CloudEnabledAccessor : public NewSettingsAccessor<bool> { ConfigWrapper<bool> &getConfig() const override { return configs.cloudSettings.cloudEnabled; } };
|
||||
|
@ -15,7 +15,6 @@
|
||||
#include "utils.h"
|
||||
#include "newsettings.h"
|
||||
|
||||
#ifdef FEATURE_BLE
|
||||
namespace {
|
||||
constexpr const char * const TAG = "BOBBYBLE";
|
||||
|
||||
@ -105,6 +104,9 @@ void initBle()
|
||||
|
||||
void handleBle()
|
||||
{
|
||||
if (!configs.feature.ble.value)
|
||||
return;
|
||||
|
||||
if (configs.bleSettings.bleEnabled.value)
|
||||
{
|
||||
if (!pServer)
|
||||
@ -293,5 +295,3 @@ void WiFiListCallbacks::onRead(NimBLECharacteristic *pCharacteristic)
|
||||
pCharacteristic->setValue(json);
|
||||
}
|
||||
} // namespace
|
||||
|
||||
#endif
|
||||
|
@ -1,7 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef FEATURE_BLE
|
||||
|
||||
// esp-idf includes
|
||||
#include <NimBLEDevice.h>
|
||||
|
||||
@ -15,5 +13,3 @@ extern BLECharacteristic *getwifilist;
|
||||
void initBle();
|
||||
|
||||
void handleBle();
|
||||
|
||||
#endif
|
||||
|
@ -4,7 +4,6 @@
|
||||
#include "textinterface.h"
|
||||
#include "ble_bobby.h"
|
||||
|
||||
#ifdef FEATURE_BLE
|
||||
struct BleServerPeerDevicesText : public virtual espgui::TextInterface {
|
||||
public:
|
||||
std::string text() const override
|
||||
@ -26,4 +25,3 @@ public:
|
||||
return text;
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
@ -15,7 +15,6 @@
|
||||
#include "displays/menus/settingsmenu.h"
|
||||
#include "bobbycheckbox.h"
|
||||
|
||||
#ifdef FEATURE_BLE
|
||||
namespace {
|
||||
constexpr char TEXT_BLESETTINGS[] = "BLE settings";
|
||||
constexpr char TEXT_ENABLED[] = "Enabled";
|
||||
@ -51,4 +50,3 @@ void BleSettingsMenu::back()
|
||||
{
|
||||
espgui::switchScreen<SettingsMenu>();
|
||||
}
|
||||
#endif
|
||||
|
@ -3,8 +3,6 @@
|
||||
// local includes
|
||||
#include "displays/bobbymenudisplay.h"
|
||||
|
||||
#ifdef FEATURE_BLE
|
||||
|
||||
class BleSettingsMenu : public BobbyMenuDisplay
|
||||
{
|
||||
public:
|
||||
@ -14,4 +12,3 @@ public:
|
||||
|
||||
void back() override;
|
||||
};
|
||||
#endif
|
||||
|
@ -10,9 +10,7 @@
|
||||
// local includes
|
||||
#include "utils.h"
|
||||
#include "icons/wifi.h"
|
||||
#if defined(FEATURE_BLUETOOTH) || defined(FEATURE_BLE)
|
||||
#include "icons/bluetooth.h"
|
||||
#endif
|
||||
#include "icons/time.h"
|
||||
#include "icons/hardware.h"
|
||||
#include "icons/buzzer.h"
|
||||
@ -92,17 +90,12 @@ SettingsMenu::SettingsMenu()
|
||||
#ifdef FEATURE_BLUETOOTH
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BLUETOOTHSETTINGS>, SwitchScreenAction<BluetoothSettingsMenu>, StaticMenuItemIcon<&bobbyicons::bluetooth>>>();
|
||||
#endif
|
||||
#ifdef FEATURE_BLE
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BLESETTINGS>, SwitchScreenAction<BleSettingsMenu>, StaticMenuItemIcon<&bobbyicons::bluetooth>>>();
|
||||
#endif
|
||||
if (configs.feature.ble.value)
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BLESETTINGS>, SwitchScreenAction<BleSettingsMenu>, StaticMenuItemIcon<&bobbyicons::bluetooth>>>();
|
||||
if (configs.feature.cloud.value)
|
||||
{
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_CLOUDSETTINGS>, SwitchScreenAction<CloudSettingsMenu>>>();
|
||||
}
|
||||
if (configs.feature.udpcloud.value)
|
||||
{
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_UDPCLOUDSETTINGS>, SwitchScreenAction<UdpCloudSettingsMenu>>>();
|
||||
}
|
||||
#ifdef FEATURE_OTA
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_SELECTBUILDSERVERMENU>, SwitchScreenAction<SelectBuildServerMenu>, StaticMenuItemIcon<&bobbyicons::update>>>();
|
||||
#endif
|
||||
|
@ -1,7 +1,6 @@
|
||||
#include "bluetooth.h"
|
||||
|
||||
namespace bobbyicons {
|
||||
#if defined(FEATURE_BLUETOOTH) || defined(FEATURE_BLE)
|
||||
const espgui::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
|
||||
@ -40,5 +39,4 @@ const espgui::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
|
||||
}, "bluetooth"};
|
||||
#endif
|
||||
} // namespace bobbyicons
|
||||
|
@ -3,7 +3,5 @@
|
||||
#include "icon.h"
|
||||
|
||||
namespace bobbyicons {
|
||||
#if defined(FEATURE_BLUETOOTH) || defined(FEATURE_BLE)
|
||||
extern const espgui::Icon<24, 24> bluetooth;
|
||||
#endif
|
||||
} // namespace bobbyicons
|
||||
|
@ -313,6 +313,7 @@ public:
|
||||
ConfigWrapper<bool> udpcloud {false, DoReset, {}, "f_udpcloud" };
|
||||
ConfigWrapper<bool> dnsannounce {false, DoReset, {}, "f_dnsannounce" };
|
||||
ConfigWrapper<bool> ntp {false, DoReset, {}, "f_ntp" };
|
||||
ConfigWrapper<bool> ble {false, DoReset, {}, "f_ble" };
|
||||
ConfigWrapper<bool> gschissene_diode {false, DoReset, {}, "f_gschissDiode" };
|
||||
} feature;
|
||||
|
||||
@ -605,14 +606,15 @@ public:
|
||||
x(espnow.syncTimeWithOthers) \
|
||||
x(espnow.syncBlink) \
|
||||
\
|
||||
x(feature.gschissene_diode) \
|
||||
x(feature.ledstrip) \
|
||||
x(feature.webserver_disable_lock) \
|
||||
x(feature.garage) \
|
||||
x(feature.udpcloud) \
|
||||
x(feature.cloud) \
|
||||
x(feature.dnsannounce) \
|
||||
x(feature.ntp)
|
||||
x(feature.ntp) \
|
||||
x(feature.ble) \
|
||||
x(feature.gschissene_diode)
|
||||
//x(bleSettings.bleEnabled)
|
||||
|
||||
#define FEATURES(x) \
|
||||
@ -622,7 +624,8 @@ public:
|
||||
x(feature.udpcloud) \
|
||||
x(feature.cloud) \
|
||||
x(feature.dnsannounce) \
|
||||
x(feature.ntp)
|
||||
x(feature.ntp) \
|
||||
x(feature.ble)
|
||||
//x(feature.gschisseneDiode)
|
||||
|
||||
template<typename T>
|
||||
|
@ -48,9 +48,7 @@
|
||||
#ifdef FEATURE_OTA
|
||||
#include "ota.h"
|
||||
#endif
|
||||
#ifdef FEATURE_BLE
|
||||
#include "ble_bobby.h"
|
||||
#endif
|
||||
#ifdef FEATURE_WEBSERVER
|
||||
#include "webserver.h"
|
||||
#endif
|
||||
@ -113,9 +111,7 @@ BobbySchedulerTask schedulerTasksArr[] {
|
||||
#ifdef FEATURE_OTA
|
||||
BobbySchedulerTask { "ota", initOta, handleOta, 50ms },
|
||||
#endif
|
||||
#ifdef FEATURE_BLE
|
||||
BobbySchedulerTask { "ble", initBle, handleBle, 100ms },
|
||||
#endif
|
||||
#ifdef FEATURE_WEBSERVER
|
||||
BobbySchedulerTask { "webserver", initWebserver, handleWebserver, 100ms },
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user