UI: show color controls based on segment light capabilities (#2567)
* Dynamic hiding of unused color controls in UI (e.g. a PWM white bus with no auto white mode will not display the color wheel or palette list) * Store segment capabilities Don't use palettes if no RGB supported Make it safe to update busses using `/json/cfg`
This commit is contained in:
committed by
GitHub
parent
85b1c309d1
commit
9c864c9759
11
wled00/FX.h
11
wled00/FX.h
@@ -247,7 +247,7 @@ class WS2812FX {
|
||||
|
||||
// segment parameters
|
||||
public:
|
||||
typedef struct Segment { // 30 (32 in memory) bytes
|
||||
typedef struct Segment { // 31 (32 in memory) bytes
|
||||
uint16_t start;
|
||||
uint16_t stop; //segment invalid if stop == 0
|
||||
uint16_t offset;
|
||||
@@ -260,6 +260,7 @@ class WS2812FX {
|
||||
uint8_t opacity;
|
||||
uint32_t colors[NUM_COLORS];
|
||||
uint8_t cct; //0==1900K, 255==10091K
|
||||
uint8_t _capabilities;
|
||||
char *name;
|
||||
bool setColor(uint8_t slot, uint32_t c, uint8_t segn) { //returns true if changed
|
||||
if (slot >= NUM_COLORS || segn >= MAX_NUM_SEGMENTS) return false;
|
||||
@@ -335,7 +336,8 @@ class WS2812FX {
|
||||
return vLength;
|
||||
}
|
||||
uint8_t differs(Segment& b);
|
||||
uint8_t getLightCapabilities();
|
||||
inline uint8_t getLightCapabilities() {return _capabilities;}
|
||||
void refreshLightCapabilities();
|
||||
} segment;
|
||||
|
||||
// segment runtime parameters
|
||||
@@ -887,14 +889,15 @@ class WS2812FX {
|
||||
|
||||
uint32_t _colors_t[3];
|
||||
uint8_t _bri_t;
|
||||
bool _no_rgb = false;
|
||||
|
||||
uint8_t _segment_index = 0;
|
||||
uint8_t _segment_index_palette_last = 99;
|
||||
uint8_t _mainSegment;
|
||||
|
||||
segment _segments[MAX_NUM_SEGMENTS] = { // SRAM footprint: 24 bytes per element
|
||||
// start, stop, offset, speed, intensity, palette, mode, options, grouping, spacing, opacity (unused), color[]
|
||||
{0, 7, 0, DEFAULT_SPEED, 128, 0, DEFAULT_MODE, NO_OPTIONS, 1, 0, 255, {DEFAULT_COLOR}}
|
||||
// start, stop, offset, speed, intensity, palette, mode, options, grouping, spacing, opacity (unused), color[], capabilities
|
||||
{0, 7, 0, DEFAULT_SPEED, 128, 0, DEFAULT_MODE, NO_OPTIONS, 1, 0, 255, {DEFAULT_COLOR}, 0}
|
||||
};
|
||||
segment_runtime _segment_runtimes[MAX_NUM_SEGMENTS]; // SRAM footprint: 28 bytes per element
|
||||
friend class Segment_runtime;
|
||||
|
||||
Reference in New Issue
Block a user