Skip to content

Commit 5ab7948

Browse files
committed
Add Dig-Octa-32-8L, Quin and Orange palette, Random using palette
Back-end ======== - IO: add Dig-Octa-32-8L - LightsControl: Add Quin and Orange palette - Moonlight effects: random, use palette
1 parent 429a6e4 commit 5ab7948

File tree

3 files changed

+29
-12
lines changed

3 files changed

+29
-12
lines changed

src/MoonBase/Modules/ModuleIO.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,8 +322,12 @@ class ModuleIO : public Module {
322322
// pinAssigner.assignPin(15, pin_I2S_SCK;
323323
// pinAssigner.assignPin(32, pin_Exposed;
324324
} else if (boardID == board_QuinLEDDigOctoV2) {
325+
//Dig-Octa-32-8L
325326
uint8_t ledPins[8] = {0, 1, 2, 3, 4, 5, 12, 13}; // LED_PINS
326327
for (int i = 0; i < sizeof(ledPins); i++) pinAssigner.assignPin(ledPins[i], pin_LED);
328+
pinAssigner.assignPin(33, pin_Relay);
329+
pinAssigner.assignPin(34, pin_ButtonPush);
330+
327331
} else if (boardID == board_QuinLEDPenta) {
328332
uint8_t ledPins[5] = {14, 13, 12, 4, 2}; // LED_PINS
329333
for (int i = 0; i < sizeof(ledPins); i++) pinAssigner.assignPin(ledPins[i], pin_LED);

src/MoonLight/Modules/ModuleLightsControl.h

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ class ModuleLightsControl : public Module {
9696
control = addControl(controls, "lightsOn", "checkbox");
9797
control["default"] = true;
9898
control = addControl(controls, "brightness", "slider");
99-
control["default"] = 10;
99+
control["default"] = 20;
100100
control = addControl(controls, "red", "slider");
101101
control["default"] = 255;
102102
control["color"] = "Red";
@@ -108,15 +108,18 @@ class ModuleLightsControl : public Module {
108108
control["color"] = "Blue";
109109
control = addControl(controls, "palette", "select");
110110
control["default"] = 6;
111-
addControlValue(control, "CloudColors");
112-
addControlValue(control, "LavaColors");
113-
addControlValue(control, "OceanColors");
114-
addControlValue(control, "ForestColors");
115-
addControlValue(control, "RainbowColors");
116-
addControlValue(control, "RainbowStripeColors");
117-
addControlValue(control, "PartyColors");
118-
addControlValue(control, "HeatColors");
119-
addControlValue(control, "RandomColors");
111+
addControlValue(control, "Cloud");
112+
addControlValue(control, "Lava");
113+
addControlValue(control, "Ocean");
114+
addControlValue(control, "Forest");
115+
addControlValue(control, "Rainbow");
116+
addControlValue(control, "RainbowStripe");
117+
addControlValue(control, "Party");
118+
addControlValue(control, "Heat");
119+
addControlValue(control, "Random");
120+
addControlValue(control, "Quin");
121+
addControlValue(control, "Orange");
122+
120123
control = addControl(controls, "preset", "pad");
121124
control["width"] = 8;
122125
control["size"] = 18;
@@ -173,6 +176,16 @@ class ModuleLightsControl : public Module {
173176
for (int i = 0; i < sizeof(layerP.palette.entries) / sizeof(CRGB); i++) {
174177
layerP.palette[i] = CHSV(random8(), 255, 255); // take the max saturation, max brightness of the colorwheel
175178
}
179+
} else if (updatedItem.value == 9) { // Quin palette
180+
size_t size = sizeof(layerP.palette.entries) / sizeof(CRGB);
181+
for (int i = 0; i < size; i++) {
182+
layerP.palette[i] = CRGB(map(i, 0, size - 1, 255, 0), map(i, 0, size - 1, 31, 0), map(i, 0, size - 1, 0, 255)); // from orange to blue
183+
}
184+
} else if (updatedItem.value == 10) { // Orange palette
185+
size_t size = sizeof(layerP.palette.entries) / sizeof(CRGB);
186+
for (int i = 0; i < size; i++) {
187+
layerP.palette[i] = CRGB(255, map(i, 0, size - 1, 0, 255), 0); // from orange to blue
188+
}
176189
} else {
177190
layerP.palette = PartyColors_p; // should never occur
178191
}

src/MoonLight/Nodes/Effects/E_MoonLight.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,13 +160,13 @@ class RandomEffect : public Node {
160160
public:
161161
static const char* name() { return "Random"; }
162162
static uint8_t dim() { return _3D; }
163-
static const char* tags() { return "🔥"; }
163+
static const char* tags() { return "🔥🎨"; }
164164

165165
uint8_t fade = 70;
166166
void setup() { addControl(fade, "fade", "slider"); }
167167
void loop() override {
168168
layer->fadeToBlackBy(fade);
169-
layer->setRGB(random16(layer->nrOfLights), CRGB(255, random8(), 0));
169+
layer->setRGB(random16(layer->nrOfLights), ColorFromPalette(layer->layerP->palette, random8()));
170170
}
171171
};
172172

0 commit comments

Comments
 (0)