Compare commits

..

No commits in common. "8568436fc16ba299768014413ec4631e5f8fc19b" and "efa9a73caead979a0667783f88a7538af61f5ecc" have entirely different histories.

6 changed files with 5 additions and 43 deletions

1
.gitignore vendored
View File

@ -9,4 +9,3 @@ include/config.h
.piolibdeps .piolibdeps
.pioenvs .pioenvs
.DS_Store .DS_Store
.vscode

View File

@ -4,12 +4,6 @@
#include "functions.h" #include "functions.h"
#include "Effect.h" #include "Effect.h"
enum SinematrixColorScheme {
SINEMATRIX_COLOR_PASTEL_RAINBOW,
SINEMATRIX_COLOR_RAINBOW,
SINEMATRIX_COLOR_PURPLEFLY,
};
class Sinematrix3Effect : public Effect { class Sinematrix3Effect : public Effect {
private: private:
double pangle = 0; double pangle = 0;
@ -31,14 +25,12 @@ private:
double fx = 1.0 / (LED_WIDTH / PI); double fx = 1.0 / (LED_WIDTH / PI);
double fy = 1.0 / (LED_HEIGHT / PI); double fy = 1.0 / (LED_HEIGHT / PI);
Matrix rotate; Matrix rotate;
SinematrixColorScheme _color_scheme;
CRGB _get_color(int value);
public: public:
Sinematrix3Effect(SinematrixColorScheme s = SINEMATRIX_COLOR_PASTEL_RAINBOW): _color_scheme(s) {};
boolean supports_window = true; boolean supports_window = true;
boolean can_be_shown_with_clock(); boolean can_be_shown_with_clock();
boolean clock_as_mask(); boolean clock_as_mask();
void loop(uint16_t ms); void loop(uint16_t ms);
String get_name() override { return "sinematrix3"; } String get_name() override { return "sinematrix3"; }
}; };

View File

@ -6,4 +6,3 @@
extern const TProgmemRGBGradientPalette_byte palette_fire[] FL_PROGMEM; extern const TProgmemRGBGradientPalette_byte palette_fire[] FL_PROGMEM;
extern const TProgmemRGBGradientPalette_byte palette_matrix[] FL_PROGMEM; extern const TProgmemRGBGradientPalette_byte palette_matrix[] FL_PROGMEM;
extern const TProgmemRGBGradientPalette_byte palette_purplefly_gp[] FL_PROGMEM;

View File

@ -9,14 +9,3 @@ __attribute__ ((aligned(4))) extern const TProgmemRGBGradientPalette_byte palett
__attribute__ ((aligned(4))) extern const TProgmemRGBGradientPalette_byte palette_matrix[] FL_PROGMEM = { __attribute__ ((aligned(4))) extern const TProgmemRGBGradientPalette_byte palette_matrix[] FL_PROGMEM = {
0, 0, 0, 0, // black 0, 0, 0, 0, // black
255, 0,255, 0 }; // green 255, 0,255, 0 }; // green
// Gradient palette "purplefly_gp", originally from
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/rc/tn/purplefly.png.index.html
// converted for FastLED with gammas (2.6, 2.2, 2.5)
// Size: 16 bytes of program space.
__attribute__ ((aligned(4))) extern const TProgmemRGBGradientPalette_byte palette_purplefly_gp[] FL_PROGMEM = {
0, 0, 0, 0,
63, 239, 0,122,
191, 252,255, 78,
255, 0, 0, 0};

View File

@ -2,9 +2,9 @@
#include "prototypes.h" #include "prototypes.h"
#include "functions.h" #include "functions.h"
#include "Effect.h" #include "Effect.h"
#include "my_color_palettes.h"
boolean Sinematrix3Effect::can_be_shown_with_clock() { return true; }; boolean Sinematrix3Effect::can_be_shown_with_clock() { return true; };
boolean Sinematrix3Effect::clock_as_mask() { return true; };
void Sinematrix3Effect::loop(uint16_t ms) { void Sinematrix3Effect::loop(uint16_t ms) {
pangle = addmodpi( pangle, 0.0133 + (angle / 256) ); pangle = addmodpi( pangle, 0.0133 + (angle / 256) );
angle = cos(pangle) * PI; angle = cos(pangle) * PI;
@ -44,22 +44,8 @@ void Sinematrix3Effect::loop(uint16_t ms) {
for ( int y = 0; y < LED_HEIGHT; y++ ) { for ( int y = 0; y < LED_HEIGHT; y++ ) {
Vector c = add(multiply( multiply(rotate, zoom), { .x1 = x - rcx, .x2 = y - rcy } ), translate); Vector c = add(multiply( multiply(rotate, zoom), { .x1 = x - rcx, .x2 = y - rcy } ), translate);
int sat = (basecol + basefield(c.x1, c.x2)) * 255; int sat = (basecol + basefield(c.x1, c.x2)) * 255;
CRGB color(_get_color(sat)); CRGB color(CHSV(sat, 120, 255));
window->setPixel(x, y, &color); window->setPixel(x, y, &color);
} }
} }
} }
CRGB Sinematrix3Effect::_get_color(int sat) {
switch(_color_scheme) {
case SINEMATRIX_COLOR_PASTEL_RAINBOW: return CRGB(CHSV(sat, 120, 255));
case SINEMATRIX_COLOR_RAINBOW: return CRGB(CHSV(sat, 255, 255));
case SINEMATRIX_COLOR_PURPLEFLY: return ColorFromPalette((CRGBPalette16)palette_purplefly_gp, (uint8_t)sat);
}
return CRGB(0xFF00FF);
}
boolean Sinematrix3Effect::clock_as_mask() {
if (_color_scheme == SINEMATRIX_COLOR_PASTEL_RAINBOW) return true;
return false;
};

View File

@ -55,11 +55,8 @@ const EffectEntry effects[] = {
/* 23 */ {"marquee", 0, [](){ return new MarqueeEffect(); }}, /* 23 */ {"marquee", 0, [](){ return new MarqueeEffect(); }},
/* 24 */ {"night_clock", false, [](){ return new NightClockEffect(); }}, /* 24 */ {"night_clock", false, [](){ return new NightClockEffect(); }},
/* 25 */ {"tv_static", false, [](){ return new TvStaticEffect(); }}, /* 25 */ {"tv_static", false, [](){ return new TvStaticEffect(); }},
/* 26 */ {"sinematrix3_rainbow", true,[](){ return new Sinematrix3Effect(SINEMATRIX_COLOR_RAINBOW); }},
/* 27 */ {"sinematrix3_purplefly", true,[](){ return new Sinematrix3Effect(SINEMATRIX_COLOR_PURPLEFLY); }},
}; };
const uint8_t effects_size = 28; const uint8_t effects_size = 26;
Effect* select_effect(const char* name) { Effect* select_effect(const char* name) {