Skip to content

Commit baf49b8

Browse files
committed
Semi-working segment on/off transition
1 parent 3577da0 commit baf49b8

File tree

4 files changed

+16
-7
lines changed

4 files changed

+16
-7
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
### Builds after release 0.12.0
44

5+
#### Build 2109200
6+
7+
- Added segment names (PR #2184)
8+
- Improved Police and other effects (PR #2184)
9+
- Reverted PR #1902 (Live color correction - will be implemented as usermod) (PR #2175)
10+
511
#### Build 2109100
612

713
- Added an auto create segments per bus setting

wled00/FX.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -274,22 +274,22 @@ class WS2812FX {
274274
}*/
275275
void setOption(uint8_t n, bool val, uint8_t segn = 255)
276276
{
277-
//bool prevOn = false;
278-
//if (n == SEG_OPTION_ON) prevOn = getOption(SEG_OPTION_ON);
277+
bool prevOn = false;
278+
if (n == SEG_OPTION_ON) prevOn = getOption(SEG_OPTION_ON);
279279
if (val) {
280280
options |= 0x01 << n;
281281
} else
282282
{
283283
options &= ~(0x01 << n);
284284
}
285285
//transitions on segment on/off don't work correctly at this point
286-
/*if (n == SEG_OPTION_ON && segn < MAX_NUM_SEGMENTS && getOption(SEG_OPTION_ON) != prevOn) {
287-
if (getOption(SEG_OPTION_ON)) {
286+
if (n == SEG_OPTION_ON && segn < MAX_NUM_SEGMENTS && val != prevOn) {
287+
if (val) {
288288
ColorTransition::startTransition(0, colors[0], instance->_transitionDur, segn, 0);
289289
} else {
290290
ColorTransition::startTransition(opacity, colors[0], instance->_transitionDur, segn, 0);
291291
}
292-
}*/
292+
}
293293
}
294294
bool getOption(uint8_t n)
295295
{
@@ -473,6 +473,7 @@ class WS2812FX {
473473
uint8_t segn = segment & 0x3F;
474474
if (segn >= MAX_NUM_SEGMENTS) return 0;
475475
uint8_t briNew = instance->_segments[segn].opacity;
476+
if (!instance->_segments[segn].getOption(SEG_OPTION_ON)) briNew = 0; //NEW
476477
uint32_t prog = progress() + 1;
477478
return ((briNew * prog) + (briOld * (0x10000 - prog))) >> 16;
478479
}

wled00/json.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,9 @@ void deserializeSegment(JsonObject elem, byte it, byte presetId)
7070
seg.setOption(SEG_OPTION_ON, 1, id);
7171
}
7272

73-
seg.setOption(SEG_OPTION_ON, elem["on"] | seg.getOption(SEG_OPTION_ON), id);
73+
bool on = elem["on"] | seg.getOption(SEG_OPTION_ON);
74+
if (elem["on"].is<const char*>() && elem["on"].as<const char*>()[0] == 't') on = !on;
75+
seg.setOption(SEG_OPTION_ON, on, id);
7476

7577
JsonArray colarr = elem["col"];
7678
if (!colarr.isNull())

wled00/wled.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*/
99

1010
// version code in format yymmddb (b = daily build)
11-
#define VERSION 2109100
11+
#define VERSION 2109200
1212

1313
//uncomment this if you have a "my_config.h" file you'd like to use
1414
//#define WLED_USE_MY_CONFIG

0 commit comments

Comments
 (0)