Finished Dynamic LED drivers

This commit is contained in:
cschwinne 2018-04-14 18:56:35 +02:00
parent 7f5671f975
commit a665607fac
7 changed files with 18 additions and 26 deletions

View File

@ -38,8 +38,8 @@
#define CALL_MODE(n) (this->*_mode[n])();
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);
for (int i=0; i < _led_count; i++) _locked[i] = false;
WS2812FX::setBrightness(_brightness);
show();
}

Binary file not shown.

View File

@ -86,18 +86,17 @@ const char PAGE_settings_leds1[] PROGMEM = R"=====(
<button type="button" onclick="B()">Back</button><button type="submit">Save</button><hr>
<h2>LED setup</h2>
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>
Alternatively, apply preset <input name="BP" type="number" min="0" max="25" required> at boot<br>
LEDs are 4-channel type (RGBW): <input type="checkbox" name="EW"><br>
Apply preset <input name="BP" type="number" min="0" max="25" required> at boot (0 uses defaults)<br>
Default RGB color:
<input name="CR" 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>
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 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 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 secondary RGB(W):<br>
<input name="SR" 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>

View File

@ -33,7 +33,7 @@
#include "WS2812FX.h"
//version in format yymmddb (b = daily build)
#define VERSION 1804121
#define VERSION 1804141
const String versionString = "0.6.3";
//AP and OTA default passwords (change them!)

View File

@ -141,11 +141,8 @@ String getSettings(byte subPage)
resp += ds + "CG" + v + colS[1] +";";
resp += ds + "CB" + v + colS[2] +";";
resp += ds + "CA" + v + briS +";";
if (useRGBW) {
resp += ds + "EW" + c + useRGBW +";";
resp += ds + "CW" + v + whiteS +";";
} else {
resp += ds + "CW" + v + "-1;";
}
resp += ds + "SR" + v + colSecS[0] +";";
resp += ds + "SG" + v + colSecS[1] +";";
resp += ds + "SB" + v + colSecS[2] +";";

View File

@ -117,6 +117,7 @@ void handleSettingsSet(byte subPage)
int i = server.arg("LC").toInt();
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
{
colS[0] = col[0];
@ -165,14 +166,7 @@ void handleSettingsSet(byte subPage)
if (server.hasArg("CW"))
{
int i = server.arg("CW").toInt();
if (i >= 0 && i <= 255)
{
useRGBW = true;
whiteS = i;
} else {
useRGBW = false;
whiteS = 0;
}
if (i >= 0 && i <= 255) whiteS = i;
}
if (server.hasArg("CA"))
{
@ -236,6 +230,7 @@ void handleSettingsSet(byte subPage)
int i = server.arg("BF").toInt();
if (i > 0) briMultiplier = i;
}
strip.init(useRGBW,ledCount,PIN);
}
//UI
@ -382,7 +377,6 @@ void handleSettingsSet(byte subPage)
aOtaEnabled = server.hasArg("AO");
}
}
strip.init(useRGBW,ledCount,PIN);
saveSettingsToEEPROM();
}

View File

@ -4,12 +4,14 @@
void wledInit()
{
EEPROM.begin(EEPSIZE);
if (!EEPROM.read(397)) strip.init(EEPROM.read(372),EEPROM.read(229),PIN); //quick init
Serial.begin(115200);
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
SPIFFS.begin();
#endif