Moved FEATURE_LEDSTRIP into config-system
This commit is contained in:
@ -171,7 +171,6 @@ struct MotortestModeMultiplikatorAccessor : public RefAccessorSaveSettings<uint8
|
||||
struct MotortestMaxPwmAccessor : public RefAccessorSaveSettings<uint16_t> { uint16_t &getRef() const override { return profileSettings.motortestMode.maxPwm; } };
|
||||
|
||||
// Ledstrip
|
||||
#ifdef FEATURE_LEDSTRIP
|
||||
struct EnableLedAnimationAccessor : public NewSettingsAccessor<bool> { ConfigWrapper<bool> &getConfig() const override { return configs.ledstrip.enableLedAnimation; } };
|
||||
struct EnableBrakeLightsAccessor : public NewSettingsAccessor<bool> { ConfigWrapper<bool> &getConfig() const override { return configs.ledstrip.enableBrakeLights; } };
|
||||
struct LedsCountAccessor : public NewSettingsAccessor<int16_t> { ConfigWrapper<int16_t> &getConfig() const override { return configs.ledstrip.ledsCount; } };
|
||||
@ -204,7 +203,6 @@ struct LedstripEnableBlinkAnimationAccessor : public NewSettingsAccessor<bool> {
|
||||
struct LedstripOtaAnimationAccessor : public NewSettingsAccessor<OtaAnimationModes> { ConfigWrapper<OtaAnimationModes> &getConfig() const override { return configs.ledstrip.otaMode; } };
|
||||
#endif
|
||||
struct LedstripEnableVisualizeBlinkAnimationAccessor : public NewSettingsAccessor<bool> { ConfigWrapper<bool> &getConfig() const override { return configs.ledstrip.enableVisualizeBlink; } };
|
||||
#endif
|
||||
|
||||
// Battery
|
||||
struct BatterySeriesCellsAccessor : public NewSettingsAccessor<uint8_t> { ConfigWrapper<uint8_t> &getConfig() const override { return configs.battery.cellsSeries; } };
|
||||
|
@ -9,7 +9,6 @@
|
||||
#include "newsettings.h"
|
||||
#include "bobbyerrorhandler.h"
|
||||
|
||||
#ifdef FEATURE_LEDSTRIP
|
||||
template<LedstripAnimation type>
|
||||
class LedStripSetAnimationActionStatic : public virtual espgui::ActionInterface
|
||||
{
|
||||
@ -29,5 +28,3 @@ public:
|
||||
private:
|
||||
const LedstripAnimation m_animation;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -1,6 +1,5 @@
|
||||
#include "ledstripblinkactions.h"
|
||||
|
||||
#ifdef FEATURE_LEDSTRIP
|
||||
#include "ledstrip.h"
|
||||
#include "ledstripdefines.h"
|
||||
|
||||
@ -39,4 +38,3 @@ void LedstripAnimationBlinkBothAction::triggered()
|
||||
{
|
||||
blinkAnimation = LEDSTRIP_OVERWRITE_BLINKBOTH;
|
||||
}
|
||||
#endif
|
||||
|
@ -1,6 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef FEATURE_LEDSTRIP
|
||||
#include "actioninterface.h"
|
||||
|
||||
class LedstripAnimationBlinkNoneAction : public virtual espgui::ActionInterface
|
||||
@ -34,4 +33,3 @@ class LedstripAnimationBlinkBothAction : public virtual espgui::ActionInterface
|
||||
public:
|
||||
void triggered() override;
|
||||
};
|
||||
#endif
|
||||
|
@ -9,9 +9,7 @@
|
||||
#include <futurecpp.h>
|
||||
|
||||
// local includes
|
||||
#ifdef FEATURE_LEDSTRIP
|
||||
#include "ledstrip.h"
|
||||
#endif
|
||||
#include "globals.h"
|
||||
#include "modes/remotecontrolmode.h"
|
||||
#include "utils.h"
|
||||
@ -246,10 +244,11 @@ void RemoteControlCallbacks::onWrite(NimBLECharacteristic* pCharacteristic)
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef FEATURE_LEDSTRIP
|
||||
auto newBlinkAnimation = doc["anim"].as<int16_t>();
|
||||
if (blinkAnimation != newBlinkAnimation) blinkAnimation = newBlinkAnimation;
|
||||
#endif // FEATURE_LEDSTRIP
|
||||
if (configs.feature.ledstrip.value)
|
||||
{
|
||||
const auto newBlinkAnimation = doc["anim"].as<int16_t>();
|
||||
if (blinkAnimation != newBlinkAnimation) blinkAnimation = newBlinkAnimation;
|
||||
}
|
||||
|
||||
const bool isInverted = (profileSettings.controllerHardware.invertFrontLeft && !profileSettings.controllerHardware.invertFrontRight);
|
||||
|
||||
|
@ -6,10 +6,9 @@
|
||||
// local includes
|
||||
#include "newsettings.h"
|
||||
#include "settingsutils.h"
|
||||
#ifdef FEATURE_LEDSTRIP
|
||||
#include "modes/defaultmode.h"
|
||||
#include "ledstripdefines.h"
|
||||
#include "ledstrip.h"
|
||||
#endif
|
||||
|
||||
#include "bobbyquickactions.h"
|
||||
|
||||
|
@ -82,7 +82,8 @@ void action_wifi_scan()
|
||||
|
||||
void blink_left()
|
||||
{
|
||||
#ifdef FEATURE_LEDSTRIP
|
||||
if (configs.feature.ledstrip.value)
|
||||
{
|
||||
if (blinkAnimation == LEDSTRIP_OVERWRITE_NONE) //transition from off to left
|
||||
{
|
||||
blinkAnimation = LEDSTRIP_OVERWRITE_BLINKLEFT;
|
||||
@ -95,12 +96,13 @@ void blink_left()
|
||||
{
|
||||
blinkAnimation = LEDSTRIP_OVERWRITE_NONE;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void blink_right()
|
||||
{
|
||||
#ifdef FEATURE_LEDSTRIP
|
||||
if(configs.feature.ledstrip.value)
|
||||
{
|
||||
if (blinkAnimation == LEDSTRIP_OVERWRITE_NONE) //transition from off to right
|
||||
{
|
||||
blinkAnimation = LEDSTRIP_OVERWRITE_BLINKRIGHT;
|
||||
@ -113,7 +115,7 @@ void blink_right()
|
||||
{
|
||||
blinkAnimation = LEDSTRIP_OVERWRITE_NONE;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void handle_handbremse()
|
||||
|
@ -21,7 +21,6 @@
|
||||
#include "globals.h"
|
||||
#include "displays/menus/ledstripmenu.h"
|
||||
|
||||
#ifdef FEATURE_LEDSTRIP
|
||||
namespace {
|
||||
constexpr char TEXT_LEDSTRIPCOLORMENU[] = "Customize Ledstrip";
|
||||
|
||||
@ -258,4 +257,3 @@ void LedstripColorsDisplay::drawSide(Bobbycar_Side side, unsigned int color)
|
||||
}
|
||||
// espgui::tft.fillCircle(espgui::tft.width() / 2, 140, 100, TFT_BLACK);
|
||||
}
|
||||
#endif
|
||||
|
@ -10,16 +10,6 @@
|
||||
#include "bobbydisplaywithtitle.h"
|
||||
#include "ledstrip.h"
|
||||
|
||||
#ifdef FEATURE_LEDSTRIP
|
||||
//extern int8_t selected_side;
|
||||
//extern int8_t selected_color;
|
||||
//extern bool state_select_color;
|
||||
//extern bool last_state;
|
||||
|
||||
//extern const std::array<CRGB, 8> Colors;
|
||||
|
||||
//extern const std::array<uint16_t, 8> tft_colors;
|
||||
|
||||
class LedstripColorsDisplay : public BobbyDisplayWithTitle
|
||||
{
|
||||
using Base = BobbyDisplayWithTitle;
|
||||
@ -38,4 +28,3 @@ public:
|
||||
private:
|
||||
bool already_drew_circle{false};
|
||||
};
|
||||
#endif
|
||||
|
@ -1,6 +1,5 @@
|
||||
#include "ledstripmenu.h"
|
||||
|
||||
#ifdef FEATURE_LEDSTRIP
|
||||
// 3rdparty lib includes
|
||||
#include <FastLED.h>
|
||||
#include <actioninterface.h>
|
||||
@ -185,4 +184,3 @@ void LedstripMenu::back()
|
||||
{
|
||||
espgui::switchScreen<MainMenu>();
|
||||
}
|
||||
#endif
|
||||
|
@ -3,7 +3,6 @@
|
||||
// local includes
|
||||
#include "displays/menudisplaywithtime.h"
|
||||
|
||||
#ifdef FEATURE_LEDSTRIP
|
||||
class LedstripMenu : public bobbygui::MenuDisplayWithTime
|
||||
{
|
||||
public:
|
||||
@ -13,4 +12,3 @@ public:
|
||||
|
||||
void back() override;
|
||||
};
|
||||
#endif
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "ledstripselectblinkmenu.h"
|
||||
|
||||
#ifdef FEATURE_LEDSTRIP
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include "actions/dummyaction.h"
|
||||
#include "actions/switchscreenaction.h"
|
||||
@ -83,4 +81,3 @@ std::string CurrentSelectedBlinkAnimationText::text() const
|
||||
}
|
||||
|
||||
} // namespace
|
||||
#endif
|
||||
|
@ -3,7 +3,6 @@
|
||||
// Local includes
|
||||
#include "displays/bobbymenudisplay.h"
|
||||
|
||||
#ifdef FEATURE_LEDSTRIP
|
||||
class LedstripSelectBlinkMenu : public BobbyMenuDisplay
|
||||
{
|
||||
public:
|
||||
@ -12,4 +11,3 @@ public:
|
||||
std::string text() const override;
|
||||
void back() override;
|
||||
};
|
||||
#endif
|
||||
|
@ -10,7 +10,7 @@
|
||||
#include "utils.h"
|
||||
#include "ledstripmenu.h"
|
||||
|
||||
#if defined(FEATURE_LEDSTRIP) && defined(FEATURE_OTA)
|
||||
#ifdef FEATURE_OTA
|
||||
namespace {
|
||||
constexpr char TEXT_BLINKANIMATION[] = "Blink animation";
|
||||
constexpr char TEXT_OTAANIM_NONE[] = "None";
|
||||
|
@ -3,7 +3,7 @@
|
||||
// local includes
|
||||
#include "displays/bobbymenudisplay.h"
|
||||
|
||||
#if defined(FEATURE_LEDSTRIP) && defined(FEATURE_OTA)
|
||||
#ifdef FEATURE_OTA
|
||||
class LedstripOtaAnimationChangeMenu : public BobbyMenuDisplay
|
||||
{
|
||||
public:
|
||||
|
@ -42,9 +42,7 @@
|
||||
#ifdef FEATURE_OTA
|
||||
#include "icons/update.h"
|
||||
#endif
|
||||
#ifdef FEATURE_LEDSTRIP
|
||||
#include "icons/neopixel.h"
|
||||
#endif
|
||||
#include "icons/poweroff.h"
|
||||
#include "icons/reboot.h"
|
||||
#include "icons/statistics.h"
|
||||
@ -89,9 +87,10 @@ MainMenu::MainMenu()
|
||||
|
||||
// constructMenuItem<makeComponent<MenuItem, mainmenu::CurrentTimeText, DummyAction, StaticMenuItemIcon<&bobbyicons::time>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_STATUS>, SwitchScreenAction<StatusDisplay>, StaticMenuItemIcon<&espgui::icons::back>>>();
|
||||
#ifdef FEATURE_LEDSTRIP
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_LEDSTRIP>, SwitchScreenAction<LedstripMenu>, StaticMenuItemIcon<&bobbyicons::neopixel>>>();
|
||||
#endif
|
||||
if (configs.feature.ledstrip.value)
|
||||
{
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_LEDSTRIP>, SwitchScreenAction<LedstripMenu>, StaticMenuItemIcon<&bobbyicons::neopixel>>>();
|
||||
}
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_STATISTICSMENU>, SwitchScreenAction<StatisticsMenu>, StaticMenuItemIcon<&bobbyicons::statistics>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_SELECTMODE>, SwitchScreenAction<SelectModeMenu>, StaticMenuItemIcon<&bobbyicons::modes>>>();
|
||||
if (SHOWITEM) { constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_MODESETTINGS>, ModeSettingsAction>>(); }
|
||||
|
@ -103,7 +103,8 @@ void StatusDisplay::redraw()
|
||||
tft.fillRect(0, tft.height()-6, tft.width(), 6, TFT_BLACK);
|
||||
}
|
||||
}
|
||||
#ifdef FEATURE_LEDSTRIP
|
||||
|
||||
if(configs.feature.ledstrip.value)
|
||||
{
|
||||
static bool blink_fill_with_black;
|
||||
if (configs.ledstrip.enableVisualizeBlink.value && (espchrono::utc_clock::now().time_since_epoch() % 750ms < 375ms) && (blinkAnimation > 0))
|
||||
@ -126,7 +127,6 @@ void StatusDisplay::redraw()
|
||||
m_progressBarGas.start();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
tft.setTextFont(2);
|
||||
m_labelRawGas.redraw(raw_gas ? std::to_string(*raw_gas) : "?");
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
#ifdef FEATURE_LEDSTRIP
|
||||
std::vector<CRGB> leds;
|
||||
uint8_t gHue = 0;
|
||||
|
||||
@ -22,13 +21,19 @@ uint16_t blinkAnimation = LEDSTRIP_OVERWRITE_NONE;
|
||||
|
||||
void initLedStrip()
|
||||
{
|
||||
leds.resize(configs.ledstrip.ledsCount.value);
|
||||
FastLED.addLeds<NEOPIXEL, PINS_LEDSTRIP>(&*std::begin(leds), leds.size())
|
||||
.setCorrection(TypicalSMD5050);
|
||||
if (configs.feature.ledstrip.value)
|
||||
{
|
||||
leds.resize(configs.ledstrip.ledsCount.value);
|
||||
FastLED.addLeds<NEOPIXEL, PINS_LEDSTRIP>(&*std::begin(leds), leds.size())
|
||||
.setCorrection(TypicalSMD5050);
|
||||
}
|
||||
}
|
||||
|
||||
void updateLedStrip()
|
||||
{
|
||||
if(!configs.feature.ledstrip.value)
|
||||
return;
|
||||
|
||||
EVERY_N_MILLISECONDS( 20 ) { gHue++; }
|
||||
static bool have_disabled_beeper = false;
|
||||
const bool enAnim = configs.ledstrip.enableAnimBlink.value;
|
||||
@ -347,5 +352,3 @@ void showCustomColor()
|
||||
std::fill(center - (eighth_length / 2) - eighth_length - eighth_length - eighth_length, center - (eighth_length / 2) - eighth_length - eighth_length, ledstrip_custom_colors[int(Bobbycar_Side::FRONT_LEFT)]); // Front Left
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -23,7 +23,6 @@ DECLARE_BOBBYTYPESAFE_ENUM(OtaAnimationModes, : uint8_t, OtaAnimationModesValues
|
||||
x(CustomColor)
|
||||
DECLARE_BOBBYTYPESAFE_ENUM(LedstripAnimation, : uint8_t, LedstripAnimationValues)
|
||||
|
||||
#ifdef FEATURE_LEDSTRIP
|
||||
enum Bobbycar_Side
|
||||
{
|
||||
FRONT_RIGHT,
|
||||
@ -52,4 +51,3 @@ void showOtaAnimation();
|
||||
|
||||
void initLedStrip();
|
||||
void updateLedStrip();
|
||||
#endif
|
||||
|
@ -38,7 +38,7 @@ typename std::enable_if<
|
||||
!std::is_same<T, espchrono::minutes32>::value &&
|
||||
!std::is_same<T, espchrono::DayLightSavingMode>::value &&
|
||||
!std::is_same<T, UnifiedModelMode>::value
|
||||
#if defined(FEATURE_LEDSTRIP) && defined(FEATURE_OTA)
|
||||
#ifdef FEATURE_OTA
|
||||
&& !std::is_same<T, OtaAnimationModes>::value
|
||||
#endif
|
||||
, bool>::type
|
||||
@ -120,7 +120,7 @@ showInputForSetting(std::string_view key, T value, JsonObject &body)
|
||||
return true;
|
||||
}
|
||||
|
||||
#if defined(FEATURE_LEDSTRIP) && defined(FEATURE_OTA)
|
||||
#ifdef FEATURE_OTA
|
||||
|
||||
template<typename T>
|
||||
typename std::enable_if<
|
||||
|
Reference in New Issue
Block a user