Skip to content

Commit

Permalink
Post merge changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ewoudwijma committed Jul 4, 2023
1 parent 5a2db8e commit ab50aae
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -492,8 +492,6 @@ void RotaryEncoderUIUsermod::loop()
{
if (!enabled) return;
unsigned long currentTime = millis(); // get the current elapsed time
if (strip.isUpdating() && ((currentTime - loopTime) < ENCODER_MAX_DELAY_MS)) return; // be nice, but not too nice

if (strip.isUpdating() && (currentTime - loopTime < 4)) return; // WLEDMM: be nice, but not too nice

// Initialize effectCurrentIndex and effectPaletteIndex to
Expand Down
2 changes: 1 addition & 1 deletion wled00/FX.h
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ typedef struct Segment {
strip_wait_until_idle("~Segment()");
#endif

if (!Segment::_globalLeds && leds) { free(leds); leds = nullptr;} // reset to nullptr, to avoid race conditions
if (!Segment::_globalLeds && ledsrgb) { free(ledsrgb); ledsrgb = nullptr;} // reset to nullptr, to avoid race conditions
if (name) delete[] name;
if (_t) delete _t;
deallocateData();
Expand Down
9 changes: 3 additions & 6 deletions wled00/FX_fcn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,8 @@ Segment::Segment(const Segment &orig) {
if (orig.name) { name = new char[strlen(orig.name)+1]; if (name) strcpy(name, orig.name); }
if (orig.data) { if (allocateData(orig._dataLen)) memcpy(data, orig.data, orig._dataLen); }
if (orig._t) { _t = new Transition(orig._t->_dur, orig._t->_briT, orig._t->_cctT, orig._t->_colorT); }
if (orig.ledsrgb && !Segment::_globalLeds) { allocLeds(); if (ledsrgb) memcpy(ledsrgb, orig.ledsrgb, sizeof(CRGB)*length()); }
if (orig.ledsrgb && !Segment::_globalLeds && length() > 0) { allocLeds(); if (ledsrgb) memcpy(ledsrgb, orig.ledsrgb, sizeof(CRGB)*length()); }
jMap = nullptr; //WLEDMM jMap
if (orig.leds && !Segment::_globalLeds && length() > 0) { leds = (CRGB*)malloc(sizeof(CRGB)*length()); if (leds) memcpy(leds, orig.leds, sizeof(CRGB)*length()); }
}

//WLEDMM: recreate ledsrgb if more space needed (will not free ledsrgb!)
Expand All @@ -126,12 +125,11 @@ void Segment::allocLeds() {
Segment::Segment(Segment &&orig) noexcept {
USER_PRINTLN(F("-- Move segment constructor --"));
memcpy((void*)this, (void*)&orig, sizeof(Segment));
orig.leds = nullptr;
orig.ledsrgb = nullptr; //WLEDMM: do not free as moved to here (constructor so there where no leds)
orig.name = nullptr;
orig.data = nullptr;
orig._dataLen = 0;
orig._t = nullptr;
orig.ledsrgb = nullptr; //WLEDMM: do not free as moved to here (constructor so there where no leds)
orig.jMap = nullptr; //WLEDMM jMap
}

Expand Down Expand Up @@ -159,9 +157,8 @@ Segment& Segment::operator= (const Segment &orig) {
if (orig.name) { name = new char[strlen(orig.name)+1]; if (name) strcpy(name, orig.name); }
if (orig.data) { if (allocateData(orig._dataLen)) memcpy(data, orig.data, orig._dataLen); }
if (orig._t) { _t = new Transition(orig._t->_dur, orig._t->_briT, orig._t->_cctT, orig._t->_colorT); }
if (orig.ledsrgb && !Segment::_globalLeds) { allocLeds(); if (ledsrgb) memcpy(ledsrgb, orig.ledsrgb, sizeof(CRGB)*length()); }
if (orig.ledsrgb && !Segment::_globalLeds && length() > 0) { allocLeds(); if (ledsrgb) memcpy(ledsrgb, orig.ledsrgb, sizeof(CRGB)*length()); }
jMap = nullptr; //WLEDMM jMap
if (orig.leds && !Segment::_globalLeds && length() > 0) { leds = (CRGB*)malloc(sizeof(CRGB)*length()); if (leds) memcpy(leds, orig.leds, sizeof(CRGB)*length()); }
}
return *this;
}
Expand Down

0 comments on commit ab50aae

Please sign in to comment.