Merge remote-tracking branch 'origin/ac_main' into mdev

This commit is contained in:
Ewoud
2022-11-15 12:47:32 +01:00
30 changed files with 3841 additions and 3545 deletions

View File

@@ -78,7 +78,7 @@ CRGB *Segment::_globalLeds = nullptr;
// copy constructor
Segment::Segment(const Segment &orig) {
DEBUG_PRINTLN(F("-- Copy segment constructor --"));
//DEBUG_PRINTLN(F("-- Copy segment constructor --"));
memcpy(this, &orig, sizeof(Segment));
name = nullptr;
data = nullptr;
@@ -94,7 +94,7 @@ Segment::Segment(const Segment &orig) {
// move constructor
Segment::Segment(Segment &&orig) noexcept {
DEBUG_PRINTLN(F("-- Move segment constructor --"));
//DEBUG_PRINTLN(F("-- Move segment constructor --"));
memcpy(this, &orig, sizeof(Segment));
orig.name = nullptr;
orig.data = nullptr;
@@ -106,7 +106,7 @@ Segment::Segment(Segment &&orig) noexcept {
// copy assignment
Segment& Segment::operator= (const Segment &orig) {
DEBUG_PRINTLN(F("-- Copying segment --"));
//DEBUG_PRINTLN(F("-- Copying segment --"));
if (this != &orig) {
// clean destination
if (name) delete[] name;
@@ -133,7 +133,7 @@ Segment& Segment::operator= (const Segment &orig) {
// move assignment
Segment& Segment::operator= (Segment &&orig) noexcept {
DEBUG_PRINTLN(F("-- Moving segment --"));
//DEBUG_PRINTLN(F("-- Moving segment --"));
if (this != &orig) {
if (name) delete[] name; // free old name
deallocateData(); // free old runtime data
@@ -330,11 +330,7 @@ uint8_t Segment::currentBri(uint8_t briNew, bool useCct) {
}
uint8_t Segment::currentMode(uint8_t newMode) {
if (transitional && _t) {
return _t->_modeP;
} else {
return newMode;
}
return (progress()>32767U) ? newMode : _t->_modeP; // change effect in the middle of transition
}
uint32_t Segment::currentColor(uint8_t slot, uint32_t colorNew) {
@@ -373,6 +369,7 @@ bool Segment::setColor(uint8_t slot, uint32_t c) { //returns true if changed
if (slot >= NUM_COLORS || c == colors[slot]) return false;
if (fadeTransition) startTransition(strip.getTransition()); // start transition prior to change
colors[slot] = c;
stateChanged = true; // send UDP/WS broadcast
return true;
}
@@ -385,12 +382,14 @@ void Segment::setCCT(uint16_t k) {
if (cct == k) return;
if (fadeTransition) startTransition(strip.getTransition()); // start transition prior to change
cct = k;
stateChanged = true; // send UDP/WS broadcast
}
void Segment::setOpacity(uint8_t o) {
if (opacity == o) return;
if (fadeTransition) startTransition(strip.getTransition()); // start transition prior to change
opacity = o;
stateChanged = true; // send UDP/WS broadcast
}
void Segment::setOption(uint8_t n, bool val) {
@@ -398,6 +397,7 @@ void Segment::setOption(uint8_t n, bool val) {
if (fadeTransition && n == SEG_OPTION_ON && val != prevOn) startTransition(strip.getTransition()); // start transition prior to change
if (val) options |= 0x01 << n;
else options &= ~(0x01 << n);
if (!(n == SEG_OPTION_SELECTED || n == SEG_OPTION_RESET || n == SEG_OPTION_TRANSITIONAL)) stateChanged = true; // send UDP/WS broadcast
}
void Segment::setMode(uint8_t fx, bool loadDefaults) {
@@ -429,6 +429,7 @@ void Segment::setMode(uint8_t fx, bool loadDefaults) {
}
}
}
stateChanged = true; // send UDP/WS broadcast
}
}
}
@@ -440,6 +441,7 @@ void Segment::setPalette(uint8_t pal) {
palette = pal;
}
}
stateChanged = true; // send UDP/WS broadcast
}
// 2D matrix
@@ -920,11 +922,10 @@ uint8_t Segment::differs(Segment& b) const {
if (startY != b.startY) d |= SEG_DIFFERS_BOUNDS;
if (stopY != b.stopY) d |= SEG_DIFFERS_BOUNDS;
//bit pattern: msb first: [transposed mirrorY reverseY] transitional (tbd) paused needspixelstate mirrored on reverse selected
if ((options & 0b1111111110011110) != (b.options & 0b1111111110011110)) d |= SEG_DIFFERS_OPT;
if ((options & 0x01) != (b.options & 0x01)) d |= SEG_DIFFERS_SEL;
for (uint8_t i = 0; i < NUM_COLORS; i++) if (colors[i] != b.colors[i]) d |= SEG_DIFFERS_COL;
//bit pattern: (msb first) sound:3, mapping:3, transposed, mirrorY, reverseY, [transitional, reset,] paused, mirrored, on, reverse, [selected]
if ((options & 0b1111111110011110U) != (b.options & 0b1111111110011110U)) d |= SEG_DIFFERS_OPT;
if ((options & 0x0001U) != (b.options & 0x0001U)) d |= SEG_DIFFERS_SEL;
for (uint8_t i = 0; i < NUM_COLORS; i++) if (colors[i] != b.colors[i]) d |= SEG_DIFFERS_COL;
return d;
}
@@ -1117,8 +1118,8 @@ uint8_t Segment::get_random_wheel_index(uint8_t pos) {
uint32_t Segment::color_from_palette(uint16_t i, bool mapping, bool wrap, uint8_t mcol, uint8_t pbri)
{
// default palette or no RGB support on segment
if ((palette == 0 && mcol < NUM_COLORS) || !(_capabilities & 0x01)) {
uint32_t color = (transitional && _t) ? _t->_colorT[mcol] : colors[mcol];
if ((palette == 0 && mcol < NUM_COLORS) || !_isRGB) {
uint32_t color = currentColor(mcol, colors[mcol]);
color = gamma32(color);
if (pbri == 255) return color;
return RGBW32(scale8_video(R(color),pbri), scale8_video(G(color),pbri), scale8_video(B(color),pbri), scale8_video(W(color),pbri));
@@ -1835,7 +1836,7 @@ int16_t Bus::_cct = -1;
uint8_t Bus::_cctBlend = 0;
uint8_t Bus::_gAWM = 255;
const char JSON_mode_names[] PROGMEM = R"=====(["Mode names have moved"])=====";
const char JSON_mode_names[] PROGMEM = R"=====(["FX names moved"])=====";
const char JSON_palette_names[] PROGMEM = R"=====([
"Default","* Random Cycle","* Color 1","* Colors 1&2","* Color Gradient","* Colors Only","Party","Cloud","Lava","Ocean",
"Forest","Rainbow","Rainbow Bands","Sunset","Rivendell","Breeze","Red & Blue","Yellowout","Analogous","Splash",