mirror of
https://github.com/wled/WLED.git
synced 2025-07-15 06:46:34 +00:00
Bugfixes
- FX: Breathe, Meteor - IR: use Segment - UI: palette search, LED settings
This commit is contained in:
parent
a812fc07f2
commit
5874b78349
@ -336,14 +336,14 @@ static const char _data_FX_MODE_DYNAMIC_SMOOTH[] PROGMEM = "Dynamic Smooth@!,!;;
|
||||
*/
|
||||
uint16_t mode_breath(void) {
|
||||
unsigned var = 0;
|
||||
unsigned counter = (strip.now * ((SEGMENT.speed >> 3) +10));
|
||||
counter = ((counter >> 2) + (counter >> 4)) & 0xFFFFU; //0-16384 + 0-2048
|
||||
unsigned counter = (strip.now * ((SEGMENT.speed >> 3) +10)) & 0xFFFFU;
|
||||
counter = (counter >> 2) + (counter >> 4); //0-16384 + 0-2048
|
||||
if (counter < 16384) {
|
||||
if (counter > 8192) counter = 8192 - (counter - 8192);
|
||||
var = sin16(counter) / 103; //close to parabolic in range 0-8192, max val. 23170
|
||||
}
|
||||
|
||||
uint8_t lum = 30 + var;
|
||||
unsigned lum = 30 + var;
|
||||
for (int i = 0; i < SEGLEN; i++) {
|
||||
SEGMENT.setPixelColor(i, color_blend(SEGCOLOR(1), SEGMENT.color_from_palette(i, true, PALETTE_SOLID_WRAP, 0), lum));
|
||||
}
|
||||
@ -358,7 +358,7 @@ static const char _data_FX_MODE_BREATH[] PROGMEM = "Breathe@!;!,!;!;01";
|
||||
*/
|
||||
uint16_t mode_fade(void) {
|
||||
unsigned counter = (strip.now * ((SEGMENT.speed >> 3) +10));
|
||||
uint8_t lum = triwave16(counter) >> 8;
|
||||
unsigned lum = triwave16(counter) >> 8;
|
||||
|
||||
for (int i = 0; i < SEGLEN; i++) {
|
||||
SEGMENT.setPixelColor(i, color_blend(SEGCOLOR(1), SEGMENT.color_from_palette(i, true, PALETTE_SOLID_WRAP, 0), lum));
|
||||
@ -1779,8 +1779,8 @@ typedef struct Oscillator {
|
||||
/ Oscillating bars of color, updated with standard framerate
|
||||
*/
|
||||
uint16_t mode_oscillate(void) {
|
||||
unsigned numOscillators = 3;
|
||||
unsigned dataSize = sizeof(oscillator) * numOscillators;
|
||||
constexpr unsigned numOscillators = 3;
|
||||
constexpr unsigned dataSize = sizeof(oscillator) * numOscillators;
|
||||
|
||||
if (!SEGENV.allocateData(dataSize)) return mode_static(); //allocation failed
|
||||
|
||||
@ -2347,31 +2347,41 @@ uint16_t mode_meteor() {
|
||||
unsigned counter = strip.now * ((SEGMENT.speed >> 2) +8);
|
||||
uint16_t in = counter * SEGLEN >> 16;
|
||||
|
||||
const int max = SEGMENT.palette==5 || !SEGMENT.check1 ? 240 : 255;
|
||||
const int max = SEGMENT.palette==5 ? 239 : 255; // "* Colors only" palette blends end with start
|
||||
// fade all leds to colors[1] in LEDs one step
|
||||
for (int i = 0; i < SEGLEN; i++) {
|
||||
if (random8() <= 255 - SEGMENT.intensity) {
|
||||
byte meteorTrailDecay = 162 + random8(92);
|
||||
int meteorTrailDecay = 128 + random8(127);
|
||||
trail[i] = scale8(trail[i], meteorTrailDecay);
|
||||
uint32_t col = SEGMENT.check1 ? SEGMENT.color_from_palette(i, true, false, 0, trail[i]) : SEGMENT.color_from_palette(trail[i], false, true, 255);
|
||||
int index = trail[i];
|
||||
int idx = 255;
|
||||
int bri = SEGMENT.palette==35 || SEGMENT.palette==36 ? 255 : trail[i];
|
||||
if (!SEGMENT.check1) {
|
||||
idx = 0;
|
||||
index = map(i,0,SEGLEN,0,max);
|
||||
bri = trail[i];
|
||||
}
|
||||
uint32_t col = SEGMENT.color_from_palette(index, false, false, idx, bri); // full brightness for Fire
|
||||
SEGMENT.setPixelColor(i, col);
|
||||
}
|
||||
}
|
||||
|
||||
// draw meteor
|
||||
for (unsigned j = 0; j < meteorSize; j++) {
|
||||
unsigned index = in + j;
|
||||
if (index >= SEGLEN) {
|
||||
index -= SEGLEN;
|
||||
for (int j = 0; j < meteorSize; j++) {
|
||||
int index = (in + j) % SEGLEN;
|
||||
int idx = 255;
|
||||
int i = trail[index] = max;
|
||||
if (!SEGMENT.check1) {
|
||||
i = map(index,0,SEGLEN,0,max);
|
||||
idx = 0;
|
||||
}
|
||||
trail[index] = max;
|
||||
uint32_t col = SEGMENT.check1 ? SEGMENT.color_from_palette(index, true, false, 0, trail[index]) : SEGMENT.color_from_palette(trail[index], false, true, 255);
|
||||
uint32_t col = SEGMENT.color_from_palette(i, false, false, idx, 255); // full brightness
|
||||
SEGMENT.setPixelColor(index, col);
|
||||
}
|
||||
|
||||
return FRAMETIME;
|
||||
}
|
||||
static const char _data_FX_MODE_METEOR[] PROGMEM = "Meteor@!,Trail,,,,Gradient;;!;1";
|
||||
static const char _data_FX_MODE_METEOR[] PROGMEM = "Meteor@!,Trail,,,,Gradient;!;!;1";
|
||||
|
||||
|
||||
// smooth meteor effect
|
||||
|
@ -2837,7 +2837,7 @@ function search(field, listId = null) {
|
||||
if (gId("filters").querySelectorAll("input[type=checkbox]:checked").length) return;
|
||||
|
||||
// filter list items but leave (Default & Solid) always visible
|
||||
const listItems = gId("fxlist").querySelectorAll('.lstI');
|
||||
const listItems = gId(listId).querySelectorAll('.lstI');
|
||||
listItems.forEach((listItem,i)=>{
|
||||
if (listId!=='pcont' && i===0) return;
|
||||
const listItemName = listItem.querySelector('.lstIname').innerText.toUpperCase();
|
||||
|
@ -290,7 +290,7 @@
|
||||
// do we have a led count field
|
||||
if (nm=="LC") {
|
||||
let c = parseInt(LC.value,10); //get LED count
|
||||
if (c > 300 && i < 8) maxB = oMaxB - max(maxD-7,0); //TODO: hard limit for buses when using ESP32 parallel I2S
|
||||
if (c > 300 && i < 8) maxB = oMaxB - Math.max(maxD-7,0); //TODO: hard limit for buses when using ESP32 parallel I2S
|
||||
if (!customStarts || !startsDirty[n]) gId("ls"+n).value=sLC; //update start value
|
||||
gId("ls"+n).disabled = !customStarts; //enable/disable field editing
|
||||
if (c) {
|
||||
@ -864,7 +864,7 @@ Swap: <select id="xw${s}" name="XW${s}">
|
||||
<hr class="sml">
|
||||
<h3>Defaults</h3>
|
||||
Turn LEDs on after power up/reset: <input type="checkbox" name="BO"><br>
|
||||
Default brightness: <input name="CA" type="number" class="m" min="0" max="255" required> (0-255)<br><br>
|
||||
Default brightness: <input name="CA" type="number" class="m" min="1" max="255" required> (1-255)<br><br>
|
||||
Apply preset <input name="BP" type="number" class="m" min="0" max="250" required> at boot (0 uses defaults)
|
||||
<br><br>
|
||||
Use Gamma correction for color: <input type="checkbox" name="GC"> (strongly recommended)<br>
|
||||
|
@ -84,11 +84,11 @@ static void changeEffect(uint8_t fx)
|
||||
for (unsigned i = 0; i < strip.getSegmentsNum(); i++) {
|
||||
Segment& seg = strip.getSegment(i);
|
||||
if (!seg.isActive() || !seg.isSelected()) continue;
|
||||
strip.setMode(i, fx);
|
||||
seg.setMode(fx);
|
||||
}
|
||||
setValuesFromFirstSelectedSeg();
|
||||
} else {
|
||||
strip.setMode(strip.getMainSegmentId(), fx);
|
||||
strip.getSegment(strip.getMainSegmentId()).setMode(fx);
|
||||
setValuesFromMainSeg();
|
||||
}
|
||||
stateChanged = true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user