From 35da70493b184d25401b02afc4bea6678af91840 Mon Sep 17 00:00:00 2001 From: Ewoud Date: Mon, 1 Apr 2024 23:10:14 +0200 Subject: [PATCH] Fix Gen Bug Fixes --- src/App/LedModFixtureGen.h | 56 ++++++++++++++++++++------------------ 1 file changed, 29 insertions(+), 27 deletions(-) diff --git a/src/App/LedModFixtureGen.h b/src/App/LedModFixtureGen.h index 5bf73630..5eee8422 100644 --- a/src/App/LedModFixtureGen.h +++ b/src/App/LedModFixtureGen.h @@ -205,23 +205,25 @@ class GenFix { closePin(); } - void ring(Coord3D middle, unsigned16 ledCount, unsigned8 ip, unsigned8 pin, uint16_t pan = 0, uint16_t tilt = 0, uint16_t roll = 0) { + void ring(Coord3D middle, unsigned16 ledCount, unsigned8 ip, unsigned8 pin, uint16_t pan = 0, uint16_t tilt = 0, uint16_t roll = 0, bool preDiam = false) { openPin(pin); - uint8_t ringDiam; - //check for rings241 rings which have a specific diameter - switch (ledCount) { - case 1: ringDiam = 0; break; - case 8: ringDiam = 13; break; - case 12: ringDiam = 23; break; - case 16: ringDiam = 33; break; - case 24: ringDiam = 43; break; - case 32: ringDiam = 53; break; - case 40: ringDiam = 63; break; - case 48: ringDiam = 73; break; - case 60: ringDiam = 83; break; - default: ringDiam = 10 * ledCount / 2 / M_PI; //in mm + uint8_t ringDiam = 10 * ledCount / 2 / M_PI; //in mm; + if (preDiam) { + //check for rings241 rings which have a specific diameter + switch (ledCount) { + case 1: ringDiam = 0; break; + case 8: ringDiam = 13; break; + case 12: ringDiam = 23; break; + case 16: ringDiam = 33; break; + case 24: ringDiam = 43; break; + case 32: ringDiam = 53; break; + case 40: ringDiam = 63; break; + case 48: ringDiam = 73; break; + case 60: ringDiam = 83; break; + default: ringDiam = 10 * ledCount / 2 / M_PI; //in mm + } } Trigo trigo; @@ -254,7 +256,7 @@ class GenFix { // stackUnsigned16 size = ringDiams[nrOfRings-1]; //size if the biggest ring for (int j=0; j sin 0 to pi for (uint8_t lat = 0; lat <= width; lat++) { @@ -391,7 +393,7 @@ class GenFix { uint8_t ledCount = ringDiam * 2 * M_PI; - middle.y = first.y + lat; + middle.y = first.y*10 + lat*10; // Coord3D start = first; // start.y = first.y + lat; @@ -508,7 +510,7 @@ class LedModFixtureGen:public SysModule { ui->initButton(parentVar, "generate", false, [this](JsonObject var, unsigned8 rowNr, unsigned8 funType) { switch (funType) { //varFun case f_ChangeFun: { - + char fileName[32]; generateChFun(var, fileName); ui->callVarFun("fixture", UINT8_MAX, f_UIFun); //reload fixture select @@ -719,7 +721,7 @@ class LedModFixtureGen:public SysModule { ui->initNumber(parentVar, "ledsPerSpoke", 24, 1, 360); } else if (fgValue == f_Hexagon) { - ui->initNumber(parentVar, "ledsPerSide", 36, 1, 255); + ui->initNumber(parentVar, "ledsPerSide", 12, 1, 255); if (panelVar["value"].as()) {