Fixed non-feature-ota compiling

This commit is contained in:
CommanderRedYT
2021-12-09 08:06:38 +01:00
parent 38470629b8
commit 64ac74ea5d
8 changed files with 25 additions and 4 deletions

View File

@ -179,8 +179,10 @@ struct EnableLedstripStVOFrontlight : public RefAccessorSaveSettings<bool> { boo
struct AnimationMultiplierAccessor : public RefAccessorSaveSettings<int16_t> { int16_t &getRef() const override { return settings.ledstrip.animationMultiplier; } }; struct AnimationMultiplierAccessor : public RefAccessorSaveSettings<int16_t> { int16_t &getRef() const override { return settings.ledstrip.animationMultiplier; } };
struct LedstripBrightnessAccessor : public RefAccessorSaveSettings<uint8_t> { uint8_t &getRef() const override { return settings.ledstrip.brightness; } }; struct LedstripBrightnessAccessor : public RefAccessorSaveSettings<uint8_t> { uint8_t &getRef() const override { return settings.ledstrip.brightness; } };
struct LedstripEnableBlinkAnimationAccessor : public RefAccessorSaveSettings<bool> { bool &getRef() const override { return settings.ledstrip.enableAnimBlink; } }; struct LedstripEnableBlinkAnimationAccessor : public RefAccessorSaveSettings<bool> { bool &getRef() const override { return settings.ledstrip.enableAnimBlink; } };
#ifdef FEATURE_OTA
struct LedstripOtaAnimationAccessor : public RefAccessorSaveSettings<OtaAnimationModes> { OtaAnimationModes &getRef() const override { return settings.ledstrip.otaMode; } }; struct LedstripOtaAnimationAccessor : public RefAccessorSaveSettings<OtaAnimationModes> { OtaAnimationModes &getRef() const override { return settings.ledstrip.otaMode; } };
#endif #endif
#endif
// Battery // Battery
struct BatterySeriesCellsAccessor : public RefAccessorSaveSettings<uint8_t> { uint8_t &getRef() const override { return settings.battery.cellsSeries; } }; struct BatterySeriesCellsAccessor : public RefAccessorSaveSettings<uint8_t> { uint8_t &getRef() const override { return settings.battery.cellsSeries; } };

View File

@ -127,7 +127,9 @@ LedstripMenu::LedstripMenu()
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_SELECTANIMATION>, SwitchScreenAction<LedstripSelectAnimationMenu>>>(); constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_SELECTANIMATION>, SwitchScreenAction<LedstripSelectAnimationMenu>>>();
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BLINKANIMATION>, SwitchScreenAction<LedstripSelectBlinkMenu>>>(); constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BLINKANIMATION>, SwitchScreenAction<LedstripSelectBlinkMenu>>>();
#ifdef FEATURE_OTA
if (!simplified) { constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_LEDSTRIP_CHANGE_OTA_ANIM>, SwitchScreenAction<ledstripOtaAnimationChangeMenu>>>(); } if (!simplified) { constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_LEDSTRIP_CHANGE_OTA_ANIM>, SwitchScreenAction<ledstripOtaAnimationChangeMenu>>>(); }
#endif
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_ANIMATION_MULTIPLIER>, SwitchScreenAction<animationMultiplierChangeScreen>>>(); constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_ANIMATION_MULTIPLIER>, SwitchScreenAction<animationMultiplierChangeScreen>>>();
if (!simplified) { constructMenuItem<makeComponent<MenuItem, TextWithValueHelper<TEXT_LEDSCOUNT, LedsCountAccessor>, SwitchScreenAction<LedsCountChangeScreen>>>(); } if (!simplified) { constructMenuItem<makeComponent<MenuItem, TextWithValueHelper<TEXT_LEDSCOUNT, LedsCountAccessor>, SwitchScreenAction<LedsCountChangeScreen>>>(); }
if (!simplified) { constructMenuItem<makeComponent<MenuItem, TextWithValueHelper<TEXT_CENTEROFFSET, CenterOffsetAccessor>, SwitchScreenAction<CenterOffsetChangeScreen>>>(); } if (!simplified) { constructMenuItem<makeComponent<MenuItem, TextWithValueHelper<TEXT_CENTEROFFSET, CenterOffsetAccessor>, SwitchScreenAction<CenterOffsetChangeScreen>>>(); }

View File

@ -11,7 +11,7 @@
#include "accessors/settingsaccessors.h" #include "accessors/settingsaccessors.h"
#include "ledstripmenu.h" #include "ledstripmenu.h"
#ifdef FEATURE_LEDSTRIP #if defined(FEATURE_LEDSTRIP) && defined(FEATURE_OTA)
using namespace espgui; using namespace espgui;
template <OtaAnimationModes mode> template <OtaAnimationModes mode>

View File

@ -213,7 +213,12 @@ void updateLedStrip()
void showAnimation() void showAnimation()
{ {
if (settings.ledstrip.enableLedAnimation && !simplified && !(asyncOtaTaskStarted && settings.ledstrip.otaMode != OtaAnimationModes::None)) if (settings.ledstrip.enableLedAnimation
&& !simplified
#ifdef FEATURE_OTA
&& !(asyncOtaTaskStarted && settings.ledstrip.otaMode != OtaAnimationModes::None)
#endif
)
{ {
if (animation_type == LedstripAnimation::DefaultRainbow) showDefaultLedstrip(); if (animation_type == LedstripAnimation::DefaultRainbow) showDefaultLedstrip();
else if (animation_type == LedstripAnimation::BetterRainbow) showBetterRainbow(); else if (animation_type == LedstripAnimation::BetterRainbow) showBetterRainbow();
@ -221,17 +226,20 @@ void showAnimation()
else if (animation_type == LedstripAnimation::CustomColor) showCustomColor(); else if (animation_type == LedstripAnimation::CustomColor) showCustomColor();
else showDefaultLedstrip(); else showDefaultLedstrip();
} }
#ifdef FEATURE_OTA
else if (asyncOtaTaskStarted && settings.ledstrip.otaMode != OtaAnimationModes::None) else if (asyncOtaTaskStarted && settings.ledstrip.otaMode != OtaAnimationModes::None)
{ {
// show ota animation // show ota animation
showOtaAnimation(); showOtaAnimation();
} }
#endif
else else
{ {
std::fill(std::begin(leds), std::end(leds), CRGB{0, 0, 0}); std::fill(std::begin(leds), std::end(leds), CRGB{0, 0, 0});
} }
} }
#ifdef FEATURE_OTA
void showOtaAnimation() void showOtaAnimation()
{ {
std::fill(std::begin(leds), std::end(leds), CRGB{0,0,0}); std::fill(std::begin(leds), std::end(leds), CRGB{0,0,0});
@ -260,6 +268,7 @@ void showOtaAnimation()
} }
} }
} }
#endif
void showBetterRainbow() void showBetterRainbow()
{ {

View File

@ -19,12 +19,14 @@ enum Bobbycar_Side
FRONT FRONT
}; };
#ifdef FEATURE_OTA
enum OtaAnimationModes enum OtaAnimationModes
{ {
None, None,
GreenProgressBar, GreenProgressBar,
ColorChangeAll ColorChangeAll
}; };
#endif
extern std::vector<CRGB> leds; extern std::vector<CRGB> leds;
extern uint8_t gHue; extern uint8_t gHue;
@ -37,7 +39,9 @@ void showAnimation();
void showBetterRainbow(); void showBetterRainbow();
void showSpeedSyncAnimation(); void showSpeedSyncAnimation();
void showCustomColor(); void showCustomColor();
#ifdef FEATURE_OTA
void showOtaAnimation(); void showOtaAnimation();
#endif
void initLedStrip(); void initLedStrip();
void updateLedStrip(); void updateLedStrip();

