Experiment in getting the differing delays in Single/MultiDynamic effects to work. Unsuccessful, for now.
This commit is contained in:
parent
7fdc28fe48
commit
b2bc8aa75e
@ -4,9 +4,8 @@
|
||||
#include "effect_single_dynamic.h"
|
||||
|
||||
class MultiDynamicEffect : public SingleDynamicEffect {
|
||||
protected:
|
||||
int getLoopTime();
|
||||
public:
|
||||
MultiDynamicEffect();
|
||||
void update();
|
||||
};
|
||||
|
||||
|
@ -8,12 +8,13 @@ class SingleDynamicEffect : public Effect {
|
||||
protected:
|
||||
static const int factor = 2;
|
||||
static const int tile_count = LED_WIDTH/factor * LED_HEIGHT/factor;
|
||||
virtual int getLoopTime();
|
||||
int loopTime = 200;
|
||||
CRGB tiles[tile_count];
|
||||
CRGB old_tiles[tile_count];
|
||||
uint8_t blend = 0;
|
||||
public:
|
||||
SingleDynamicEffect();
|
||||
void init();
|
||||
virtual void update();
|
||||
boolean can_be_shown_with_clock();
|
||||
virtual void loop();
|
||||
|
@ -2,7 +2,11 @@
|
||||
#include "effect_single_dynamic.h"
|
||||
#include "config.h"
|
||||
|
||||
int MultiDynamicEffect::getLoopTime() { return EFFECT_MULTI_DYNAMIC_LOOP_TIME; }
|
||||
MultiDynamicEffect::MultiDynamicEffect() {
|
||||
init();
|
||||
loopTime = EFFECT_MULTI_DYNAMIC_LOOP_TIME;
|
||||
}
|
||||
|
||||
void MultiDynamicEffect::update() {
|
||||
for (int i=0; i<tile_count; i++) tiles[i] = CHSV(baseHue + random8(64), 180, 255);
|
||||
}
|
||||
|
@ -2,17 +2,22 @@
|
||||
#include "functions.h"
|
||||
|
||||
SingleDynamicEffect::SingleDynamicEffect() {
|
||||
init();
|
||||
loopTime = EFFECT_SINGLE_DYNAMIC_LOOP_TIME;
|
||||
}
|
||||
|
||||
void SingleDynamicEffect::init() {
|
||||
for (int i=0; i<tile_count; i++) tiles[i] = CHSV(baseHue + random8(64), 180, 255);
|
||||
}
|
||||
int SingleDynamicEffect::getLoopTime() {
|
||||
return EFFECT_SINGLE_DYNAMIC_LOOP_TIME;
|
||||
}
|
||||
|
||||
void SingleDynamicEffect::update() {
|
||||
tiles[random8(tile_count)] = CHSV(baseHue + random8(64), 180, 255);
|
||||
}
|
||||
|
||||
boolean SingleDynamicEffect::can_be_shown_with_clock() { return true; }
|
||||
|
||||
void SingleDynamicEffect::loop() {
|
||||
EVERY_N_MILLISECONDS(getLoopTime()) {
|
||||
/*EVERY_N_MILLISECONDS(loopTime) {
|
||||
memcpy(old_tiles, tiles, tile_count*sizeof(CRGB));
|
||||
blend = 0;
|
||||
update();
|
||||
@ -22,5 +27,12 @@ void SingleDynamicEffect::loop() {
|
||||
int index = y/2 * window.w/2 + x/2;
|
||||
setPixel(window, x, y, nblend(old_tiles[index], tiles[index], blend));
|
||||
}
|
||||
if (blend < 255) blend+=20;
|
||||
if (blend < 255) blend+=20;*/
|
||||
EVERY_N_MILLISECONDS(loopTime) {
|
||||
update();
|
||||
}
|
||||
for (int x=0; x<window.w; x++) for (int y=0; y<window.h; y++) {
|
||||
int index = y/2 * window.w/2 + x/2;
|
||||
setPixel(window, x, y, tiles[index]);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user