Finished Dynamic LED drivers
This commit is contained in:
parent
7f5671f975
commit
a665607fac
@ -38,8 +38,8 @@
|
|||||||
#define CALL_MODE(n) (this->*_mode[n])();
|
#define CALL_MODE(n) (this->*_mode[n])();
|
||||||
|
|
||||||
void WS2812FX::init(bool supportWhite, uint16_t countPixels, uint8_t pin) {
|
void WS2812FX::init(bool supportWhite, uint16_t countPixels, uint8_t pin) {
|
||||||
for (int i=0; i < _led_count; i++) _locked[i] = false;
|
|
||||||
begin(supportWhite,countPixels,pin);
|
begin(supportWhite,countPixels,pin);
|
||||||
|
for (int i=0; i < _led_count; i++) _locked[i] = false;
|
||||||
WS2812FX::setBrightness(_brightness);
|
WS2812FX::setBrightness(_brightness);
|
||||||
show();
|
show();
|
||||||
}
|
}
|
||||||
|
Binary file not shown.
@ -86,18 +86,17 @@ const char PAGE_settings_leds1[] PROGMEM = R"=====(
|
|||||||
<button type="button" onclick="B()">Back</button><button type="submit">Save</button><hr>
|
<button type="button" onclick="B()">Back</button><button type="submit">Save</button><hr>
|
||||||
<h2>LED setup</h2>
|
<h2>LED setup</h2>
|
||||||
LED count (max. 255): <input name="LC" type="number" min="1" max="255" required><br>
|
LED count (max. 255): <input name="LC" type="number" min="1" max="255" required><br>
|
||||||
<i>The default boot color is always saved in preset slot 0.</i><br>
|
LEDs are 4-channel type (RGBW): <input type="checkbox" name="EW"><br>
|
||||||
Alternatively, apply preset <input name="BP" type="number" min="0" max="25" required> at boot<br>
|
Apply preset <input name="BP" type="number" min="0" max="25" required> at boot (0 uses defaults)<br>
|
||||||
Default RGB color:
|
Default RGB color:
|
||||||
<input name="CR" type="number" min="0" max="255" required>
|
<input name="CR" type="number" min="0" max="255" required>
|
||||||
<input name="CG" type="number" min="0" max="255" required>
|
<input name="CG" type="number" min="0" max="255" required>
|
||||||
<input name="CB" type="number" min="0" max="255" required><br>
|
<input name="CB" type="number" min="0" max="255" required><br>
|
||||||
|
Default white value (only RGBW): <input name="CW" type="number" min="0" max="255" required><br>
|
||||||
Default brightness: <input name="CA" type="number" min="0" max="255" required> (0-255)<br>
|
Default brightness: <input name="CA" type="number" min="0" max="255" required> (0-255)<br>
|
||||||
Default white value (only RGBW, -1 to disable): <input name="CW" type="number" min="-1" max="255" required><br>
|
Default effect ID: <input name="FX" type="number" min="0" max="57" required><br>
|
||||||
Default effect ID: <input name="FX" type="number" min="0" max="57" required> <br>
|
Default effect speed: <input name="SX" type="number" min="0" max="255" required><br>
|
||||||
Default effect speed: <input name="SX" type="number" min="0" max="255" required> <br>
|
Default effect intensity: <input name="IX" type="number" min="0" max="255" required><br>
|
||||||
Default effect intensity: <input name="IX" type="number" min="0" max="255" required> <br>
|
|
||||||
Default secondary RGB(W):<br>
|
|
||||||
<input name="SR" type="number" min="0" max="255" required>
|
<input name="SR" type="number" min="0" max="255" required>
|
||||||
<input name="SG" type="number" min="0" max="255" required>
|
<input name="SG" type="number" min="0" max="255" required>
|
||||||
<input name="SB" type="number" min="0" max="255" required>
|
<input name="SB" type="number" min="0" max="255" required>
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
#include "WS2812FX.h"
|
#include "WS2812FX.h"
|
||||||
|
|
||||||
//version in format yymmddb (b = daily build)
|
//version in format yymmddb (b = daily build)
|
||||||
#define VERSION 1804121
|
#define VERSION 1804141
|
||||||
const String versionString = "0.6.3";
|
const String versionString = "0.6.3";
|
||||||
|
|
||||||
//AP and OTA default passwords (change them!)
|
//AP and OTA default passwords (change them!)
|
||||||
|
@ -141,11 +141,8 @@ String getSettings(byte subPage)
|
|||||||
resp += ds + "CG" + v + colS[1] +";";
|
resp += ds + "CG" + v + colS[1] +";";
|
||||||
resp += ds + "CB" + v + colS[2] +";";
|
resp += ds + "CB" + v + colS[2] +";";
|
||||||
resp += ds + "CA" + v + briS +";";
|
resp += ds + "CA" + v + briS +";";
|
||||||
if (useRGBW) {
|
resp += ds + "EW" + c + useRGBW +";";
|
||||||
resp += ds + "CW" + v + whiteS +";";
|
resp += ds + "CW" + v + whiteS +";";
|
||||||
} else {
|
|
||||||
resp += ds + "CW" + v + "-1;";
|
|
||||||
}
|
|
||||||
resp += ds + "SR" + v + colSecS[0] +";";
|
resp += ds + "SR" + v + colSecS[0] +";";
|
||||||
resp += ds + "SG" + v + colSecS[1] +";";
|
resp += ds + "SG" + v + colSecS[1] +";";
|
||||||
resp += ds + "SB" + v + colSecS[2] +";";
|
resp += ds + "SB" + v + colSecS[2] +";";
|
||||||
|
@ -117,6 +117,7 @@ void handleSettingsSet(byte subPage)
|
|||||||
int i = server.arg("LC").toInt();
|
int i = server.arg("LC").toInt();
|
||||||
if (i >= 0 && i <= 1200) ledCount = i;
|
if (i >= 0 && i <= 1200) ledCount = i;
|
||||||
}
|
}
|
||||||
|
useRGBW = server.hasArg("EW");
|
||||||
if (server.hasArg("IS")) //ignore settings and save current brightness, colors and fx as default
|
if (server.hasArg("IS")) //ignore settings and save current brightness, colors and fx as default
|
||||||
{
|
{
|
||||||
colS[0] = col[0];
|
colS[0] = col[0];
|
||||||
@ -165,14 +166,7 @@ void handleSettingsSet(byte subPage)
|
|||||||
if (server.hasArg("CW"))
|
if (server.hasArg("CW"))
|
||||||
{
|
{
|
||||||
int i = server.arg("CW").toInt();
|
int i = server.arg("CW").toInt();
|
||||||
if (i >= 0 && i <= 255)
|
if (i >= 0 && i <= 255) whiteS = i;
|
||||||
{
|
|
||||||
useRGBW = true;
|
|
||||||
whiteS = i;
|
|
||||||
} else {
|
|
||||||
useRGBW = false;
|
|
||||||
whiteS = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (server.hasArg("CA"))
|
if (server.hasArg("CA"))
|
||||||
{
|
{
|
||||||
@ -236,6 +230,7 @@ void handleSettingsSet(byte subPage)
|
|||||||
int i = server.arg("BF").toInt();
|
int i = server.arg("BF").toInt();
|
||||||
if (i > 0) briMultiplier = i;
|
if (i > 0) briMultiplier = i;
|
||||||
}
|
}
|
||||||
|
strip.init(useRGBW,ledCount,PIN);
|
||||||
}
|
}
|
||||||
|
|
||||||
//UI
|
//UI
|
||||||
@ -382,7 +377,6 @@ void handleSettingsSet(byte subPage)
|
|||||||
aOtaEnabled = server.hasArg("AO");
|
aOtaEnabled = server.hasArg("AO");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
strip.init(useRGBW,ledCount,PIN);
|
|
||||||
saveSettingsToEEPROM();
|
saveSettingsToEEPROM();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,12 +4,14 @@
|
|||||||
|
|
||||||
void wledInit()
|
void wledInit()
|
||||||
{
|
{
|
||||||
EEPROM.begin(EEPSIZE);
|
|
||||||
if (!EEPROM.read(397)) strip.init(EEPROM.read(372),EEPROM.read(229),PIN); //quick init
|
|
||||||
|
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
Serial.setTimeout(50);
|
Serial.setTimeout(50);
|
||||||
|
|
||||||
|
EEPROM.begin(EEPSIZE);
|
||||||
|
Serial.println("PreStripInit");
|
||||||
|
if (!EEPROM.read(397)) strip.init(EEPROM.read(372),EEPROM.read(229),PIN); //quick init
|
||||||
|
Serial.println("PostStripInit");
|
||||||
|
|
||||||
#ifdef USEFS
|
#ifdef USEFS
|
||||||
SPIFFS.begin();
|
SPIFFS.begin();
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user