Various improvements
UI Quick color selectors UI PC mode Different Heartbeat effect PoliceAll improvements Clarified sync settings
This commit is contained in:
parent
9e62db5237
commit
1fd0383f69
@ -1219,11 +1219,10 @@ uint16_t WS2812FX::mode_loading(void) {
|
||||
|
||||
|
||||
//American Police Light with all LEDs Red and Blue
|
||||
uint16_t WS2812FX::police_base(uint32_t color1, uint32_t color2)
|
||||
uint16_t WS2812FX::police_base(uint32_t color1, uint32_t color2, bool all)
|
||||
{
|
||||
uint16_t counter = now * ((SEGMENT.speed >> 2) +1);
|
||||
uint16_t idexR = (counter * SEGLEN) >> 16;
|
||||
uint8_t size = 1 + SEGMENT.intensity >> 3;
|
||||
if (idexR >= SEGLEN) idexR = 0;
|
||||
|
||||
uint16_t topindex = SEGLEN >> 1;
|
||||
@ -1231,19 +1230,31 @@ uint16_t WS2812FX::police_base(uint32_t color1, uint32_t color2)
|
||||
if (SEGENV.call == 0) SEGENV.aux0 = idexR;
|
||||
if (idexB >= SEGLEN) idexB = 0; //otherwise overflow on odd number of LEDs
|
||||
|
||||
for (uint8_t i=0; i <= size; i++) {
|
||||
setPixelColor(idexR+i, color1);
|
||||
setPixelColor(idexB+i, color2);
|
||||
}
|
||||
if (SEGENV.aux0 != idexR) {
|
||||
uint8_t gap = (SEGENV.aux0 < idexR)? idexR - SEGENV.aux0:SEGLEN - SEGENV.aux0 + idexR;
|
||||
for (uint8_t i = 0; i <= gap ; i++) {
|
||||
if ((idexR - i) < 0) idexR = SEGLEN-1 + i;
|
||||
if ((idexB - i) < 0) idexB = SEGLEN-1 + i;
|
||||
setPixelColor(idexR-i, color1);
|
||||
setPixelColor(idexB-i, color2);
|
||||
if (all) { //different algo, ensuring immediate fill
|
||||
if (idexB > idexR) {
|
||||
fill(color2);
|
||||
for (uint16_t i = idexR; i < idexB; i++) setPixelColor(i, color1);
|
||||
} else {
|
||||
fill(color1);
|
||||
for (uint16_t i = idexB; i < idexR; i++) setPixelColor(i, color2);
|
||||
}
|
||||
} else { //regular dot-only mode
|
||||
uint8_t size = 1 + SEGMENT.intensity >> 3;
|
||||
if (size > SEGLEN/2) size = 1+ SEGLEN/2;
|
||||
for (uint8_t i=0; i <= size; i++) {
|
||||
setPixelColor(idexR+i, color1);
|
||||
setPixelColor(idexB+i, color2);
|
||||
}
|
||||
if (SEGENV.aux0 != idexR) {
|
||||
uint8_t gap = (SEGENV.aux0 < idexR)? idexR - SEGENV.aux0:SEGLEN - SEGENV.aux0 + idexR;
|
||||
for (uint8_t i = 0; i <= gap ; i++) {
|
||||
if ((idexR - i) < 0) idexR = SEGLEN-1 + i;
|
||||
if ((idexB - i) < 0) idexB = SEGLEN-1 + i;
|
||||
setPixelColor(idexR-i, color1);
|
||||
setPixelColor(idexB-i, color2);
|
||||
}
|
||||
SEGENV.aux0 = idexR;
|
||||
}
|
||||
SEGENV.aux0 = idexR;
|
||||
}
|
||||
|
||||
return FRAMETIME;
|
||||
@ -1253,7 +1264,7 @@ uint16_t WS2812FX::police_base(uint32_t color1, uint32_t color2)
|
||||
//American Police Light with all LEDs Red and Blue
|
||||
uint16_t WS2812FX::mode_police_all()
|
||||
{
|
||||
return police_base(RED, BLUE);
|
||||
return police_base(RED, BLUE, true);
|
||||
}
|
||||
|
||||
|
||||
@ -1262,14 +1273,14 @@ uint16_t WS2812FX::mode_police()
|
||||
{
|
||||
fill(SEGCOLOR(1));
|
||||
|
||||
return police_base(RED, BLUE);
|
||||
return police_base(RED, BLUE, false);
|
||||
}
|
||||
|
||||
|
||||
//Police All with custom colors
|
||||
uint16_t WS2812FX::mode_two_areas()
|
||||
{
|
||||
return police_base(SEGCOLOR(0), SEGCOLOR(1));
|
||||
return police_base(SEGCOLOR(0), SEGCOLOR(1), true);
|
||||
}
|
||||
|
||||
|
||||
@ -1279,7 +1290,7 @@ uint16_t WS2812FX::mode_two_dots()
|
||||
fill(SEGCOLOR(2));
|
||||
uint32_t color2 = (SEGCOLOR(1) == SEGCOLOR(2)) ? SEGCOLOR(0) : SEGCOLOR(1);
|
||||
|
||||
return police_base(SEGCOLOR(0), color2);
|
||||
return police_base(SEGCOLOR(0), color2, false);
|
||||
}
|
||||
|
||||
|
||||
@ -3087,8 +3098,8 @@ uint16_t WS2812FX::mode_percent(void) {
|
||||
uint16_t active_leds = (percent < 100) ? SEGLEN * percent / 100.0
|
||||
: SEGLEN * (200 - percent) / 100.0;
|
||||
|
||||
if (SEGENV.call == 0) SEGENV.step = 0;
|
||||
uint8_t size = (1 + ((SEGMENT.speed * SEGLEN) >> 11)) & 0xFF ;
|
||||
uint8_t size = (1 + ((SEGMENT.speed * SEGLEN) >> 11));
|
||||
if (SEGMENT.speed == 255) size = 255;
|
||||
|
||||
if (percent < 100) {
|
||||
for (uint16_t i = 0; i < SEGLEN; i++) {
|
||||
@ -3122,41 +3133,28 @@ uint16_t WS2812FX::mode_percent(void) {
|
||||
}
|
||||
|
||||
uint16_t WS2812FX::mode_heartbeat(void) {
|
||||
static unsigned long lastBeat = 0;
|
||||
static bool secondBeatActive = false;
|
||||
|
||||
uint8_t bpm = 40 + (SEGMENT.speed >> 4);
|
||||
uint32_t msPerBeat = (60000 / bpm);
|
||||
uint32_t secondBeat = (msPerBeat / 3);
|
||||
|
||||
// Get and translate the segment's size option
|
||||
uint8_t size = 2 << ((SEGMENT.options >> 1) & 0x03); // 2,4,8,16
|
||||
uint32_t bri_lower = SEGENV.aux1;
|
||||
bri_lower = bri_lower * 2042 / (2048 + SEGMENT.intensity);
|
||||
SEGENV.aux1 = bri_lower;
|
||||
|
||||
// copy pixels from the middle of the segment to the edges
|
||||
uint16_t bytesPerPixelBlock = size * 4;
|
||||
uint16_t centerOffset = (SEGLEN / 2) * 4;
|
||||
uint16_t byteCount = centerOffset - bytesPerPixelBlock;
|
||||
memmove(bus->GetPixels(), bus->GetPixels() + bytesPerPixelBlock, byteCount);
|
||||
memmove(bus->GetPixels() + centerOffset + bytesPerPixelBlock, bus->GetPixels() + centerOffset, byteCount);
|
||||
|
||||
fade_out(255 - SEGMENT.intensity);
|
||||
|
||||
unsigned long beatTimer = millis() - lastBeat;
|
||||
if((beatTimer > secondBeat) && !secondBeatActive) { // time for the second beat?
|
||||
uint16_t startLed = (SEGLEN / 2) - size;
|
||||
for (uint16_t i = startLed; i < startLed + (size * 2); i++) {
|
||||
setPixelColor(i, SEGMENT.colors[0]);
|
||||
}
|
||||
secondBeatActive = 1;
|
||||
unsigned long beatTimer = millis() - SEGENV.step;
|
||||
if((beatTimer > secondBeat) && !SEGENV.aux0) { // time for the second beat?
|
||||
SEGENV.aux1 = UINT16_MAX; //full bri
|
||||
SEGENV.aux0 = 1;
|
||||
}
|
||||
if(beatTimer > msPerBeat) { // time to reset the beat timer?
|
||||
uint16_t startLed = (SEGLEN / 2) - size;
|
||||
for (uint16_t i = startLed; i < startLed + (size * 2); i++) {
|
||||
setPixelColor(i, SEGMENT.colors[0]);
|
||||
}
|
||||
secondBeatActive = 0;
|
||||
lastBeat = millis();
|
||||
SEGENV.aux1 = UINT16_MAX; //full bri
|
||||
SEGENV.aux0 = 0;
|
||||
SEGENV.step = millis();
|
||||
}
|
||||
|
||||
for (uint16_t i = 0; i < SEGLEN; i++) {
|
||||
setPixelColor(i, color_blend(color_from_palette(i, true, PALETTE_SOLID_WRAP, 0), SEGCOLOR(1), 255 - (SEGENV.aux1 >> 8)));
|
||||
}
|
||||
|
||||
return FRAMETIME;
|
||||
}
|
||||
}
|
||||
|
@ -381,8 +381,8 @@ class WS2812FX {
|
||||
_mode[FX_MODE_DRIP] = &WS2812FX::mode_drip;
|
||||
_mode[FX_MODE_PLASMA] = &WS2812FX::mode_plasma;
|
||||
_mode[FX_MODE_PERCENT] = &WS2812FX::mode_percent;
|
||||
_mode[FX_MODE_HEARTBEAT] = &WS2812FX::mode_heartbeat;
|
||||
_mode[FX_MODE_RIPPLE_RAINBOW] = &WS2812FX::mode_ripple_rainbow;
|
||||
_mode[FX_MODE_HEARTBEAT] = &WS2812FX::mode_heartbeat;
|
||||
|
||||
_brightness = DEFAULT_BRIGHTNESS;
|
||||
currentPalette = CRGBPalette16(CRGB::Black);
|
||||
@ -614,7 +614,7 @@ class WS2812FX {
|
||||
chase(uint32_t, uint32_t, uint32_t, bool),
|
||||
gradient_base(bool),
|
||||
ripple_base(bool),
|
||||
police_base(uint32_t, uint32_t),
|
||||
police_base(uint32_t, uint32_t, bool),
|
||||
running(uint32_t, uint32_t),
|
||||
tricolor_chase(uint32_t, uint32_t),
|
||||
twinklefox_base(bool),
|
||||
|
File diff suppressed because one or more lines are too long
@ -189,7 +189,16 @@ const char PAGE_settings_sync[] PROGMEM = R"=====(<!DOCTYPE html>
|
||||
<h2>Sync setup</h2>
|
||||
<h3>Button setup</h3>
|
||||
On/Off button enabled: <input type="checkbox" name="BT"><br>
|
||||
Infrared receiver type (0 = disabled): <input name="IR" type="number" min="0" max="6" required><br>
|
||||
Infrared remote:
|
||||
<select name=IR>
|
||||
<option value=0>Disabled</option>
|
||||
<option value=1>24-key RGB</option>
|
||||
<option value=2>24-key with CT</option>
|
||||
<option value=3>40-key blue</option>
|
||||
<option value=4>44-key RGB</option>
|
||||
<option value=5>21-key RGB</option>
|
||||
<option value=6>6-key black</option>
|
||||
</select><br>
|
||||
<a href="https://github.com/Aircoookie/WLED/wiki/Infrared-Control" target="_blank">IR info</a>
|
||||
<h3>WLED Broadcast</h3>
|
||||
UDP Port: <input name="UP" type="number" min="1" max="65535" required><br>
|
||||
@ -207,12 +216,16 @@ Use E1.31 multicast: <input type="checkbox" name="EM"><br>
|
||||
E1.31 start universe: <input name="EU" type="number" min="1" max="63999" required><br>
|
||||
<i>Reboot required.</i> Check out <a href="https://github.com/ahodges9/LedFx" target="_blank">LedFx</a>!<br>
|
||||
DMX start address: <input name="DA" type="number" min="1" max="510" value="1" required><br>
|
||||
DMX mode: <input name="DM" type="radio" value="0"> disabled<br>
|
||||
<input name="DM" type="radio" value="1"> Single RGB (3 Channels for all LEDs: Red Green Blue)<br>
|
||||
<input name="DM" type="radio" value="2"> Single DRGB (4 Channels for all LEDs: Dimmer Red Green Blue)<br>
|
||||
<input name="DM" type="radio" value="3"> Effect (11 Channels for properties: Dimmer FX Speed Intensity Palette PriR PriG PriB SecR SecG SecB)<br>
|
||||
<input name="DM" type="radio" value="4"> Multiple RGB (3 Channels for each LED: Red Green Blue)<br>
|
||||
<input name="DM" type="radio" value="5"> Multiple DRGB (1+3 Channels for each LED: Dimmer R1 G1 B1 R2 G2 B2...)<br><br>
|
||||
DMX mode:
|
||||
<select name=DM>
|
||||
<option value=0>Disabled</option>
|
||||
<option value=1>Single RGB</option>
|
||||
<option value=2>Single DRGB</option>
|
||||
<option value=3>Effect</option>
|
||||
<option value=4>Multi RGB</option>
|
||||
<option value=5>Multi DRGB</option>
|
||||
</select><br>
|
||||
<a href="https://github.com/Aircoookie/WLED/wiki/E1.31-DMX" target="_blank">E1.31 info</a><br>
|
||||
Timeout: <input name="ET" type="number" min="1" max="65000" required> ms<br>
|
||||
Force max brightness: <input type="checkbox" name="FB"><br>
|
||||
Disable realtime gamma correction: <input type="checkbox" name="RG"><br>
|
||||
|
2937
wled00/html_ui.h
2937
wled00/html_ui.h
File diff suppressed because it is too large
Load Diff
@ -90,7 +90,7 @@
|
||||
#endif
|
||||
|
||||
//version code in format yymmddb (b = daily build)
|
||||
#define VERSION 2002172
|
||||
#define VERSION 2002181
|
||||
|
||||
char versionString[] = "0.9.1";
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user