Moved FEATURE_CLOUD and FEATURE_UDPCLOUD into config-system
This commit is contained in:
@@ -65,8 +65,6 @@ set(BOBBYCAR_BUILDFLAGS
|
||||
# -DPINS_GAMETRAKY=39
|
||||
# -DPINS_GAMETRAKDIST=36
|
||||
-DFEATURE_POWERSUPPLY
|
||||
-DFEATURE_CLOUD
|
||||
-DFEATURE_UDPCLOUD
|
||||
-DFEATURE_LEDBACKLIGHT
|
||||
-DPINS_LEDBACKLIGHT=23
|
||||
-DLEDBACKLIGHT_INVERTED
|
||||
|
@@ -58,8 +58,6 @@ set(BOBBYCAR_BUILDFLAGS
|
||||
# -DPINS_GAMETRAKY=39
|
||||
# -DPINS_GAMETRAKDIST=36
|
||||
# -DFEATURE_POWERSUPPLY
|
||||
# -DFEATURE_CLOUD
|
||||
-DFEATURE_UDPCLOUD
|
||||
-DFEATURE_LEDBACKLIGHT
|
||||
-DPINS_LEDBACKLIGHT=23
|
||||
-DLEDBACKLIGHT_INVERTED
|
||||
|
@@ -56,8 +56,6 @@ set(BOBBYCAR_BUILDFLAGS
|
||||
# -DPINS_GAMETRAKY=39
|
||||
# -DPINS_GAMETRAKDIST=36
|
||||
-DFEATURE_POWERSUPPLY
|
||||
-DFEATURE_CLOUD
|
||||
-DFEATURE_UDPCLOUD
|
||||
-DFEATURE_LEDBACKLIGHT
|
||||
-DPINS_LEDBACKLIGHT=23
|
||||
-DLEDBACKLIGHT_INVERTED
|
||||
|
@@ -56,8 +56,6 @@ set(BOBBYCAR_BUILDFLAGS
|
||||
# -DPINS_GAMETRAKY=39
|
||||
# -DPINS_GAMETRAKDIST=36
|
||||
# -DFEATURE_POWERSUPPLY
|
||||
# -DFEATURE_CLOUD
|
||||
-DFEATURE_UDPCLOUD
|
||||
-DFEATURE_LEDBACKLIGHT
|
||||
-DPINS_LEDBACKLIGHT=23
|
||||
-DLEDBACKLIGHT_INVERTED
|
||||
|
@@ -56,7 +56,7 @@ set(BOBBYCAR_BUILDFLAGS
|
||||
-DPINS_DPAD_6WIRESW_IN3=18
|
||||
-DPINS_DPAD_6WIRESW_IN4=19
|
||||
-DPINS_DPAD_6WIRESW_IN5=26
|
||||
# -DFEATURE_GSCHISSENE_DIODE
|
||||
# -DFEATURE_GSCHISSENE_DIODE
|
||||
# -DFEATURE_BLE
|
||||
# -DFEATURE_BLUETOOTH
|
||||
# -DFEATURE_BMS
|
||||
@@ -65,8 +65,6 @@ set(BOBBYCAR_BUILDFLAGS
|
||||
# -DPINS_GAMETRAKY=39
|
||||
# -DPINS_GAMETRAKDIST=36
|
||||
# -DFEATURE_POWERSUPPLY
|
||||
# -DFEATURE_CLOUD
|
||||
# -DFEATURE_UDPCLOUD
|
||||
# -DFEATURE_LEDBACKLIGHT
|
||||
# -DPINS_LEDBACKLIGHT=23
|
||||
# -DLEDBACKLIGHT_INVERTED
|
||||
|
@@ -56,8 +56,6 @@ set(BOBBYCAR_BUILDFLAGS
|
||||
# -DPINS_GAMETRAKY=39
|
||||
# -DPINS_GAMETRAKDIST=36
|
||||
# -DFEATURE_POWERSUPPLY
|
||||
# -DFEATURE_CLOUD
|
||||
-DFEATURE_UDPCLOUD
|
||||
-DFEATURE_LEDBACKLIGHT
|
||||
-DPINS_LEDBACKLIGHT=23
|
||||
-DLEDBACKLIGHT_INVERTED
|
||||
|
@@ -43,10 +43,8 @@ struct BleEnabledAccessor : public NewSettingsAccessor<bool> { ConfigWrapper<boo
|
||||
#endif
|
||||
|
||||
// Cloud
|
||||
#ifdef FEATURE_CLOUD
|
||||
struct CloudEnabledAccessor : public NewSettingsAccessor<bool> { ConfigWrapper<bool> &getConfig() const override { return configs.cloudSettings.cloudEnabled; } };
|
||||
struct CloudTransmitTimeoutAccessor : public NewSettingsAccessor<int16_t> { ConfigWrapper<int16_t> &getConfig() const override { return configs.cloudSettings.cloudTransmitTimeout; } };
|
||||
#endif
|
||||
|
||||
// Time
|
||||
//struct TimezoneOffsetAccessor : public NewSettingsAccessor<int32_t> { ConfigWrapper<int32_t> &getConfig() const override { return configs.timezoneOffset; } };
|
||||
@@ -126,17 +124,13 @@ struct GametrakDistMaxAccessor : public NewSettingsAccessor<int16_t> { ConfigWra
|
||||
struct StatsUpdateRateAccessor : public NewSettingsAccessor<int16_t> { ConfigWrapper<int16_t> &getConfig() const override { return configs.boardcomputerHardware.timersSettings.statsUpdateRate; } };
|
||||
|
||||
// Cloud
|
||||
#ifdef FEATURE_CLOUD
|
||||
struct CloudCollectRateAccessor : public NewSettingsAccessor<int16_t> { ConfigWrapper<int16_t> &getConfig() const override { return configs.boardcomputerHardware.timersSettings.cloudCollectRate; } };
|
||||
struct CloudSendRateAccessor : public NewSettingsAccessor<int16_t> { ConfigWrapper<int16_t> &getConfig() const override { return configs.boardcomputerHardware.timersSettings.cloudSendRate; } };
|
||||
#endif
|
||||
|
||||
#ifdef FEATURE_UDPCLOUD
|
||||
struct UdpCloudSendIntervalAccessor : public NewSettingsAccessor<int16_t> { ConfigWrapper<int16_t> &getConfig() const override { return configs.boardcomputerHardware.timersSettings.udpSendRateMs; } };
|
||||
struct UdpCloudEnabledAccessor : public NewSettingsAccessor<bool> { ConfigWrapper<bool> &getConfig() const override { return configs.udpCloudSettings.udpCloudEnabled; } };
|
||||
struct CloudDebugEnableAccessor : public NewSettingsAccessor<bool> { ConfigWrapper<bool> &getConfig() const override { return configs.udpCloudSettings.enableCloudDebug; } };
|
||||
struct UdpUseStdStringAccessor : public NewSettingsAccessor<bool> { ConfigWrapper<bool> &getConfig() const override { return configs.udpCloudSettings.udpUseStdString; } };
|
||||
#endif
|
||||
|
||||
// DefaultMode
|
||||
struct DefaultModeModelModeAccessor : public RefAccessorSaveSettings<UnifiedModelMode> { UnifiedModelMode &getRef() const override { return profileSettings.defaultMode.modelMode; } };
|
||||
|
@@ -24,7 +24,6 @@ namespace {
|
||||
constexpr const char * const TAG = "BOBBYCLOUD";
|
||||
} // namespace
|
||||
|
||||
#ifdef FEATURE_CLOUD
|
||||
|
||||
espcpputils::websocket_client cloudClient;
|
||||
bool cloudStarted{};
|
||||
@@ -53,6 +52,9 @@ void initCloud()
|
||||
|
||||
void updateCloud()
|
||||
{
|
||||
if (!configs.feature.cloud.value)
|
||||
return;
|
||||
|
||||
const auto now = espchrono::millis_clock::now();
|
||||
|
||||
if (!lastCloudCollect || now - *lastCloudCollect >= std::chrono::milliseconds{configs.boardcomputerHardware.timersSettings.cloudCollectRate.value})
|
||||
@@ -284,5 +286,3 @@ void destroyCloud()
|
||||
cloudClient = {};
|
||||
cloudStarted = false;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@@ -7,7 +7,6 @@
|
||||
#include <wrappers/websocket_client.h>
|
||||
#include <espchrono.h>
|
||||
|
||||
#ifdef FEATURE_CLOUD
|
||||
extern espcpputils::websocket_client cloudClient;
|
||||
extern bool cloudStarted;
|
||||
extern espchrono::millis_clock::time_point lastCreateTry;
|
||||
@@ -22,4 +21,3 @@ void initCloud();
|
||||
void updateCloud();
|
||||
void cloudCollect();
|
||||
void cloudSend();
|
||||
#endif
|
||||
|
@@ -6,7 +6,6 @@
|
||||
// local includes
|
||||
#include "cloud.h"
|
||||
|
||||
#ifdef FEATURE_CLOUD
|
||||
std::string CloudCreatedText::text() const
|
||||
{
|
||||
return fmt::format("created: {}", cloudClient ? "true" : "false");
|
||||
@@ -27,4 +26,3 @@ std::string CloudConnectedText::text() const
|
||||
text += cloudClient.is_connected() ? "true" : "false";
|
||||
return text;
|
||||
}
|
||||
#endif
|
||||
|
@@ -3,7 +3,6 @@
|
||||
// local includes
|
||||
#include "textinterface.h"
|
||||
|
||||
#ifdef FEATURE_CLOUD
|
||||
struct CloudCreatedText : public virtual espgui::TextInterface
|
||||
{
|
||||
public:
|
||||
@@ -21,4 +20,3 @@ struct CloudConnectedText : public virtual espgui::TextInterface
|
||||
public:
|
||||
std::string text() const override;
|
||||
};
|
||||
#endif
|
||||
|
@@ -16,7 +16,6 @@
|
||||
#include "displays/menus/settingsmenu.h"
|
||||
#include "bobbycheckbox.h"
|
||||
|
||||
#ifdef FEATURE_CLOUD
|
||||
namespace {
|
||||
constexpr char TEXT_CLOUDSETTINGS[] = "Cloud settings";
|
||||
constexpr char TEXT_CLOUDENABLED[] = "Cloud enabled";
|
||||
@@ -83,4 +82,3 @@ void CloudSettingsMenu::back()
|
||||
{
|
||||
switchScreen<SettingsMenu>();
|
||||
}
|
||||
#endif
|
||||
|
@@ -3,7 +3,6 @@
|
||||
// local includes
|
||||
#include "displays/bobbymenudisplay.h"
|
||||
|
||||
#ifdef FEATURE_CLOUD
|
||||
class CloudSettingsMenu : public BobbyMenuDisplay
|
||||
{
|
||||
public:
|
||||
@@ -13,4 +12,3 @@ public:
|
||||
|
||||
void back() override;
|
||||
};
|
||||
#endif
|
||||
|
@@ -66,9 +66,10 @@ DebugMenu::DebugMenu()
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_CANDEBUG>, SwitchScreenAction<CanDebugMenu>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_QRCODE_DEBUG>, SwitchScreenAction<QrCodeDebugDisplay>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BATTERYDEBUG>, SwitchScreenAction<BatteryDebugMenu>, StaticMenuItemIcon<&bobbyicons::battery>>>();
|
||||
#ifdef FEATURE_UDPCLOUD
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_TOGGLECLOUDDEBUG>, BobbyCheckbox, CloudDebugEnableAccessor>>();
|
||||
#endif
|
||||
if (configs.feature.udpcloud.value)
|
||||
{
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_TOGGLECLOUDDEBUG>, BobbyCheckbox, CloudDebugEnableAccessor>>();
|
||||
}
|
||||
constructMenuItem<makeComponent<MenuItem, LastRebootReasonText, StaticFont<2>, DisabledColor, DummyAction>>();
|
||||
constructMenuItem<makeComponent<MenuItem, CanIcCrashText, StaticFont<2>, DisabledColor, DummyAction>>();
|
||||
constructMenuItem<makeComponent<MenuItem, EmptyText, DummyAction>>();
|
||||
|
@@ -25,12 +25,8 @@
|
||||
#include "displays/menus/networksettingsmenu.h"
|
||||
#include "displays/menus/bluetoothsettingsmenu.h"
|
||||
#include "displays/menus/blesettingsmenu.h"
|
||||
#ifdef FEATURE_CLOUD
|
||||
#include "displays/menus/cloudsettingsmenu.h"
|
||||
#endif
|
||||
#ifdef FEATURE_UDPCLOUD
|
||||
#include "displays/menus/udpcloudsettingsmenu.h"
|
||||
#endif
|
||||
#include "displays/menus/espnowmenu.h"
|
||||
#include "displays/menus/selectbuildservermenu.h"
|
||||
#include "displays/menus/timesettingsmenu.h"
|
||||
@@ -99,12 +95,14 @@ SettingsMenu::SettingsMenu()
|
||||
#ifdef FEATURE_BLE
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BLESETTINGS>, SwitchScreenAction<BleSettingsMenu>, StaticMenuItemIcon<&bobbyicons::bluetooth>>>();
|
||||
#endif
|
||||
#ifdef FEATURE_CLOUD
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_CLOUDSETTINGS>, SwitchScreenAction<CloudSettingsMenu>>>();
|
||||
#endif
|
||||
#ifdef FEATURE_UDPCLOUD
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_UDPCLOUDSETTINGS>, SwitchScreenAction<UdpCloudSettingsMenu>>>();
|
||||
#endif
|
||||
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
|
||||
|
@@ -14,7 +14,6 @@
|
||||
#include "displays/menus/settingsmenu.h"
|
||||
#include "bobbycheckbox.h"
|
||||
|
||||
#ifdef FEATURE_UDPCLOUD
|
||||
namespace {
|
||||
constexpr char TEXT_UDPCLOUDSETTINGS[] = "UDP Cloud settings";
|
||||
constexpr char TEXT_UDPCLOUDENABLED[] = "Udp Cloud enabled";
|
||||
@@ -50,4 +49,3 @@ void UdpCloudSettingsMenu::back()
|
||||
{
|
||||
switchScreen<SettingsMenu>();
|
||||
}
|
||||
#endif
|
||||
|
@@ -3,7 +3,6 @@
|
||||
// local includes
|
||||
#include "displays/bobbymenudisplay.h"
|
||||
|
||||
#ifdef FEATURE_UDPCLOUD
|
||||
class UdpCloudSettingsMenu : public BobbyMenuDisplay
|
||||
{
|
||||
public:
|
||||
@@ -13,4 +12,3 @@ public:
|
||||
|
||||
void back() override;
|
||||
};
|
||||
#endif
|
||||
|
@@ -150,16 +150,18 @@ void StatusDisplay::redraw()
|
||||
m_backStatus.redraw(controllers.back);
|
||||
|
||||
tft.setTextFont(2);
|
||||
#ifdef FEATURE_UDPCLOUD
|
||||
if(configs.udpCloudSettings.udpCloudEnabled.value && configs.udpCloudSettings.enableCloudDebug.value)
|
||||
|
||||
if (configs.feature.udpcloud.value)
|
||||
{
|
||||
tft.fillRect(125, 258, 8, 8, (visualSendUdpPacket) ? TFT_DARKGREY : TFT_BLACK);
|
||||
if(configs.udpCloudSettings.udpCloudEnabled.value && configs.udpCloudSettings.enableCloudDebug.value)
|
||||
{
|
||||
tft.fillRect(125, 258, 8, 8, (visualSendUdpPacket) ? TFT_DARKGREY : TFT_BLACK);
|
||||
}
|
||||
// else // is not needed because of redraw
|
||||
// {
|
||||
// tft.fillRect(125, 258, 8, 8, TFT_BLACK);
|
||||
// }
|
||||
}
|
||||
// else // is not needed because of redraw
|
||||
// {
|
||||
// tft.fillRect(125, 258, 8, 8, TFT_BLACK);
|
||||
// }
|
||||
#endif
|
||||
|
||||
const auto staStatus = wifi_stack::get_sta_status();
|
||||
if (staStatus == wifi_stack::WiFiStaStatus::CONNECTED)
|
||||
|
@@ -308,6 +308,8 @@ public:
|
||||
ConfigWrapper<bool> ledstrip {false, DoReset, {}, "f_ledstrip" };
|
||||
ConfigWrapper<bool> webserver_disable_lock{false, DoReset, {}, "f_no_web_lock" };
|
||||
ConfigWrapper<bool> garage {false, DoReset, {}, "f_garage" };
|
||||
ConfigWrapper<bool> cloud {false, DoReset, {}, "f_cloud" };
|
||||
ConfigWrapper<bool> udpcloud {false, DoReset, {}, "f_udpcloud" };
|
||||
ConfigWrapper<bool> gschissene_diode {false, DoReset, {}, "f_gschissDiode" };
|
||||
} feature;
|
||||
|
||||
@@ -592,13 +594,18 @@ public:
|
||||
x(feature.gschissene_diode) \
|
||||
x(feature.ledstrip) \
|
||||
x(feature.webserver_disable_lock) \
|
||||
x(feature.garage)
|
||||
x(feature.garage) \
|
||||
x(feature.udpcloud) \
|
||||
x(feature.cloud)
|
||||
//x(bleSettings.bleEnabled)
|
||||
|
||||
#define FEATURES(x) \
|
||||
x(feature.ledstrip) \
|
||||
x(feature.webserver_disable_lock) \
|
||||
x(feature.garage)
|
||||
x(feature.garage) \
|
||||
x(feature.udpcloud) \
|
||||
x(feature.cloud)
|
||||
//x(feature.gschisseneDiode)
|
||||
|
||||
template<typename T>
|
||||
void callForEveryConfig(T &&callback)
|
||||
|
@@ -60,12 +60,8 @@
|
||||
#ifdef FEATURE_ESPNOW
|
||||
#include "espnowfunctions.h"
|
||||
#endif
|
||||
#ifdef FEATURE_CLOUD
|
||||
#include "cloud.h"
|
||||
#endif
|
||||
#ifdef FEATURE_UDPCLOUD
|
||||
#include "udpcloud.h"
|
||||
#endif
|
||||
#include "modes.h"
|
||||
#include "drivingstatistics.h"
|
||||
#ifdef FEATURE_DNS_NS
|
||||
@@ -133,12 +129,8 @@ BobbySchedulerTask schedulerTasksArr[] {
|
||||
#ifdef FEATURE_ESPNOW
|
||||
BobbySchedulerTask { "espnow", espnow::initESPNow, espnow::handle, 100ms },
|
||||
#endif
|
||||
#ifdef FEATURE_CLOUD
|
||||
BobbySchedulerTask { "cloud", initCloud, updateCloud, 50ms },
|
||||
#endif
|
||||
#ifdef FEATURE_UDPCLOUD
|
||||
BobbySchedulerTask { "udpcloud", udpCloudInit, udpCloudUpdate, 50ms },
|
||||
#endif
|
||||
BobbySchedulerTask { "drivingmode", initDrivingMode, updateDrivingMode, 20ms },
|
||||
BobbySchedulerTask { "drivingstatistics", initStatistics, calculateStatistics, 100ms },
|
||||
#ifdef FEATURE_DNS_NS
|
||||
|
@@ -21,7 +21,6 @@
|
||||
#include "drivingstatistics.h"
|
||||
#include "newsettings.h"
|
||||
|
||||
#ifdef FEATURE_UDPCLOUD
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
namespace {
|
||||
@@ -40,6 +39,9 @@ void udpCloudInit()
|
||||
|
||||
void udpCloudUpdate()
|
||||
{
|
||||
if (!configs.feature.udpcloud.value)
|
||||
return;
|
||||
|
||||
if (configs.udpCloudSettings.udpCloudEnabled.value && configs.udpCloudSettings.udpUid.touched())
|
||||
sendUdpCloudPacket();
|
||||
}
|
||||
@@ -372,4 +374,3 @@ void sendUdpCloudPacket()
|
||||
visualSendUdpPacket = !visualSendUdpPacket;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@@ -3,7 +3,6 @@
|
||||
// system includes
|
||||
#include <string>
|
||||
|
||||
#ifdef FEATURE_UDPCLOUD
|
||||
// Little "flash" on statusdisplay when udp stuff is happening
|
||||
extern bool visualSendUdpPacket;
|
||||
|
||||
@@ -14,4 +13,3 @@ void spamUdpBroadcast();
|
||||
std::string buildUdpCloudJson();
|
||||
std::string buildUdpCloudString();
|
||||
void sendUdpCloudPacket();
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user