Added effect analog_clock (heavily, not-really-usable work-in-progress!).

This commit is contained in:
Fabian Schlenz 2019-09-25 06:24:24 +02:00
parent 792354e371
commit 96e144f96b
3 changed files with 35 additions and 0 deletions

View File

@ -0,0 +1,8 @@
#pragma once
#include "Effect.h"
class AnalogClockEffect : public Effect {
public:
void loop();
};

View File

@ -0,0 +1,23 @@
#include "effect_analogclock.h"
#include "my_fastled.h"
#include "ntp.h"
void AnalogClockEffect::loop() {
window->clear();
CRGB white(0xFFFFFF);
CRGB red(0xFF0000);
window->circle(8, 8, 7, &white);
uint8_t seconds = ntpClient.getSeconds();
uint8_t angle = 6 * seconds;
window->lineWithAngle(8, 8, angle, 0, 10, &red);
/*for (uint8_t i=0; i<=12; i++) {
window->lineWithAngle(8, 8, 255/12*i, 5, 2, &white);
}
uint8_t minutes = ntpClient.getMinutes();
uint8_t hours = ntpClient.getHours();
window->lineWithAngle(8, 8, 255/60*minutes, 6, &white);
window->lineWithAngle(8, 8, 255/12*(hours % 12), 4, &white);*/
}

View File

@ -18,6 +18,8 @@
#include "effect_gol.h"
#include "effect_pixelclock.h"
#include "effect_dvd.h"
#include "effect_analogclock.h"
#include "effect_sines.h"
Effect* current_effect;
@ -51,6 +53,8 @@ Effect* select_effect(uint32_t code) {
case 22: case 0x2C0E6962 /* big_dynamic */ : return new BigDynamicEffect();
case 23: case 0xDA6F31A5 /* random_confetti */ : return new RandomConfettiEffect();
case 24: case 0x8325C1DF /* dvd */ : return new DvdEffect();
case 25: case 0x8CA97519 /* analog_clock */ : return new AnalogClockEffect();
case 26: case 0xADB18CC5 /* sines */ : return new SinesEffect();
default : return NULL;
};
}