Skip to content

Commit

Permalink
Multiple pin support
Browse files Browse the repository at this point in the history
  • Loading branch information
netmindz committed May 28, 2024
1 parent 10f763a commit 85749f7
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions src/App/LedModEffects.h
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ class LedModEffects:public SysModule {

effects.setup();

FastLED.setMaxPowerInVoltsAndMilliamps(5,2000); // 5v, 2000mA
// TODO: replacement for FastLED.setMaxPowerInVoltsAndMilliamps(5,2000); // 5v, 2000mA
}

void loop() {
Expand Down Expand Up @@ -422,13 +422,14 @@ class LedModEffects:public SysModule {
lastMappingMillis = millis();
fixture.projectAndMap();

//https://github.com/FastLED/FastLED/wiki/Multiple-Controller-Examples

//connect allocated Pins to gpio

if (fixture.doAllocPins) {
unsigned pinNr = 0;

int pinAssignment[16];
int lengths[16];
int nb_pins=0;
for (PinObject &pinObject: pins->pinObjects) {

if (pins->isOwner(pinNr, "Leds")) { //if pin owned by leds, (assigned in projectAndMap)
Expand All @@ -445,15 +446,17 @@ class LedModEffects:public SysModule {
stackUnsigned16 nrOfLeds = atoi(after) - atoi(before) + 1;
ppf("driver.initled new %d: %d-%d\n", pinNr, startLed, nrOfLeds-1);

int pins[1] = { pinNr };
driver.initled((uint8_t*) fixture.ledsP, pins, 1, (int) nrOfLeds, ORDER_GRB);

driverInit = true;

pinAssignment[nb_pins] = pinNr;
lengths[nb_pins] = nrOfLeds;
nb_pins++;
} //if led range in details (- in details e.g. 0-1023)
} //if pin owned by leds
pinNr++;
} // for pins
if(nb_pins>0) {
driver.initled((uint8_t*) fixture.ledsP, pinAssignment, lengths, nb_pins, ORDER_GRB);
driverInit = true;
}
fixture.doAllocPins = false;
}
}
Expand Down

0 comments on commit 85749f7

Please sign in to comment.