esp32-sk6812/animation_test/src/main.cpp
Thomas Kolb f28de024d8 Added animation test framework
This framework provides the same animation interface as the ESP
firmware, but sends commands to the ESP via UDP. Therefore animations
can be tested without re-flashing the firmware for every tiny tuning
change.
2019-12-24 17:32:15 +01:00

52 lines
1.1 KiB
C++

#include <iostream>
#include <unistd.h>
#include "Fader.h"
#include "Animation/ImageScrollerAnimation.h"
int main(void)
{
Fader fader(8, 16);
ImageScrollerAnimation::Image img(12, 3);
img.pixel( 0 + 1, 0).r = 48;
img.pixel( 0 + 2, 1).r = 48;
img.pixel( 0 + 0, 2).r = 48;
img.pixel( 0 + 1, 2).r = 48;
img.pixel( 0 + 2, 2).r = 48;
img.pixel( 3 + 1, 0).g = 48;
img.pixel( 3 + 2, 1).g = 48;
img.pixel( 3 + 0, 2).g = 48;
img.pixel( 3 + 1, 2).g = 48;
img.pixel( 3 + 2, 2).g = 48;
img.pixel( 6 + 1, 0).b = 48;
img.pixel( 6 + 2, 1).b = 48;
img.pixel( 6 + 0, 2).b = 48;
img.pixel( 6 + 1, 2).b = 48;
img.pixel( 6 + 2, 2).b = 48;
img.pixel( 9 + 1, 0).w = 48;
img.pixel( 9 + 2, 1).w = 48;
img.pixel( 9 + 0, 2).w = 48;
img.pixel( 9 + 1, 2).w = 48;
img.pixel( 9 + 2, 2).w = 48;
Animation *animation = new ImageScrollerAnimation(&fader, &img);
for(uint64_t frame = 0; !animation->finished(); frame++) {
animation->loop(frame);
if(fader.something_changed()) {
fader.update();
}
if(frame == 3000) {
animation->stop();
}
usleep(100000);
};
delete animation;
}