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 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; } };
#ifdef FEATURE_OTA
struct LedstripOtaAnimationAccessor : public RefAccessorSaveSettings<OtaAnimationModes> { OtaAnimationModes &getRef() const override { return settings.ledstrip.otaMode; } };
#endif
#endif
// Battery
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_BLINKANIMATION>, SwitchScreenAction<LedstripSelectBlinkMenu>>>();
#ifdef FEATURE_OTA
if (!simplified) { constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_LEDSTRIP_CHANGE_OTA_ANIM>, SwitchScreenAction<ledstripOtaAnimationChangeMenu>>>(); }
#endif
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_CENTEROFFSET, CenterOffsetAccessor>, SwitchScreenAction<CenterOffsetChangeScreen>>>(); }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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