Skip to content

Commit cf02356

Browse files
committed
Brightness to solid, latest live script
Server ===== - pio.ini: update to latest live script (16-06) - Effects: add brightness to solid (Solid as background effect) - Nodes: Livescript layout: request mapping
1 parent fb3f593 commit cf02356

File tree

7 files changed

+25
-8
lines changed

7 files changed

+25
-8
lines changed

docs/moonbase/module/editor.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ Emoji coding:
5151

5252
#### PanTilt script
5353

54-
* Sends a beatsin to Pan and Tilt which can be sent to Moving Heads
54+
* Sends a beatsin to Pan and Tilt which can be sent to Moving Heads (add a Moving head layout node to configure the MHs)
5555
* Controls: BPM, Middle Pan and Tilt, Range and invert
5656
* Usage: Add this effect if moving heads are configured. RGB effects can be added seperately e.g. wave to light up the moving heads in wave patterns
5757
* See [E_PanTilt](https://github.com/MoonModules/MoonLight/blob/main/misc/livescripts/E_PanTilt.sc)
@@ -63,6 +63,13 @@ Emoji coding:
6363
### Modifier 💎 Nodes
6464
🚧
6565

66+
### Supporting ☸️ Nodes
67+
🚧
68+
69+
#### AudioSync ☸️ ♫
70+
71+
* listens to audio sent over the local network by WLED-AC or WLED-MM and allows sound reactive effects (♫) to use audio data (volume and bands (FFT))
72+
6673
## Archive
6774

6875
This page is 🚧, text below will be rewritten.

platformio.ini

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@ lib_deps =
5151
; https://github.com/hpwit/ESPLiveScript.git#7b52eca ; okay
5252
; https://github.com/hpwit/ESPLiveScript.git#cccfc0b ; notokay
5353
; https://github.com/hpwit/ESPLiveScript.git#4a0cb82 ; vjson 09-06-2025 ; Comment if FT_LIVESCRIPT=0
54-
https://github.com/hpwit/ESPLiveScript.git#6f86b6e ; vjson 09-06-2025 ; Comment if FT_LIVESCRIPT=0
54+
; https://github.com/hpwit/ESPLiveScript.git#6f86b6e ; vjson 09-06-2025 ; Comment if FT_LIVESCRIPT=0
55+
https://github.com/hpwit/ESPLiveScript.git#9f002b4 ; vjson 16-06-2025 ; Comment if FT_LIVESCRIPT=0
56+
5557

5658
[env]
5759
framework = arduino ;espidf will not work as libs rely on arduino (e.g. PhysicHTTP, ...)

src/MoonLight/Effects.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,18 @@ class SolidEffect: public Node {
2121
uint8_t red;
2222
uint8_t green;
2323
uint8_t blue;
24+
uint8_t brightness;
2425

2526
void setup() override {
2627
addControl(&red, "red", "range", 182);
2728
addControl(&green, "green", "range", 15);
2829
addControl(&blue, "blue", "range", 98);
30+
addControl(&brightness, "brightness", "range", 255);
2931

3032
}
3133

3234
void loop() override {
33-
layerV->fill_solid(CRGB(red, green, blue));
35+
layerV->fill_solid(CRGB(red * brightness/255, green * brightness/255, blue * brightness/255));
3436
}
3537
};
3638

src/MoonLight/Nodes.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,6 @@ void LiveScriptNode::setup() {
194194

195195
compileAndRun();
196196

197-
// Node::setup(); //call Node::setup to handle requestMapLayout: no need to run as
198197
}
199198

200199
void LiveScriptNode::loop() {
@@ -279,11 +278,13 @@ void LiveScriptNode::execute() {
279278
}
280279
ESP_LOGD(TAG, "%s", animation);
281280

282-
//similar to the requestMapLayout in layout.setup.
283281
if (hasLayout) {
284-
layerV->mapLayout(); //which calls also livescript addLayout
282+
layerV->requestMapPhysical = true;
283+
layerV->requestMapVirtual = true;
285284
}
286285

286+
// requestMapPhysical and requestMapVirtual will call the script addLayout function (check if this can be done in case the script also has loop running !!!)
287+
287288
if (hasLoop) {
288289
// setup : create controls
289290
// executable.execute("setup");

src/MoonLight/Nodes.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,12 @@ class Node {
115115
//layout
116116
virtual void addLayout() {} //the definition of the layout, called by mapLayout()
117117

118+
//convenience functions to add a light
118119
void addLight(Coord3D position) {
119120
layerV->layerP->addLight(position);
120121
}
121122

123+
//convenience functions to add a pin
122124
void addPin(uint8_t pinNr) {
123125
layerV->layerP->addPin(pinNr);
124126
}

src/MoonLight/VirtualLayer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ void VirtualLayer::mapLayout() {
317317
layerP->addLayoutPre();
318318
for (Node *node: nodes) {
319319
if (node->on && node->hasLayout)
320-
node->addLayout(); //calls also addLayout
320+
node->addLayout();
321321
}
322322
layerP->addLayoutPost();
323323
}

src/MoonLight/VirtualLayer.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,13 @@ class VirtualLayer {
163163
void fill_solid(const CRGB& color);
164164
void fill_rainbow(const uint8_t initialhue, const uint8_t deltahue);
165165

166+
//mapLayout calls addLayoutPre, addLayout for each node and addLayoutPost and expects pass to be set (1 or 2)
166167
void mapLayout();
167168
void addLayoutPre();
168-
void addLight(Coord3D position);
169169
void addLayoutPost();
170+
171+
//addLight is called by addLayout for each light in the layout
172+
void addLight(Coord3D position);
170173

171174
void drawLine(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1, CRGB color, bool soft = false, uint8_t depth = UINT8_MAX) {
172175

0 commit comments

Comments
 (0)