Alexa swipe effect
This commit is contained in:
@@ -75,8 +75,9 @@ void _led_task_func(void *params)
|
||||
|
||||
TLedStrip &ledStrip = *(task->ledStrip_);
|
||||
// clang-format off
|
||||
if (dispatchEffectId<EffectId::CIRCULAR>(id, effectFunction, ledStrip, msgBuffer, effectStorage)) { Serial.println("Parsed circular");}
|
||||
else if (dispatchEffectId<EffectId::STATIC >(id, effectFunction, ledStrip, msgBuffer, effectStorage)) { Serial.println("Parsed static");}
|
||||
if (dispatchEffectId<EffectId::CIRCULAR >(id, effectFunction, ledStrip, msgBuffer, effectStorage)) { Serial.println("Parsed circular");}
|
||||
else if (dispatchEffectId<EffectId::STATIC >(id, effectFunction, ledStrip, msgBuffer, effectStorage)) { Serial.println("Parsed static");}
|
||||
else if (dispatchEffectId<EffectId::ALEXA_SWIPE>(id, effectFunction, ledStrip, msgBuffer, effectStorage)) { Serial.println("Alexa swipe");}
|
||||
// clang-format on
|
||||
|
||||
timeoutMsForEffect = 0;
|
||||
@@ -99,7 +100,7 @@ void LedTask<TLedStrip>::begin(TLedStrip &strip, Esp32DriverRGBW &driver)
|
||||
ledStrip_ = &strip;
|
||||
driver_ = &driver;
|
||||
|
||||
xTaskCreate(_led_task_func<TLedStrip>, "led task", MAX_EFFECT_CLASS_SIZE + MAX_EFFECT_CONFIG_SIZE + 2048,
|
||||
xTaskCreate(_led_task_func<TLedStrip>, "led task", MAX_EFFECT_CLASS_SIZE + MAX_EFFECT_CONFIG_SIZE + 2048 * 2,
|
||||
(void *)(this), 1, nullptr);
|
||||
}
|
||||
|
||||
|
||||
40
espmusicmouse/src/host_test.cpp
Normal file
40
espmusicmouse/src/host_test.cpp
Normal file
@@ -0,0 +1,40 @@
|
||||
|
||||
#include "containers/LedStripRGBW.h"
|
||||
|
||||
#include "effects/AlexaSwipe.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
template <typename T>
|
||||
void printVec(const std::vector<T> &vec)
|
||||
{
|
||||
std::cout << "[";
|
||||
for (const auto &e : vec)
|
||||
std::cout << e << ",";
|
||||
std::cout << "]\n";
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
auto cfg = EffectAlexaSwipeConfig{20, 20, 90, 5, 180, ColorRGBW{255, 0, 0, 0}, ColorRGBW{0, 0, 255, 0}};
|
||||
LedStripRGBW<51> strip;
|
||||
|
||||
EffectAlexaSwipe<decltype(strip)> effect(cfg, strip);
|
||||
effect.currentPosition_ = 150;
|
||||
|
||||
const auto numLeds = strip.numLeds() / 2;
|
||||
|
||||
std::vector<float> brightness(numLeds, 0);
|
||||
std::vector<float> interpolation(numLeds, 0);
|
||||
|
||||
for (int i = 0; i < numLeds; ++i)
|
||||
effect.getParams(float(i), interpolation[i], brightness[i]);
|
||||
|
||||
printVec(brightness);
|
||||
printVec(interpolation);
|
||||
|
||||
effect();
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -2,14 +2,13 @@
|
||||
#include "rc522.h"
|
||||
#include "SPI.h"
|
||||
#include <MFRC522.h>
|
||||
#include "LedControl.h"
|
||||
#include "rotary_encoder.h"
|
||||
#include "LedAnimation.h"
|
||||
|
||||
#include "containers/LedStripRGBW.h"
|
||||
#include "drivers/Esp32DriverRGBW.h"
|
||||
#include "effects/Circular.h"
|
||||
#include "effects/Static.h"
|
||||
#include "effects/AlexaSwipe.h"
|
||||
|
||||
#include "TaskLed.h"
|
||||
|
||||
@@ -34,12 +33,13 @@ void tag_handler(uint8_t *sn)
|
||||
if (sn[4] == 0x30)
|
||||
{
|
||||
Serial.println("Fuchs");
|
||||
ledTask.startEffect(EffectCircularConfig{2 * 360, 180, ColorRGBW{0, 0, 255, 0}});
|
||||
//ledTask.startEffect(EffectCircularConfig{2 * 360, 180, ColorRGBW{0, 0, 255, 0}});
|
||||
ledTask.startEffect(EffectAlexaSwipeConfig{20, 30, 3 * 360, 3, 180, ColorRGBW{0, 255, 0, 0}, ColorRGBW{0, 0, 255, 0}});
|
||||
}
|
||||
if (sn[4] == 0xf0)
|
||||
{
|
||||
Serial.println("Eule");
|
||||
ledTask.startEffect(EffectCircularConfig{180, 180, ColorRGBW{0, 0, 0, 128}});
|
||||
ledTask.startEffect(EffectCircularConfig{360, 180, ColorRGBW{0, 0, 255, 0}});
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -94,7 +94,6 @@ void setup()
|
||||
|
||||
bool btn2state = true;
|
||||
|
||||
SweepCircularAnimation animation(ColorRGB{0, 0, 255}, 100, 15, 0.7);
|
||||
void loop()
|
||||
{
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user