musicmouse/espmusicmouse/src/host_test.cpp

40 lines
853 B
C++
Raw Normal View History

2021-11-19 17:22:09 +01:00
#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;
}