Fixed snake animation

This commit is contained in:
greyhash
2022-04-18 16:39:47 +02:00
parent 5ad64d81d0
commit 936408a17a
2 changed files with 3 additions and 3 deletions

View File

@@ -17,7 +17,7 @@ using namespace std::chrono_literals;
std::vector<CRGB> leds; std::vector<CRGB> leds;
uint8_t gHue = 0; uint8_t gHue = 0;
int16_t gLedPosition = 0; float gLedPosition = 0; // yes, this is intendet as a float value! Do NOT change!
uint16_t blinkAnimation = LEDSTRIP_OVERWRITE_NONE; uint16_t blinkAnimation = LEDSTRIP_OVERWRITE_NONE;
@@ -333,7 +333,7 @@ void showDefaultLedstrip()
void showSnakeAnimation() void showSnakeAnimation()
{ {
const int16_t leds_per_cycle = floor<int16_t>(1. / std::max<int16_t>(1, configs.ledstrip.animationMultiplier.value)) * (avgSpeedKmh + 1); const float leds_per_cycle = (1. / std::max<int16_t>(1, configs.ledstrip.animationMultiplier.value)) * (avgSpeedKmh + 1); // yes, this is intendet as a float value! Do NOT change!
fadeToBlackBy(&*std::begin(leds), leds.size(), floor(20*leds_per_cycle)); fadeToBlackBy(&*std::begin(leds), leds.size(), floor(20*leds_per_cycle));
if (gLedPosition >= leds.size()) if (gLedPosition >= leds.size())
{ {

View File

@@ -39,7 +39,7 @@ enum Bobbycar_Side
extern std::vector<CRGB> leds; extern std::vector<CRGB> leds;
extern uint8_t gHue; extern uint8_t gHue;
extern int16_t gLedPosition; extern float gLedPosition; // yes, this is intendet as a float value! Do NOT change!
extern uint16_t blinkAnimation; extern uint16_t blinkAnimation;