Added spreading from center and fixed the enable
This commit is contained in:
parent
2b87817ba2
commit
339d2a7bf3
@ -30,6 +30,8 @@ IP adress of your Klipper instance you want to poll. ESP has to be restarted aft
|
|||||||
|
|
||||||
1 = reversed
|
1 = reversed
|
||||||
|
|
||||||
|
2 = center
|
||||||
|
|
||||||
-----
|
-----
|
||||||
Author:
|
Author:
|
||||||
|
|
||||||
|
@ -70,7 +70,8 @@ public:
|
|||||||
|
|
||||||
void loop()
|
void loop()
|
||||||
{
|
{
|
||||||
|
if (enabled)
|
||||||
|
{
|
||||||
if (WLED_CONNECTED)
|
if (WLED_CONNECTED)
|
||||||
{
|
{
|
||||||
if (millis() - lastTime > 10000)
|
if (millis() - lastTime > 10000)
|
||||||
@ -90,7 +91,7 @@ public:
|
|||||||
DEBUG_PRINT("Percent: ");
|
DEBUG_PRINT("Percent: ");
|
||||||
DEBUG_PRINTLN((int)(klipperDoc["result"]["status"]["virtual_sdcard"]["progress"].as<float>() * 100));
|
DEBUG_PRINTLN((int)(klipperDoc["result"]["status"]["virtual_sdcard"]["progress"].as<float>() * 100));
|
||||||
DEBUG_PRINT("LEDs: ");
|
DEBUG_PRINT("LEDs: ");
|
||||||
DEBUG_PRINTLN(strip.getLengthTotal() * printPercent / 100);
|
DEBUG_PRINTLN(direction == 2 ? (strip.getLengthTotal() / 2) * printPercent / 100 : strip.getLengthTotal() * printPercent / 100);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -101,6 +102,7 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void addToConfig(JsonObject &root)
|
void addToConfig(JsonObject &root)
|
||||||
{
|
{
|
||||||
@ -129,7 +131,6 @@ public:
|
|||||||
* Creating an "u" object allows you to add custom key/value pairs to the Info section of the WLED web UI.
|
* Creating an "u" object allows you to add custom key/value pairs to the Info section of the WLED web UI.
|
||||||
* Below it is shown how this could be used for e.g. a light sensor
|
* Below it is shown how this could be used for e.g. a light sensor
|
||||||
*/
|
*/
|
||||||
/* TODO: NOT WORKING YET
|
|
||||||
void addToJsonInfo(JsonObject &root)
|
void addToJsonInfo(JsonObject &root)
|
||||||
{
|
{
|
||||||
JsonObject user = root["u"];
|
JsonObject user = root["u"];
|
||||||
@ -149,7 +150,6 @@ public:
|
|||||||
infoArr.add(uiDomString);
|
infoArr.add(uiDomString);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void addToJsonState(JsonObject &root)
|
void addToJsonState(JsonObject &root)
|
||||||
{
|
{
|
||||||
JsonObject usermod = root[FPSTR(_name)];
|
JsonObject usermod = root[FPSTR(_name)];
|
||||||
@ -170,7 +170,6 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* handleOverlayDraw() is called just before every show() (LED strip update frame) after effects have set the colors.
|
* handleOverlayDraw() is called just before every show() (LED strip update frame) after effects have set the colors.
|
||||||
@ -188,13 +187,25 @@ public:
|
|||||||
strip.setPixelColor(i, strip.getSegment(0).colors[1]);
|
strip.setPixelColor(i, strip.getSegment(0).colors[1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // reversed
|
else if (direction == 1) // reversed
|
||||||
{
|
{
|
||||||
for (int i = 0; i < strip.getLengthTotal() * printPercent / 100; i++)
|
for (int i = 0; i < strip.getLengthTotal() * printPercent / 100; i++)
|
||||||
{
|
{
|
||||||
strip.setPixelColor(strip.getLengthTotal() - i, strip.getSegment(0).colors[1]);
|
strip.setPixelColor(strip.getLengthTotal() - i, strip.getSegment(0).colors[1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (direction == 2) // center
|
||||||
|
{
|
||||||
|
for (int i = 0; i < (strip.getLengthTotal() / 2) * printPercent / 100; i++)
|
||||||
|
{
|
||||||
|
strip.setPixelColor((strip.getLengthTotal() / 2) + i, strip.getSegment(0).colors[1]);
|
||||||
|
strip.setPixelColor((strip.getLengthTotal() / 2) - i, strip.getSegment(0).colors[1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
direction = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user