impove led animation switch
This commit is contained in:
@@ -89,5 +89,5 @@ set(BOBBYCAR_BUILDFLAGS
|
|||||||
-DLEDSTRIP_LENGTH=121
|
-DLEDSTRIP_LENGTH=121
|
||||||
-DHEAP_LRGST_CRASH_TEXT_FIX
|
-DHEAP_LRGST_CRASH_TEXT_FIX
|
||||||
-DLEDSTRIP_WRONG_DIRECTION
|
-DLEDSTRIP_WRONG_DIRECTION
|
||||||
-DLEDSTRIP_ANIMATION_DEFAULT=4
|
-DLEDSTRIP_ANIMATION_DEFAULT=1
|
||||||
)
|
)
|
||||||
|
@@ -92,5 +92,5 @@ set(BOBBYCAR_BUILDFLAGS
|
|||||||
-DPINS_LEDSTRIP=33
|
-DPINS_LEDSTRIP=33
|
||||||
-DLEDSTRIP_LENGTH=288
|
-DLEDSTRIP_LENGTH=288
|
||||||
# -DLEDSTRIP_WRONG_DIRECTION
|
# -DLEDSTRIP_WRONG_DIRECTION
|
||||||
# -DLEDSTRIP_ANIMATION_DEFAULT=0
|
-DLEDSTRIP_ANIMATION_DEFAULT=1
|
||||||
)
|
)
|
||||||
|
@@ -45,8 +45,8 @@ public:
|
|||||||
bool &profile2{this->at(DPAD_5WIRESW_PROFILE2)};
|
bool &profile2{this->at(DPAD_5WIRESW_PROFILE2)};
|
||||||
bool &profile3{this->at(DPAD_5WIRESW_PROFILE3)};
|
bool &profile3{this->at(DPAD_5WIRESW_PROFILE3)};
|
||||||
|
|
||||||
bool &blink_left{this->at(DPAD_5WIRESW_BLINK_RIGHT)};
|
bool &blink_left{this->at(DPAD_5WIRESW_BLINK_LEFT)};
|
||||||
bool &blink_right{this->at(DPAD_5WIRESW_BLINK_LEFT)};
|
bool &blink_right{this->at(DPAD_5WIRESW_BLINK_RIGHT)};
|
||||||
bool &quickaction_down{this->at(DPAD_5WIRESW_QUICKACTION_DOWN)};
|
bool &quickaction_down{this->at(DPAD_5WIRESW_QUICKACTION_DOWN)};
|
||||||
bool &quickaction_up{this->at(DPAD_5WIRESW_QUICKACTION_UP)};
|
bool &quickaction_up{this->at(DPAD_5WIRESW_QUICKACTION_UP)};
|
||||||
};
|
};
|
||||||
|
@@ -23,6 +23,7 @@ void showSpeedSyncAnimation();
|
|||||||
|
|
||||||
void initLedStrip()
|
void initLedStrip()
|
||||||
{
|
{
|
||||||
|
animation_type = settings.ledstrip.animationType;
|
||||||
leds.resize(settings.ledstrip.ledsCount);
|
leds.resize(settings.ledstrip.ledsCount);
|
||||||
FastLED.addLeds<NEOPIXEL, PINS_LEDSTRIP>(&*std::begin(leds), leds.size())
|
FastLED.addLeds<NEOPIXEL, PINS_LEDSTRIP>(&*std::begin(leds), leds.size())
|
||||||
.setCorrection(TypicalSMD5050);
|
.setCorrection(TypicalSMD5050);
|
||||||
@@ -41,7 +42,7 @@ void updateLedStrip()
|
|||||||
auto color = CRGB{255, 255, 0};
|
auto color = CRGB{255, 255, 0};
|
||||||
const auto center = (std::begin(leds) + (leds.size() / 2) + settings.ledstrip.centerOffset);
|
const auto center = (std::begin(leds) + (leds.size() / 2) + settings.ledstrip.centerOffset);
|
||||||
|
|
||||||
#ifdef LEDSTRIP_WRONG_DIRECTION
|
#ifndef LEDSTRIP_WRONG_DIRECTION
|
||||||
if (blinkAnimation != LEDSTRIP_OVERWRITE_BLINKRIGHT)
|
if (blinkAnimation != LEDSTRIP_OVERWRITE_BLINKRIGHT)
|
||||||
std::fill(center - settings.ledstrip.bigOffset, center - settings.ledstrip.smallOffset, color);
|
std::fill(center - settings.ledstrip.bigOffset, center - settings.ledstrip.smallOffset, color);
|
||||||
if (blinkAnimation != LEDSTRIP_OVERWRITE_BLINKLEFT)
|
if (blinkAnimation != LEDSTRIP_OVERWRITE_BLINKLEFT)
|
||||||
|
@@ -12,6 +12,7 @@
|
|||||||
// local includes
|
// local includes
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include "stringsettings.h"
|
#include "stringsettings.h"
|
||||||
|
#include "ledstripdefines.h"
|
||||||
|
|
||||||
using namespace std::chrono_literals;
|
using namespace std::chrono_literals;
|
||||||
|
|
||||||
@@ -230,7 +231,13 @@ constexpr Settings::Ledstrip defaultLedstrip {
|
|||||||
.centerOffset = 1,
|
.centerOffset = 1,
|
||||||
.smallOffset = 4,
|
.smallOffset = 4,
|
||||||
.bigOffset = 10,
|
.bigOffset = 10,
|
||||||
.deziampere = 30
|
.deziampere = 30,
|
||||||
|
#ifdef LEDSTRIP_ANIMATION_DEFAULT
|
||||||
|
.animationType = LEDSTRIP_ANIMATION_DEFAULT
|
||||||
|
#else
|
||||||
|
.animationType = LEDSTRIP_ANIMATION_TYPE_DEFAULTRAINBOW
|
||||||
|
#endif
|
||||||
|
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -161,6 +161,7 @@ struct Settings
|
|||||||
int16_t smallOffset;
|
int16_t smallOffset;
|
||||||
int16_t bigOffset;
|
int16_t bigOffset;
|
||||||
int16_t deziampere;
|
int16_t deziampere;
|
||||||
|
int16_t animationType;
|
||||||
} ledstrip;
|
} ledstrip;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -259,7 +260,8 @@ void Settings::executeForEveryCommonSetting(T &&callable)
|
|||||||
callable("centerOffset", ledstrip.centerOffset);
|
callable("centerOffset", ledstrip.centerOffset);
|
||||||
callable("smallOffset", ledstrip.smallOffset);
|
callable("smallOffset", ledstrip.smallOffset);
|
||||||
callable("bigOffset", ledstrip.bigOffset);
|
callable("bigOffset", ledstrip.bigOffset);
|
||||||
callable("deziampere", ledstrip.deziampere);
|
//callable("deziampere", ledstrip.deziampere);
|
||||||
|
callable("animationType", ledstrip.animationType);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
callable("lockAlwPresetSw", lockscreen.allowPresetSwitch);
|
callable("lockAlwPresetSw", lockscreen.allowPresetSwitch);
|
||||||
|
Reference in New Issue
Block a user