Skip to content

Commit 6484292

Browse files
committed
Board presets bugix readPins at boot
1 parent 6fae7a3 commit 6484292

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/MoonLight/Modules/ModuleDrivers.h

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class ModuleDrivers : public NodeManager {
5151
// Remove all UINT8_MAX values by compacting the array
5252
layerP.nrOfLedPins = 0;
5353
for (int readPos = 0; readPos < sizeof(layerP.ledPins); readPos++) {
54-
if (layerP.ledPins[readPos] != UINT8_MAX && layerP.ledsPerPin[layerP.nrOfLedPins] != UINT16_MAX) { //only pins which have a nrOfLedPins
54+
if (layerP.ledPins[readPos] != UINT8_MAX && layerP.ledsPerPin[layerP.nrOfLedPins] != UINT16_MAX && layerP.ledsPerPin[layerP.nrOfLedPins] != 0) { // only pins which have a nrOfLedPins
5555
layerP.ledPins[layerP.nrOfLedPins++] = layerP.ledPins[readPos];
5656
}
5757
}
@@ -73,7 +73,6 @@ class ModuleDrivers : public NodeManager {
7373
nodes = &layerP.nodes;
7474

7575
_moduleIO->addUpdateHandler([&](const String& originId) { readPins(); }, false);
76-
readPins(); // initially
7776
}
7877

7978
void addNodes(JsonArray values) override {
@@ -173,12 +172,18 @@ class ModuleDrivers : public NodeManager {
173172
return node;
174173
}
175174

176-
// run effects
175+
bool initPins = false;
176+
177177
void loop() {
178178
// if (layerP.lights.header.isPositions == 0) //otherwise lights is used for positions etc.
179179
// layerP.loop(); //run all the effects of all virtual layers (currently only one)
180180

181181
NodeManager::loop();
182+
183+
if (!initPins) {
184+
readPins(); // initially
185+
initPins = true;
186+
}
182187
}
183188

184189
}; // class ModuleDrivers

0 commit comments

Comments
 (0)