Fix for segment on/off transitions.
Fix for missing return. Slightly smoother Chunchun, added Speed parameter for Hiphotic.
This commit is contained in:
parent
d3d8fdff13
commit
af5e38e5ee
@ -4005,7 +4005,7 @@ static const char _data_FX_MODE_FLOW[] PROGMEM = "Flow@!,!;!,!,!;!;mp12=1,1d"; /
|
||||
uint16_t mode_chunchun(void)
|
||||
{
|
||||
//SEGMENT.fill(SEGCOLOR(1));
|
||||
SEGMENT.fade_out(254);
|
||||
SEGMENT.fade_out(254); // add a bit of trail
|
||||
uint16_t counter = strip.now * (6 + (SEGMENT.speed >> 4));
|
||||
uint16_t numBirds = 2 + (SEGLEN >> 3); // 2 + 1/8 of a segment
|
||||
uint16_t span = (SEGMENT.intensity << 8) / numBirds;
|
||||
@ -4016,6 +4016,7 @@ uint16_t mode_chunchun(void)
|
||||
uint16_t megumin = sin16(counter) + 0x8000;
|
||||
uint16_t bird = uint32_t(megumin * SEGLEN) >> 16;
|
||||
uint32_t c = SEGMENT.color_from_palette((i * 255)/ numBirds, false, false, 0); // no palette wrapping
|
||||
bird = constrain(bird, 0, SEGLEN-1);
|
||||
SEGMENT.setPixelColor(bird, c);
|
||||
}
|
||||
return FRAMETIME;
|
||||
@ -4943,7 +4944,7 @@ uint16_t mode_2DHiphotic() { // By: ldirko https://edit
|
||||
|
||||
const uint16_t cols = SEGMENT.virtualWidth();
|
||||
const uint16_t rows = SEGMENT.virtualHeight();
|
||||
const uint32_t a = strip.now / 8;
|
||||
const uint32_t a = strip.now / ((SEGMENT.custom3>>1)+1);
|
||||
|
||||
for (int x = 0; x < cols; x++) {
|
||||
for (int y = 0; y < rows; y++) {
|
||||
@ -4953,7 +4954,7 @@ uint16_t mode_2DHiphotic() { // By: ldirko https://edit
|
||||
|
||||
return FRAMETIME;
|
||||
} // mode_2DHiphotic()
|
||||
static const char _data_FX_MODE_2DHIPHOTIC[] PROGMEM = "Hiphotic@X scale,Y scale;;!;2d";
|
||||
static const char _data_FX_MODE_2DHIPHOTIC[] PROGMEM = "Hiphotic@X scale,Y scale,,,Speed;;!;2d";
|
||||
|
||||
|
||||
/////////////////////////
|
||||
|
@ -427,6 +427,8 @@ uint16_t Segment::virtualLength() const {
|
||||
|
||||
void IRAM_ATTR Segment::setPixelColor(int i, uint32_t col)
|
||||
{
|
||||
if (i >= virtualLength() || i<0) return; // if pixel would fall out of segment just exit
|
||||
|
||||
#ifndef WLED_DISABLE_2D
|
||||
if (is2D()) { // if this does not work use strip.isMatrix
|
||||
uint16_t vH = virtualHeight(); // segment height in logical pixels
|
||||
@ -461,16 +463,15 @@ void IRAM_ATTR Segment::setPixelColor(int i, uint32_t col)
|
||||
}
|
||||
return;
|
||||
} else if (width()==1 || height()==1) {
|
||||
// we have a vertical or horizontal 1D segment (WARNING: virtual...() may be transposed)
|
||||
int x = 0, y = 0;
|
||||
// we have a vertical or horizontal 1D segment
|
||||
if (height()>1) { y = i; }
|
||||
if (width()>1 ) { x = i; }
|
||||
if (transpose ) { int t = x; x = y; y = t; }
|
||||
if (virtualHeight()>1) y = i;
|
||||
if (virtualWidth() >1) x = i;
|
||||
setPixelColorXY(x, y, col);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (i >= virtualLength() || i<0) return; // if pixel would fall out of segment just exit
|
||||
if (leds) leds[i] = col;
|
||||
|
||||
uint16_t len = length();
|
||||
|
@ -197,10 +197,10 @@ void handleAnalog(uint8_t b)
|
||||
// otherwise use "double press" for segment selection
|
||||
Segment& seg = strip.getSegment(macroDoublePress[b]);
|
||||
if (aRead == 0) {
|
||||
seg.on = false; // off
|
||||
seg.setOption(SEG_OPTION_ON, false); // off (use transition)
|
||||
} else {
|
||||
seg.setOpacity(aRead);
|
||||
seg.on = true;
|
||||
seg.setOption(SEG_OPTION_ON, true); // on (use transition)
|
||||
}
|
||||
// this will notify clients of update (websockets,mqtt,etc)
|
||||
updateInterfaces(CALL_MODE_BUTTON);
|
||||
|
@ -102,12 +102,12 @@ void deserializeSegment(JsonObject elem, byte it, byte presetId)
|
||||
byte segbri = seg.opacity;
|
||||
if (getVal(elem["bri"], &segbri)) {
|
||||
if (segbri > 0) seg.setOpacity(segbri);
|
||||
seg.on = segbri;
|
||||
seg.setOption(SEG_OPTION_ON, segbri); // use transition
|
||||
}
|
||||
|
||||
bool on = elem["on"] | seg.on;
|
||||
if (elem["on"].is<const char*>() && elem["on"].as<const char*>()[0] == 't') on = !on;
|
||||
seg.on = on;
|
||||
seg.setOption(SEG_OPTION_ON, on); // use transition
|
||||
bool frz = elem["frz"] | seg.freeze;
|
||||
if (elem["frz"].is<const char*>() && elem["frz"].as<const char*>()[0] == 't') frz = !seg.freeze;
|
||||
seg.freeze = frz;
|
||||
|
@ -713,7 +713,7 @@ bool handleSet(AsyncWebServerRequest *request, const String& req, bool apply)
|
||||
pos = req.indexOf(F("SB=")); //Segment brightness/opacity
|
||||
if (pos > 0) {
|
||||
byte segbri = getNumVal(&req, pos);
|
||||
selseg.on = segbri;
|
||||
selseg.setOption(SEG_OPTION_ON, segbri); // use transition
|
||||
if (segbri) {
|
||||
selseg.setOpacity(segbri);
|
||||
}
|
||||
@ -722,9 +722,9 @@ bool handleSet(AsyncWebServerRequest *request, const String& req, bool apply)
|
||||
pos = req.indexOf(F("SW=")); //segment power
|
||||
if (pos > 0) {
|
||||
switch (getNumVal(&req, pos)) {
|
||||
case 0: selseg.on = false; break;
|
||||
case 1: selseg.on = true; break;
|
||||
default: selseg.on = !selseg.on; break;
|
||||
case 0: selseg.setOption(SEG_OPTION_ON, false); break; // use transition
|
||||
case 1: selseg.setOption(SEG_OPTION_ON, true); break; // use transition
|
||||
default: selseg.setOption(SEG_OPTION_ON, !selseg.on); break; // use transition
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
*/
|
||||
|
||||
// version code in format yymmddb (b = daily build)
|
||||
#define VERSION 2208222
|
||||
#define VERSION 2208231
|
||||
|
||||
//uncomment this if you have a "my_config.h" file you'd like to use
|
||||
//#define WLED_USE_MY_CONFIG
|
||||
|
@ -425,7 +425,7 @@ void deEEP() {
|
||||
for (byte j = 0; j < strip.getMaxSegments(); j++)
|
||||
{
|
||||
strip.getSegment(j).opacity = 255;
|
||||
strip.getSegment(j).on = true;
|
||||
strip.getSegment(j).setOption(SEG_OPTION_ON, true); // use transistion
|
||||
}
|
||||
}
|
||||
serializeState(pObj, true, false, true);
|
||||
|
Loading…
Reference in New Issue
Block a user