Skip to content

Commit 734f1ea

Browse files
committed
Create FastLED .h and .cpp
1 parent 96bcf01 commit 734f1ea

File tree

2 files changed

+122
-0
lines changed

2 files changed

+122
-0
lines changed

src/MoonLight/EffectsFastLED.cpp

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
/**
2+
@title MoonLight
3+
@file EffectsFastLED.h
4+
@repo https://github.com/ewowi/MoonBase, submit changes to this file as PRs
5+
@Authors https://github.com/ewowi/MoonBase/commits/main
6+
@Doc https://ewowi.github.io/MoonBase/general/utilities/
7+
@Copyright © 2025 Github MoonBase Commit Authors
8+
@license GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007
9+
@license For non GPL-v3 usage, commercial licenses must be purchased. Contact [email protected]
10+
**/
11+
12+
#include "EffectsFastLED.h"
13+
14+
#include "FastLED.h"
15+
#include "fl/ui.h"
16+
#include "fl/xymap.h"
17+
#include "fx/time.h"
18+
19+
using namespace fl;
20+
21+
#define HEIGHT 100
22+
#define WIDTH 100
23+
#define SERPENTINE true
24+
#define BRIGHTNESS 255
25+
26+
DEFINE_GRADIENT_PALETTE(firepal){
27+
// define fire palette
28+
0, 0, 0, 0, // black
29+
32, 255, 0, 0, // red
30+
190, 255, 255, 0, // yellow
31+
255, 255, 255, 255 // white
32+
};
33+
34+
DEFINE_GRADIENT_PALETTE(electricGreenFirePal){
35+
0, 0, 0, 0, // black
36+
32, 0, 70, 0, // dark green
37+
190, 57, 255, 20, // electric neon green
38+
255, 255, 255, 255 // white
39+
};
40+
41+
DEFINE_GRADIENT_PALETTE(electricBlueFirePal) {
42+
0, 0, 0, 0, // Black
43+
32, 0, 0, 70, // Dark blue
44+
128, 20, 57, 255, // Electric blue
45+
255, 255, 255, 255 // White
46+
};
47+
48+
49+
XYMap xyMap(HEIGHT, WIDTH, SERPENTINE);
50+
51+
52+
// void FireMatrixEffect::loop() {
53+
// CRGBPalette16 myPal = getPalette();
54+
// uint32_t now = millis();
55+
// TimeWarp timeScale(0, 1.0f);
56+
// timeScale.setSpeed(speedY);
57+
// uint32_t y_speed = timeScale.update(now);
58+
// for (int i = 0; i < HEIGHT; i++) {
59+
// for (int j = 0; j < WIDTH; j++) {
60+
// uint8_t palette_index = getPaletteIndex(now, i, j, y_speed);
61+
// CRGB c = ColorFromPalette(myPal, palette_index, BRIGHTNESS);
62+
// int index = xyMap((HEIGHT - 1) - i, (WIDTH - 1) - j);
63+
// leds[index] = c;
64+
// }
65+
// }
66+
// layerV->setPixelColor(0, CRGB(0,0,0));
67+
// }
68+
69+
// CRGBPalette16 FireMatrixEffect::getPalette() {
70+
// // get palette
71+
// switch (palette) {
72+
// case 0:
73+
// return firepal;
74+
// case 1:
75+
// return electricGreenFirePal;
76+
// case 2:
77+
// return electricBlueFirePal;
78+
// default:
79+
// return firepal;
80+
// }
81+
// }

src/MoonLight/EffectsFastLED.h

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/**
2+
@title MoonLight
3+
@file EffectsFastLED.h
4+
@repo https://github.com/ewowi/MoonBase, submit changes to this file as PRs
5+
@Authors https://github.com/ewowi/MoonBase/commits/main
6+
@Doc https://ewowi.github.io/MoonBase/general/utilities/
7+
@Copyright © 2025 Github MoonBase Commit Authors
8+
@license GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007
9+
@license For non GPL-v3 usage, commercial licenses must be purchased. Contact [email protected]
10+
**/
11+
12+
// #pragma once
13+
14+
// #include <Arduino.h>
15+
16+
// class FireMatrixEffect: public Node {
17+
// public:
18+
19+
// uint8_t speed = 128;
20+
// uint8_t palette = 0;
21+
22+
// void getControls(JsonArray controls) override {
23+
// JsonObject control;
24+
// control = controls.add<JsonObject>(); control["name"] = "speed"; control["type"] = "range"; control["default"] = 128; control["value"] = speed;
25+
// }
26+
27+
// void setControl(JsonObject control) override {
28+
// ESP_LOGD(TAG, "%s = %s", control["name"].as<String>().c_str(), control["value"].as<String>().c_str());
29+
// if (control["name"] == "speed") speed = control["value"];
30+
// }
31+
32+
// const char * name() override {return "Lissajous";}
33+
// uint8_t dim() override {return _1D;}
34+
// const char * tags() override {return "💡";}
35+
36+
// void setup() override {}
37+
38+
// void loop() override;
39+
40+
// CRGBPalette16 getPalette();
41+
// };

0 commit comments

Comments
 (0)