diff --git a/src/App/AppFixture.h b/src/App/AppFixture.h new file mode 100644 index 00000000..835d2687 --- /dev/null +++ b/src/App/AppFixture.h @@ -0,0 +1,45 @@ +/* + @title StarMod + @file AppFixture.h + @date 20240114 + @repo https://github.com/ewowi/StarMod + @Authors https://github.com/ewowi/StarMod/commits/main + @Copyright (c) 2024 Github StarMod Commit Authors + @license GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 + @license For non GPL-v3 usage, commercial licenses must be purchased. Contact moonmodules@icloud.com +*/ + +// #pragma once + +// #include "AppLeds.h" + +#define NUM_LEDS_Max 4096 + +class Leds; //forward + +class Fixture { + +public: + + CRGB ledsP[NUM_LEDS_Max]; + + // CRGB *leds = nullptr; + // if (!leds) + // leds = (CRGB*)calloc(nrOfLeds, sizeof(CRGB)); + // else + // leds = (CRGB*)reallocarray(leds, nrOfLeds, sizeof(CRGB)); + // if (leds) free(leds); + // leds = (CRGB*)malloc(nrOfLeds * sizeof(CRGB)); + // leds = (CRGB*)reallocarray + + uint16_t nrOfLeds = 64; //amount of physical leds + uint8_t fixtureNr = -1; + Coord3D size = {8,8,1}; + + Leds *leds; + + Fixture() { + // leds->distance(1,2,3,4,5,6); + } + +}; diff --git a/src/App/AppLeds.cpp b/src/App/AppLeds.cpp index a0f98755..8c9eb07f 100644 --- a/src/App/AppLeds.cpp +++ b/src/App/AppLeds.cpp @@ -26,7 +26,7 @@ void Leds::fixtureProjectAndMap() { char fileName[32] = ""; - if (files->seqNrToName(fileName, fixtureNr)) { + if (files->seqNrToName(fileName, fixture->fixtureNr)) { JsonRDWS jrdws(fileName); //open fileName for deserialize mappingTableLedCounter = 0; @@ -58,17 +58,17 @@ void Leds::fixtureProjectAndMap() { // startPos.z = 0; break; case p_DistanceFromCenter: - // startPos.x = sizeP.x / 2; - // startPos.y = sizeP.y / 2; - // startPos.z = sizeP.z / 2; + // startPos.x = fixture->size.x / 2; + // startPos.y = fixture->size.y / 2; + // startPos.z = fixture->size.z / 2; break; } //what to deserialize - jrdws.lookFor("width", &sizeP.x); - jrdws.lookFor("height", &sizeP.y); - jrdws.lookFor("depth", &sizeP.z); - jrdws.lookFor("nrOfLeds", &nrOfLedsP); + jrdws.lookFor("width", &fixture->size.x); + jrdws.lookFor("height", &fixture->size.y); + jrdws.lookFor("depth", &fixture->size.z); + jrdws.lookFor("nrOfLeds", &fixture->nrOfLeds); jrdws.lookFor("pin", &currPin); //lookFor leds array and for each item in array call lambdo to make a projection @@ -79,9 +79,9 @@ void Leds::fixtureProjectAndMap() { // USER_PRINTF("\n"); uint8_t fixtureDimension = 0; - if (sizeP.x>1) fixtureDimension++; - if (sizeP.y>1) fixtureDimension++; - if (sizeP.z>1) fixtureDimension++; + if (fixture->size.x>1) fixtureDimension++; + if (fixture->size.y>1) fixtureDimension++; + if (fixture->size.z>1) fixtureDimension++; if (uint16CollectList.size()>=1 && fixtureDimension>=1 && fixtureDimension<=3) { @@ -93,7 +93,7 @@ void Leds::fixtureProjectAndMap() { if (x >= startPos.x && x <=endPos.x && y >= startPos.y && y <=endPos.y && z >= startPos.z && z <=endPos.z ) { - // USER_PRINTF("projectionNr p:%d f:%d s:%d, %d-%d-%d %d-%d-%d %d-%d-%d\n", projectionNr, effectDimension, fixtureDimension, x, y, z, uint16CollectList[0], uint16CollectList[1], uint16CollectList[2], sizeP.x, sizeP.y, sizeP.z); + // USER_PRINTF("projectionNr p:%d f:%d s:%d, %d-%d-%d %d-%d-%d %d-%d-%d\n", projectionNr, effectDimension, fixtureDimension, x, y, z, uint16CollectList[0], uint16CollectList[1], uint16CollectList[2], fixture->size.x, fixture->size.y, fixture->size.z); //calculate the bucket to add to current physical led to uint16_t bucket = UINT16_MAX; @@ -141,8 +141,8 @@ void Leds::fixtureProjectAndMap() { // USER_PRINTF("2D to 2D bucket %f %d %d x %d %d x %d\n", scale, bucket, x, y, size.x, size.y); } else if (fixtureDimension == _3D) { - size.x = sizeP.x + sizeP.y; - size.y = sizeP.z; + size.x = fixture->size.x + fixture->size.y; + size.y = fixture->size.z; size.z = 1; bucket = XY(x + y + 1, z); // USER_PRINTF("2D to 3D bucket %d %d\n", bucket, size.x); @@ -167,12 +167,12 @@ void Leds::fixtureProjectAndMap() { xNew = round(((size.y-1.0-y)/(size.y-1.0) * xNew + size.x) / 2.0); yNew = round(((size.y-1.0-y)/(size.y-1.0) * yNew + size.y) / 2.0); - USER_PRINTF(" %d,%d->%f,%f->%f,%f", x, y, sin(x * TWO_PI / (float)(sizeP.x-1)), cos(x * TWO_PI / (float)(sizeP.x-1)), xNew, yNew); + USER_PRINTF(" %d,%d->%f,%f->%f,%f", x, y, sin(x * TWO_PI / (float)(fixture->size.x-1)), cos(x * TWO_PI / (float)(fixture->size.x-1)), xNew, yNew); x = xNew; y = yNew; - size.x = sizeP.x; - size.y = sizeP.y; + size.x = fixture->size.x; + size.y = fixture->size.y; size.z = 1; bucket = XY(x, y); @@ -201,7 +201,7 @@ void Leds::fixtureProjectAndMap() { xNew = round(((size.y-1.0-y)/(size.y-1.0) * xNew + size.x) / 2.0); yNew = round(((size.y-1.0-y)/(size.y-1.0) * yNew + size.y) / 2.0); - // USER_PRINTF(" %d,%d->%f,%f->%f,%f", x, y, sin(x * TWO_PI / (float)(sizeP.x-1)), cos(x * TWO_PI / (float)(sizeP.x-1)), xNew, yNew); + // USER_PRINTF(" %d,%d->%f,%f->%f,%f", x, y, sin(x * TWO_PI / (float)(size.x-1)), cos(x * TWO_PI / (float)(size.x-1)), xNew, yNew); float distance = abs(bucket - xNew - yNew * size.x); @@ -286,8 +286,8 @@ void Leds::fixtureProjectAndMap() { if (projectionNr <= p_Random) { //defaults - size = sizeP; - nrOfLeds = nrOfLedsP; + size = fixture->size; + nrOfLeds = fixture->nrOfLeds; } if (projectionNr > p_Random) { @@ -308,15 +308,15 @@ void Leds::fixtureProjectAndMap() { // } } - USER_PRINTF("fixtureProjectAndMap P:%dx%dx%d V:%dx%dx%d and P:%d V:%d\n", sizeP.x, sizeP.y, sizeP.z, size.x, size.y, size.z, nrOfLedsP, nrOfLeds); + USER_PRINTF("fixtureProjectAndMap P:%dx%dx%d V:%dx%dx%d and P:%d V:%d\n", fixture->size.x, fixture->size.y, fixture->size.z, size.x, size.y, size.z, fixture->nrOfLeds, nrOfLeds); mdl->setValue("fxSize", size); mdl->setValue("fxCount", nrOfLeds); - mdl->setValue("fixSize", sizeP); - mdl->setValue("fixCount", nrOfLedsP); + mdl->setValue("fixSize", fixture->size); + mdl->setValue("fixCount", fixture->nrOfLeds); } // if deserialize } //if fileName else - USER_PRINTF("fixtureProjectAndMap: Filename for fixture %d not found\n", fixtureNr); + USER_PRINTF("fixtureProjectAndMap: Filename for fixture %d not found\n", fixture->fixtureNr); } \ No newline at end of file diff --git a/src/App/AppLeds.h b/src/App/AppLeds.h index e672278e..b0e83d71 100644 --- a/src/App/AppLeds.h +++ b/src/App/AppLeds.h @@ -22,7 +22,7 @@ #include "ArduinoJson.h" #include "../Sys/SysModModel.h" //for Coord3D -#define NUM_LEDS_Max 4096 +#include "AppFixture.h" enum Projections { @@ -42,22 +42,8 @@ class Leds { public: - //tbd: move ledsPhysical and nrOfLedsP out of Leds - // CRGB *leds = nullptr; - CRGB ledsPhysical[NUM_LEDS_Max]; - // if (!leds) - // leds = (CRGB*)calloc(nrOfLeds, sizeof(CRGB)); - // else - // leds = (CRGB*)reallocarray(leds, nrOfLeds, sizeof(CRGB)); - // if (leds) free(leds); - // leds = (CRGB*)malloc(nrOfLeds * sizeof(CRGB)); - // leds = (CRGB*)reallocarray - - uint16_t nrOfLedsP = 64; //amount of physical leds - uint8_t fixtureNr = -1; - Coord3D sizeP = {8,8,1}; + Fixture *fixture; - uint16_t nrOfLeds = 64; //amount of virtual leds (calculated by projection) Coord3D size = {8,8,1}; @@ -131,11 +117,11 @@ class Leds { if (indexV >= mappingTable.size()) return; for (uint16_t indexP:mappingTable[indexV]) { if (indexP < NUM_LEDS_Max) - ledsPhysical[indexP] = color; + fixture->ledsP[indexP] = color; } } else //no projection - ledsPhysical[projectionNr==p_Random?random(nrOfLedsP):indexV] = color; + fixture->ledsP[projectionNr==p_Random?random(fixture->nrOfLeds):indexV] = color; } CRGB getPixelColor(int indexV) { @@ -143,10 +129,10 @@ class Leds { if (indexV >= mappingTable.size()) return CRGB::Black; if (!mappingTable[indexV].size() || mappingTable[indexV][0] > NUM_LEDS_Max) return CRGB::Black; - return ledsPhysical[mappingTable[indexV][0]]; //any would do as they are all the same + return fixture->ledsP[mappingTable[indexV][0]]; //any would do as they are all the same } else //no projection - return ledsPhysical[indexV]; + return fixture->ledsP[indexV]; } void addPixelColor(int indexV, CRGB color) { @@ -159,7 +145,7 @@ class Leds { for (index.x = startPos.x; index.x <= endPos.x; index.x++) for (index.y = startPos.y; index.y <= endPos.y; index.y++) for (index.z = startPos.z; index.z <= endPos.z; index.z++) { - ledsPhysical[index.x + index.y * sizeP.x + index.z * sizeP.x * sizeP.y].nscale8(255-fadeBy); + fixture->ledsP[index.x + index.y * fixture->size.x + index.z * fixture->size.x * fixture->size.y].nscale8(255-fadeBy); } } void fill_solid(const struct CRGB& color) { @@ -168,7 +154,7 @@ class Leds { for (index.x = startPos.x; index.x <= endPos.x; index.x++) for (index.y = startPos.y; index.y <= endPos.y; index.y++) for (index.z = startPos.z; index.z <= endPos.z; index.z++) { - ledsPhysical[index.x + index.y * sizeP.x + index.z * sizeP.x * sizeP.y] = color; + fixture->ledsP[index.x + index.y * fixture->size.x + index.z * fixture->size.x * fixture->size.y] = color; } } @@ -181,7 +167,7 @@ class Leds { for (index.x = startPos.x; index.x <= endPos.x; index.x++) for (index.y = startPos.y; index.y <= endPos.y; index.y++) for (index.z = startPos.z; index.z <= endPos.z; index.z++) { - ledsPhysical[index.x + index.y * sizeP.x + index.z * sizeP.x * sizeP.y] = hsv; + fixture->ledsP[index.x + index.y * fixture->size.x + index.z * fixture->size.x * fixture->size.y] = hsv; hsv.hue += deltahue; } } diff --git a/src/App/AppModFixture.h b/src/App/AppModFixture.h new file mode 100644 index 00000000..df42d608 --- /dev/null +++ b/src/App/AppModFixture.h @@ -0,0 +1,106 @@ +/* + @title StarMod + @file AppModFixture.h + @date 20240114 + @repo https://github.com/ewowi/StarMod + @Authors https://github.com/ewowi/StarMod/commits/main + @Copyright (c) 2024 Github StarMod Commit Authors + @license GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 + @license For non GPL-v3 usage, commercial licenses must be purchased. Contact moonmodules@icloud.com +*/ + +#include "SysModule.h" + +class AppModFixture:public SysModule { + +public: + + AppModFixture() :SysModule("Fixture") {}; + + void setup() { + SysModule::setup(); + + parentVar = ui->initAppMod(parentVar, name); + if (parentVar["o"] > -1000) parentVar["o"] = -1000; //set default order. Don't use auto generated order as order can be changed in the ui (WIP) + + ui->initCanvas(parentVar, "pview", UINT16_MAX, false, [](JsonObject var) { //uiFun + web->addResponse(var["id"], "label", "Preview"); + web->addResponse(var["id"], "comment", "Shows the fixture"); + // web->addResponse(var["id"], "comment", "Click to enlarge"); + }, nullptr, [this](JsonObject var, uint8_t rowNr) { //loopFun + + var["interval"] = max(lds->fixture.nrOfLeds * web->ws->count()/200, 16U)*10; //interval in ms * 10, not too fast //from cs to ms + + web->sendDataWs([this](AsyncWebSocketMessageBuffer * wsBuf) { + uint8_t* buffer; + + buffer = wsBuf->get(); + + // send leds preview to clients + for (size_t i = 0; i < lds->fixture.nrOfLeds; i++) + { + buffer[i*3+5] = lds->fixture.ledsP[i].red; + buffer[i*3+5+1] = lds->fixture.ledsP[i].green; + buffer[i*3+5+2] = lds->fixture.ledsP[i].blue; + } + //new values + buffer[0] = 1; //userFun id + // buffer[1] = fixture.nrOfLeds/256; + // buffer[2] = fixture.nrOfLeds%256; + // buffer[4] = max(fixture.nrOfLeds * SysModWeb::ws->count()/200, 16U); //interval in ms * 10, not too fast + + }, lds->fixture.nrOfLeds * 3 + 5, true); + }); + ui->initSelect(parentVar, "fixture", lds->fixture.fixtureNr, false, [](JsonObject var) { //uiFun + web->addResponse(var["id"], "comment", "Fixture to display effect on"); + JsonArray select = web->addResponseA(var["id"], "options"); + files->dirToJson(select, true, "D"); //only files containing D (1D,2D,3D), alphabetically, only looking for D not very destinctive though + + // ui needs to load the file also initially + char fileName[32] = ""; + if (files->seqNrToName(fileName, var["value"])) { + web->addResponse("pview", "file", JsonString(fileName, JsonString::Copied)); + } + }, [this](JsonObject var, uint8_t) { //chFun + + lds->fixture.fixtureNr = var["value"]; + lds->doMap = true; + + char fileName[32] = ""; + if (files->seqNrToName(fileName, lds->fixture.fixtureNr)) { + //send to pview a message to get file filename + JsonDocument *responseDoc = web->getResponseDoc(); + responseDoc->clear(); //needed for deserializeJson? + JsonVariant responseVariant = responseDoc->as(); + + web->addResponse("pview", "file", JsonString(fileName, JsonString::Copied)); + web->sendDataWs(responseVariant); + print->printJson("fixture chFun send ws done", responseVariant); //during server startup this is not send to a client, so client refresh should also trigger this + } + }); //fixture + + ui->initCoord3D(parentVar, "fixSize", lds->fixture.size, 0, UINT16_MAX, true, [this](JsonObject var) { //uiFun + web->addResponse(var["id"], "label", "Size"); + // web->addResponse(var["id"], "value", fixture.size); + }); + + ui->initNumber(parentVar, "fixCount", lds->fixture.nrOfLeds, 0, UINT16_MAX, true, [this](JsonObject var) { //uiFun + web->addResponse(var["id"], "label", "Count"); + web->addResponseV(var["id"], "comment", "Max %d", NUM_LEDS_Max); + // web->addResponse(var["id"], "value", fixture.nrOfLeds); + }); + + ui->initNumber(parentVar, "fps", lds->fps, 1, 999, false, [](JsonObject var) { //uiFun + web->addResponse(var["id"], "comment", "Frames per second"); + }, [this](JsonObject var, uint8_t) { //chFun + lds->fps = var["value"]; + }); + + ui->initText(parentVar, "realFps", nullptr, 10, true, [this](JsonObject var) { //uiFun + web->addResponseV(var["id"], "comment", "f(%d leds)", lds->fixture.nrOfLeds); + }); + + } +}; + +static AppModFixture *fix; \ No newline at end of file diff --git a/src/App/AppModLeds.h b/src/App/AppModLeds.h index ed18d6a6..277e2a2e 100644 --- a/src/App/AppModLeds.h +++ b/src/App/AppModLeds.h @@ -51,8 +51,13 @@ class AppModLeds:public SysModule { Effects effects; Leds leds = Leds(); //virtual leds + Fixture fixture = Fixture(); - AppModLeds() :SysModule("Leds") {}; + + AppModLeds() :SysModule("Leds") { + fixture.leds = &leds; + leds.fixture = &fixture; + }; void setup() { SysModule::setup(); @@ -170,55 +175,6 @@ class AppModLeds:public SysModule { web->addResponse(var["id"], "label", "Count"); }); - ui->initSelect(parentVar, "fixture", 0, false, [](JsonObject var) { //uiFun - web->addResponse(var["id"], "comment", "Fixture to display effect on"); - JsonArray select = web->addResponseA(var["id"], "options"); - files->dirToJson(select, true, "D"); //only files containing D (1D,2D,3D), alphabetically, only looking for D not very destinctive though - - // ui needs to load the file also initially - char fileName[32] = ""; - if (files->seqNrToName(fileName, var["value"])) { - web->addResponse("pview", "file", JsonString(fileName, JsonString::Copied)); - } - }, [this](JsonObject var, uint8_t) { //chFun - - leds.fixtureNr = var["value"]; - doMap = true; - - char fileName[32] = ""; - if (files->seqNrToName(fileName, leds.fixtureNr)) { - //send to pview a message to get file filename - JsonDocument *responseDoc = web->getResponseDoc(); - responseDoc->clear(); //needed for deserializeJson? - JsonVariant responseVariant = responseDoc->as(); - - web->addResponse("pview", "file", JsonString(fileName, JsonString::Copied)); - web->sendDataWs(responseVariant); - print->printJson("fixture chFun send ws done", responseVariant); //during server startup this is not send to a client, so client refresh should also trigger this - } - }); //fixture - - ui->initCoord3D(parentVar, "fixSize", leds.sizeP, 0, UINT16_MAX, true, [this](JsonObject var) { //uiFun - web->addResponse(var["id"], "label", "Size"); - // web->addResponse(var["id"], "value", leds.sizeP); - }); - - ui->initNumber(parentVar, "fixCount", leds.nrOfLedsP, 0, UINT16_MAX, true, [this](JsonObject var) { //uiFun - web->addResponse(var["id"], "label", "Count"); - web->addResponseV(var["id"], "comment", "Max %d", NUM_LEDS_Max); - // web->addResponse(var["id"], "value", leds.nrOfLedsP); - }); - - ui->initNumber(parentVar, "fps", fps, 1, 999, false, [](JsonObject var) { //uiFun - web->addResponse(var["id"], "comment", "Frames per second"); - }, [this](JsonObject var, uint8_t) { //chFun - fps = var["value"]; - }); - - ui->initText(parentVar, "realFps", nullptr, 10, true, [this](JsonObject var) { //uiFun - web->addResponseV(var["id"], "comment", "f(%d leds)", leds.nrOfLedsP); - }); - #ifdef USERMOD_E131 // if (e131mod->isEnabled) { @@ -282,7 +238,7 @@ class AppModLeds:public SysModule { token = strtok(NULL, ","); if (token != NULL) startOrEndPos->z = atoi(token) / 10; else startOrEndPos->z = 0; - mdl->setValue(isStart?"fxStart":"fxEnd", *startOrEndPos, 0); + mdl->setValue(isStart?"fxStart":"fxEnd", *startOrEndPos, 0); //assuming row 0 for the moment var.remove("canvasData"); //convasdata has been processed doMap = true; //recalc projection @@ -313,112 +269,112 @@ class AppModLeds:public SysModule { //commented pins: error: static assertion failed: Invalid pin specified switch (pinNr) { #if CONFIG_IDF_TARGET_ESP32 - case 0: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - case 1: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - case 2: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - case 3: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - case 4: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - case 5: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - // case 6: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - // case 7: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - // case 8: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - // case 9: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - // case 10: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - case 11: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - case 12: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - case 13: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - case 14: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - case 15: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - case 16: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - case 17: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - case 18: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - case 19: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - // case 20: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - case 21: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - case 22: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - case 23: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - // case 24: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - case 25: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - case 26: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - case 27: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - // case 28: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - // case 29: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - // case 30: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - // case 31: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - case 32: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - case 33: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - // case 34: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - // case 35: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - // case 36: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - // case 37: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - // case 38: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - // case 39: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - // case 40: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - // case 41: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - // case 42: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - // case 43: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - // case 44: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - // case 45: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - // case 46: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - // case 47: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - // case 48: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - // case 49: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - // case 50: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + case 0: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + case 1: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + case 2: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + case 3: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + case 4: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + case 5: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + // case 6: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + // case 7: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + // case 8: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + // case 9: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + // case 10: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + case 11: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + case 12: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + case 13: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + case 14: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + case 15: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + case 16: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + case 17: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + case 18: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + case 19: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + // case 20: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + case 21: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + case 22: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + case 23: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + // case 24: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + case 25: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + case 26: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + case 27: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + // case 28: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + // case 29: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + // case 30: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + // case 31: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + case 32: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + case 33: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + // case 34: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + // case 35: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + // case 36: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + // case 37: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + // case 38: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + // case 39: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + // case 40: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + // case 41: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + // case 42: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + // case 43: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + // case 44: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + // case 45: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + // case 46: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + // case 47: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + // case 48: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + // case 49: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + // case 50: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; #endif //CONFIG_IDF_TARGET_ESP32 #if CONFIG_IDF_TARGET_ESP32S2 - case 0: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - case 1: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - case 2: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - case 3: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - case 4: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - case 5: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - case 6: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - case 7: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - case 8: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - case 9: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - case 10: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - case 11: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - case 12: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - case 13: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - case 14: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - case 15: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - case 16: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - case 17: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - case 18: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - case 19: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - case 20: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - case 21: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - // case 22: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - // case 23: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - // case 24: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - // case 25: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - case 26: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - // case 27: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - // case 28: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - // case 29: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - // case 30: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - // case 31: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - // case 32: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - case 33: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - case 34: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - case 35: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - case 36: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - case 37: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - case 38: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - case 39: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - case 40: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - case 41: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - case 42: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - case 43: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - case 44: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - case 45: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - // case 46: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - // case 47: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - // case 48: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - // case 49: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - // case 50: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; - // case 51: FastLED.addLeds(leds.ledsPhysical, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + case 0: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + case 1: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + case 2: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + case 3: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + case 4: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + case 5: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + case 6: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + case 7: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + case 8: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + case 9: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + case 10: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + case 11: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + case 12: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + case 13: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + case 14: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + case 15: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + case 16: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + case 17: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + case 18: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + case 19: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + case 20: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + case 21: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + // case 22: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + // case 23: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + // case 24: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + // case 25: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + case 26: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + // case 27: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + // case 28: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + // case 29: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + // case 30: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + // case 31: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + // case 32: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + case 33: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + case 34: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + case 35: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + case 36: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + case 37: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + case 38: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + case 39: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + case 40: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + case 41: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + case 42: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + case 43: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + case 44: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + case 45: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + // case 46: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + // case 47: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + // case 48: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + // case 49: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + // case 50: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; + // case 51: FastLED.addLeds(fixture.ledsP, startLed, nrOfLeds).setCorrection(TypicalLEDStrip); break; #endif //CONFIG_IDF_TARGET_ESP32S2 default: USER_PRINTF("FastLedPin assignment: pin not supported %d\n", pinNr); diff --git a/src/App/AppModPreview.h b/src/App/AppModPreview.h deleted file mode 100644 index be38d6bd..00000000 --- a/src/App/AppModPreview.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - @title StarMod - @file AppModPreview.h - @date 20240114 - @repo https://github.com/ewowi/StarMod - @Authors https://github.com/ewowi/StarMod/commits/main - @Copyright (c) 2024 Github StarMod Commit Authors - @license GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 - @license For non GPL-v3 usage, commercial licenses must be purchased. Contact moonmodules@icloud.com -*/ - -#include "SysModule.h" - - -class AppModPreview:public SysModule { - -public: - - AppModPreview() :SysModule("Preview") {}; - - void setup() { - SysModule::setup(); - - parentVar = ui->initAppMod(parentVar, name); - if (parentVar["o"] > -1000) parentVar["o"] = -1000; //set default order. Don't use auto generated order as order can be changed in the ui (WIP) - - ui->initCanvas(parentVar, "pview", UINT16_MAX, false, [](JsonObject var) { //uiFun - web->addResponse(var["id"], "label", "Preview"); - web->addResponse(var["id"], "comment", "Shows the fixture"); - // web->addResponse(var["id"], "comment", "Click to enlarge"); - }, nullptr, [](JsonObject var, uint8_t rowNr) { //loopFun - - var["interval"] = max(lds->leds.nrOfLedsP * web->ws->count()/200, 16U)*10; //interval in ms * 10, not too fast //from cs to ms - - web->sendDataWs([](AsyncWebSocketMessageBuffer * wsBuf) { - uint8_t* buffer; - - buffer = wsBuf->get(); - - // send leds preview to clients - for (size_t i = 0; i < lds->leds.nrOfLedsP; i++) - { - buffer[i*3+5] = lds->leds.ledsPhysical[i].red; - buffer[i*3+5+1] = lds->leds.ledsPhysical[i].green; - buffer[i*3+5+2] = lds->leds.ledsPhysical[i].blue; - } - //new values - buffer[0] = 1; //userFun id - // buffer[1] = leds.nrOfLedsP/256; - // buffer[2] = leds.nrOfLedsP%256; - // buffer[4] = max(leds.nrOfLedsP * SysModWeb::ws->count()/200, 16U); //interval in ms * 10, not too fast - - }, lds->leds.nrOfLedsP * 3 + 5, true); - }); - } -}; - -static AppModPreview *pvw; \ No newline at end of file diff --git a/src/User/UserModArtNet.h b/src/User/UserModArtNet.h index 0bef32a9..054cef5a 100644 --- a/src/User/UserModArtNet.h +++ b/src/User/UserModArtNet.h @@ -70,7 +70,7 @@ class UserModArtNet:public SysModule { // calculate the number of UDP packets we need to send bool isRGBW = false; - const size_t channelCount = lds->leds.nrOfLedsP * (isRGBW?4:3); // 1 channel for every R,G,B,(W?) value + const size_t channelCount = lds->fixture.nrOfLeds * (isRGBW?4:3); // 1 channel for every R,G,B,(W?) value const size_t ARTNET_CHANNELS_PER_PACKET = isRGBW?512:510; // 512/4=128 RGBW LEDs, 510/3=170 RGB LEDs const size_t packetCount = ((channelCount-1)/ARTNET_CHANNELS_PER_PACKET)+1; @@ -111,8 +111,8 @@ class UserModArtNet:public SysModule { ddpUdp.write(0xFF & (packetSize >> 8)); // 16-bit length of channel data, MSB ddpUdp.write(0xFF & (packetSize )); // 16-bit length of channel data, LSB - for (size_t i = 0; i < lds->leds.nrOfLedsP; i++) { - CRGB pixel = lds->leds.ledsPhysical[i]; + for (size_t i = 0; i < lds->fixture.nrOfLeds; i++) { + CRGB pixel = lds->fixture.ledsP[i]; ddpUdp.write(scale8(pixel.r, bri)); // R ddpUdp.write(scale8(pixel.g, bri)); // G ddpUdp.write(scale8(pixel.b, bri)); // B diff --git a/src/User/UserModDDP.h b/src/User/UserModDDP.h index d17ccf12..5f498a7f 100644 --- a/src/User/UserModDDP.h +++ b/src/User/UserModDDP.h @@ -87,7 +87,7 @@ class UserModDDP:public SysModule { // calculate the number of UDP packets we need to send bool isRGBW = false; - const size_t channelCount = lds->leds.nrOfLedsP * (isRGBW? 4:3); // 1 channel for every R,G,B,(W?) value + const size_t channelCount = lds->fixture.nrOfLeds * (isRGBW? 4:3); // 1 channel for every R,G,B,(W?) value const size_t packetCount = ((channelCount-1) / DDP_CHANNELS_PER_PACKET) +1; uint32_t channel = 0; @@ -135,8 +135,8 @@ class UserModDDP:public SysModule { /*8*/ddpUdp.write(0xFF & (packetSize >> 8)); /*9*/ddpUdp.write(0xFF & (packetSize )); - for (size_t i = 0; i < lds->leds.nrOfLedsP; i++) { - CRGB pixel = lds->leds.ledsPhysical[i]; + for (size_t i = 0; i < lds->fixture.nrOfLeds; i++) { + CRGB pixel = lds->fixture.ledsP[i]; ddpUdp.write(scale8(pixel.r, bri)); // R ddpUdp.write(scale8(pixel.g, bri)); // G ddpUdp.write(scale8(pixel.b, bri)); // B diff --git a/src/main.cpp b/src/main.cpp index f8ec6c69..1f4c434d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -27,7 +27,7 @@ #include "User/UserModMDNS.h" #ifdef APPMOD_LEDS #include "App/AppModLeds.h" - #include "App/AppModPreview.h" + #include "App/AppModFixture.h" #include "App/AppModFixtureGen.h" #ifdef USERMOD_ARTNET #include "User/UserModArtNet.h" @@ -65,7 +65,7 @@ void setup() { mdns = new UserModMDNS(); #ifdef APPMOD_LEDS lds = new AppModLeds(); - pvw = new AppModPreview(); + fix = new AppModFixture(); lfg = new AppModFixtureGen(); #ifdef USERMOD_ARTNET artnetmod = new UserModArtNet(); @@ -87,7 +87,7 @@ void setup() { //Reorder with care! If changed make sure mdlEnabled.chFun executes var.createNestedArray("value"); and saveModel! //Default: add below, not in between #ifdef APPMOD_LEDS - mdls->add(pvw); + mdls->add(fix); mdls->add(lds); mdls->add(lfg); #endif