diff --git a/misc/LiveScripts/F_panel080-048.sc b/misc/LiveScripts/F_panel080-048.sc index fa4091b..8a4dce4 100644 --- a/misc/LiveScripts/F_panel080-048.sc +++ b/misc/LiveScripts/F_panel080-048.sc @@ -36,27 +36,27 @@ void drawPanel(int panelX, int panelY) { } void main() { - drawPanel(2, 1); //first panel is in the middle + drawPanel(2, 1); //first panel data come from the 8th pin!! //first row - drawPanel(4, 0); //2 - drawPanel(3, 0); //3 - drawPanel(1, 0); //4 swapped !!! - drawPanel(2, 0); //5 swapped !!! - drawPanel(0, 0); //6 + drawPanel(4, 0); //second panel comes from pin 1 + drawPanel(3, 0); //3th from 2 + drawPanel(1, 0); //4th from 3 swapped !!! + drawPanel(2, 0); //5th from 4 swapped !!! + drawPanel(0, 0); //6th from 5 //second row - drawPanel(4, 1); //7 - drawPanel(3, 1); //8 + drawPanel(4, 1); //7th from 6 + drawPanel(3, 1); //8th from 7 - drawPanel(0, 2); //9 !!! + drawPanel(0, 2); //9th from 15 !!! no data coming from pin... - drawPanel(1, 1); //10 - drawPanel(0, 1); //11 + drawPanel(1, 1); //10th from 9 + drawPanel(0, 1); //11th from 10 //third row - drawPanel(4, 2); //12 - drawPanel(3, 2); //13 - drawPanel(2, 2); //14 - drawPanel(1, 2); //15 no data coming from pin... + drawPanel(4, 2); //12th from 11 + drawPanel(3, 2); //13th from 12 + drawPanel(2, 2); //14th from 13 + drawPanel(1, 2); //15th from 14 } \ No newline at end of file diff --git a/misc/testOutput.txt b/misc/testOutput.txt index 7c991e2..77970d8 100644 --- a/misc/testOutput.txt +++ b/misc/testOutput.txt @@ -27,14 +27,14 @@ Coord3D assign 32 32 0 ledsEnd onChange 0 0 0 - 32 32 0 Coord3D toJson 8,8,1 -> {"x":8,"y":8,"z":1} setValue changed ledsSize ->{"x":8,"y":8,"z":1} -callVarOnChange ledsSize unknown type for {"x":8,"y":8,"z":1} +triggerEvent Change ledsSize unknown type for {"x":8,"y":8,"z":1} setValue changed fxCount ->64 initVarAndValue onChange init fixture v:0 seqNrToName: 2DMatrix3232.json 9640 fixture onChange send ws done {"preview":{"file":"/2DMatrix3232.json"}} Coord3D toJson 8,8,1 -> {"x":8,"y":8,"z":1} setValue changed fixSize ->{"x":8,"y":8,"z":1} -callVarOnChange fixSize unknown type for {"x":8,"y":8,"z":1} +triggerEvent Change fixSize unknown type for {"x":8,"y":8,"z":1} setValue changed fixCount ->64 initVarAndValue onChange init fps v:60 initVarAndValue onChange init fixtureGen v:0 @@ -72,11 +72,11 @@ StarJson found all what it was looking for 1030 >= 6 projectAndMap P:32x32x1 V:15x15x1 and P:1024 V:225 Coord3D toJson 15,15,1 -> {"x":15,"y":15,"z":1} setValue changed ledsSize ->{"x":15,"y":15,"z":1} -callVarOnChange ledsSize unknown type for {"x":15,"y":15,"z":1} +triggerEvent Change ledsSize unknown type for {"x":15,"y":15,"z":1} setValue changed fxCount ->225 Coord3D toJson 32,32,1 -> {"x":32,"y":32,"z":1} setValue changed fixSize ->{"x":32,"y":32,"z":1} -callVarOnChange fixSize unknown type for {"x":32,"y":32,"z":1} +triggerEvent Change fixSize unknown type for {"x":32,"y":32,"z":1} setValue changed fixCount ->1024 StarJson destructing FastLED.addLeds new 16: 0-1024 diff --git a/platformio.ini b/platformio.ini index 7c3cdc4..6d9a62d 100644 --- a/platformio.ini +++ b/platformio.ini @@ -93,7 +93,7 @@ build_flags = -D STARLIGHT_ICVLD_LATCH_PIN=27 -D NBIS2SERIALPINS=6 ;nr of shift registers (6 * 8 * 256 = 12288) I2SClocklessVirtualLedDriver variable! -D STARLIGHT_ICVLD_PINS=14,12,13,25,33,32 ; must be 6, see initLeds - -D STARLIGHT_DMA_BUFFER=20 ; default 2 (2 causes flickering in case of mapping, 5 also, 10 a bit, 15 a bit, 20 not, on esp32devICLVD). For now stays at 10 as normal esp / 12288 leds is more stable + -D __NB_DMA_BUFFER=2 ; default 2 (2 causes flickering in case of mapping, 5 also, 10 a bit, 15 a bit, 20 not, on esp32devICLVD). For now stays at 10 as normal esp / 12288 leds is more stable ; price to pay is more memory so more crashes occur if it is set to 20 on normal esps lib_deps = diff --git a/src/App/LedEffects.h b/src/App/LedEffects.h index 2c6c005..f4e0c73 100644 --- a/src/App/LedEffects.h +++ b/src/App/LedEffects.h @@ -2400,7 +2400,7 @@ class GEQEffect: public Effect { // e131mod->patchChannel(3, "fadeOut", 255); // TODO: add constant for name // e131mod->patchChannel(4, "ripple", 255); // for (JsonObject childVar: mdl->findVar("E131", "watches")["n"].as()) { - // ui->callVarFun(childVar, UINT8_MAX, onUI); + // Variable(childVar).triggerEvent(onUI); // } // } diff --git a/src/App/LedModFixture.cpp b/src/App/LedModFixture.cpp index ab5d4bc..139d913 100644 --- a/src/App/LedModFixture.cpp +++ b/src/App/LedModFixture.cpp @@ -121,7 +121,7 @@ } return true; case onLoop: { - if (mappingStatus == 0 && bytesPerPixel && !doSendFixtureDefinition && web->ws.getClients().length()) { //not remapping and clients exists + if (!web->isBusy && mappingStatus == 0 && bytesPerPixel && !doSendFixtureDefinition && web->ws.getClients().length()) { //not remapping and clients exists var["interval"] = max(nrOfLeds * web->ws.count()/200, 16U)*10; //interval in ms * 10, not too fast //from cs to ms #define headerBytesPreview 5 @@ -345,7 +345,7 @@ #endif - if (driverShow) { + if (driverShow && !web->isBusy) { // if statement needed as we need to wait until the driver is initialised #ifdef STARLIGHT_CLOCKLESS_LED_DRIVER #if CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32S2 @@ -372,6 +372,14 @@ mappingStatus = 2; //mapping in progress + //init pixels, with some debugging for panels + for (int i = 0; i < STARLIGHT_MAXLEDS / 256; i++) //panels + { + //pixels in panels + for (int j=0;j<256;j++) + ledsP[j+i*256]=j < i + 1?CRGB::Red: CRGB::Black; //each panel get as much red pixels as its sequence in the chain + } + char fileName[32] = ""; if (files->seqNrToName(fileName, fixtureNr, "F_")) { // get the fix->json @@ -484,14 +492,6 @@ rowNr++; } - //init pixels, with some debugging for panels - for (int i = 0; i < STARLIGHT_MAXLEDS / 256; i++) //panels - { - //pixels in panels - for (int j=0;j<256;j++) - ledsP[j+i*256]=j < i + 1?CRGB::Red: CRGB::Black; //each panel get as much red pixels as its sequence in the chain - } - //https://github.com/FastLED/FastLED/wiki/Multiple-Controller-Examples //connect allocated Pins to gpio @@ -744,18 +744,25 @@ driver.setGamma(255.0/255.0, 176.0/255.0, 240.0/255.0); //void initled(uint8_t *leds, int *Pinsq, int *sizes, int num_strips, colorarrangment cArr) #endif - mdl->callVarOnChange(mdl->findVar("Fixture", "brightness"), UINT8_MAX, true); //set brightness (init is true so bri value not send via udp) + Variable(mdl->findVar("Fixture", "brightness")).triggerEvent(onChange, UINT8_MAX, true); //set brightness (init is true so bri value not send via udp) // driver.setBrightness(setMaxPowerBrightnessFactor / 256); //not brighter then the set limit (WIP) } #elif STARLIGHT_CLOCKLESS_VIRTUAL_LED_DRIVER + + for (int i=0; i< STARLIGHT_MAXLEDS; i++) ledsP[i] = CRGB::Black; //avoid very bright pixels during reboot (WIP) int pins[6] = { STARLIGHT_ICVLD_PINS }; + driver.initled(ledsP, pins, STARLIGHT_ICVLD_CLOCK_PIN, STARLIGHT_ICVLD_LATCH_PIN); // driver.enableShowPixelsOnCore(1); #if STARLIGHT_LIVE_MAPPING driver.setMapLed(&mapLed); #endif driver.setGamma(255.0/255.0, 176.0/255.0, 240.0/255.0); - driver.setBrightness(10); + + if (driver.driverInit) driver.showPixels(WAIT); //avoid very bright pixels during reboot (WIP) + driver.setBrightness(10); //avoid very bright pixels during reboot (WIP) + + Variable(mdl->findVar("Fixture", "brightness")).triggerEvent(onChange, UINT8_MAX, true); //set brightness (init is true so bri value not send via udp) #endif doAllocPins = false; diff --git a/src/App/LedModFixture.h b/src/App/LedModFixture.h index 9b7271b..d98531d 100644 --- a/src/App/LedModFixture.h +++ b/src/App/LedModFixture.h @@ -50,9 +50,6 @@ #else #define I2S_MAPPING_MODE (I2S_MAPPING_MODE_OPTION_NONE) //works but mapping using StarLight mappingTable needed #endif - #ifdef STARLIGHT_DMA_BUFFER - #define __NB_DMA_BUFFER STARLIGHT_DMA_BUFFER - #endif #include "I2SClocklessVirtualLedDriver.h" diff --git a/src/App/LedModFixtureGen.h b/src/App/LedModFixtureGen.h index 050cc7f..aa80977 100644 --- a/src/App/LedModFixtureGen.h +++ b/src/App/LedModFixtureGen.h @@ -664,7 +664,7 @@ class LedModFixtureGen:public SysModule { //set fixture in fixture module Variable(mdl->findVar("Fixture", "fixture")).triggerEvent(onUI); //rebuild options - uint8_t value = ui->selectOptionToValue("fixture", fileName); + uint8_t value = ui->selectOptionToValue("Fixture.fixture", fileName); if (value != UINT8_MAX) mdl->setValue("Fixture", "fixture", value); diff --git a/src/Sys/SysStarJson.h b/src/Sys/SysStarJson.h index 9a56859..1908a52 100644 --- a/src/Sys/SysStarJson.h +++ b/src/Sys/SysStarJson.h @@ -48,10 +48,6 @@ class StarJson { //returns false if not all vars to look for are found bool deserialize(bool lazy = false); - void seek(uint32_t pos) { - f.seek(pos); - } - private: struct VarDetails { const char * id; diff --git a/src/User/UserModLive.cpp b/src/User/UserModLive.cpp index 1bb2e42..2a730b0 100644 --- a/src/User/UserModLive.cpp +++ b/src/User/UserModLive.cpp @@ -402,8 +402,6 @@ static float _time(float j) { } ppf("preScript of %s has %d lines\n", fileName, preScriptNrOfLines+1); //+1 to subtract the line from parser error line reported - // string scScript = scScript; - scScript += string(f.readString().c_str()); // add sc file if (post) scScript += post; diff --git a/src/User/UserModLive.h b/src/User/UserModLive.h index 4bb17c9..f8cb5a3 100644 --- a/src/User/UserModLive.h +++ b/src/User/UserModLive.h @@ -46,7 +46,6 @@ class UserModLive: public SysModule { //return the id of the executable uint8_t compile(const char *fileName, const char *post = nullptr); - //void * for the time being, should be Executable * but importing ESPLiveScript.h in this .h gives multiple definition errors uint8_t findExecutable(const char *fileName); void executeTask(uint8_t exeID, const char *function = "main", int val = UINT16_MAX);