View File

@ -266,7 +266,9 @@ constexpr Settings::Ledstrip defaultLedstrip {
.animationMultiplier = 10, .animationMultiplier = 10,
.brightness = 255, .brightness = 255,
.enableAnimBlink = false, .enableAnimBlink = false,
#ifdef FEATURE_OTA
.otaMode = OtaAnimationModes::GreenProgressBar .otaMode = OtaAnimationModes::GreenProgressBar
#endif
}; };
#endif #endif

View File

@ -183,7 +183,9 @@ struct Settings
int16_t animationMultiplier; int16_t animationMultiplier;
uint8_t brightness; uint8_t brightness;
bool enableAnimBlink; bool enableAnimBlink;
#ifdef FEATURE_OTA
OtaAnimationModes otaMode; OtaAnimationModes otaMode;
#endif
} ledstrip; } ledstrip;
#endif #endif
@ -330,7 +332,9 @@ void Settings::executeForEveryCommonSetting(T &&callable)
callable("ledAnimMul", ledstrip.animationMultiplier); callable("ledAnimMul", ledstrip.animationMultiplier);
callable("ledbrightness", ledstrip.brightness); callable("ledbrightness", ledstrip.brightness);
callable("enAnimBlink", ledstrip.enableAnimBlink); callable("enAnimBlink", ledstrip.enableAnimBlink);
#ifdef FEATURE_OTA
callable("ledOtaAnim", ledstrip.otaMode); callable("ledOtaAnim", ledstrip.otaMode);
#endif
#endif #endif
callable("batteryCS", battery.cellsSeries); callable("batteryCS", battery.cellsSeries);

View File

@ -4,11 +4,9 @@ constexpr const char * const TAG = "bobbycloud";
// 3rd party includes // 3rd party includes
#include <ArduinoJson.h> #include <ArduinoJson.h>
#include <FastLED.h> #include <FastLED.h>
#ifdef FEATURE_OTA
#include <espcppmacros.h> #include <espcppmacros.h>
#include <espstrutils.h> #include <espstrutils.h>
#include <esp_ota_ops.h> #include <esp_ota_ops.h>
#endif
// local includes // local includes
#include "udpcloud.h" #include "udpcloud.h"