Skip to content

Commit

Permalink
ICVLD tuning, use web->isBusy
Browse files Browse the repository at this point in the history
pio.ini
- replace STARLIGHT_DMA_BUFFER by __NB_DMA_BUFFER and set to 2 (causes flickering but less crashes and allows to optimize flickering elsewhere)

LedModFixture
- use web->isBusy for driverShow and preview
- mapInitAlloc: move init ledsP array with panelTest before mapping
- initLed: attempt to avoid very bright pixels during reboot (WIP)
initLed: trigger brightness.onChange to set brightness right during boot
  • Loading branch information
ewowi committed Nov 6, 2024
1 parent 873be57 commit 608cfe8
Show file tree
Hide file tree
Showing 10 changed files with 41 additions and 44 deletions.
30 changes: 15 additions & 15 deletions misc/LiveScripts/F_panel080-048.sc
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
8 changes: 4 additions & 4 deletions misc/testOutput.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down
2 changes: 1 addition & 1 deletion src/App/LedEffects.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<JsonArray>()) {
// ui->callVarFun(childVar, UINT8_MAX, onUI);
// Variable(childVar).triggerEvent(onUI);
// }
// }

Expand Down
31 changes: 19 additions & 12 deletions src/App/LedModFixture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down
3 changes: 0 additions & 3 deletions src/App/LedModFixture.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
2 changes: 1 addition & 1 deletion src/App/LedModFixtureGen.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
4 changes: 0 additions & 4 deletions src/Sys/SysStarJson.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 0 additions & 2 deletions src/User/UserModLive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion src/User/UserModLive.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 608cfe8

Please sign in to comment.