segment & bus.show mutex redesign
* separate mutexes for improved performance: - busses.show and effect drawing - critical changes to segment vector - block out critical segment changes while strip.service() loops over segments * UDP realtime acquires mutex before drawing - prevents corrupted outputs, caused by parallel tasks updating pixels while busses.show() runs
This commit is contained in:
@@ -94,7 +94,11 @@ bool deserializeSegment(JsonObject elem, byte it, byte presetId)
|
||||
// if using vectors use this code to append segment
|
||||
if (id >= strip.getSegmentsNum()) {
|
||||
if (stop <= 0) return false; // ignore empty/inactive segments
|
||||
strip.appendSegment(Segment(0, strip.getLengthTotal()));
|
||||
if (esp32SemTake(segmentMux, portMAX_DELAY) == pdTRUE) {
|
||||
// WLEDMM make sure we have exclusive access to the segment list
|
||||
strip.appendSegment(Segment(0, strip.getLengthTotal()));
|
||||
esp32SemGive(segmentMux);
|
||||
}
|
||||
id = strip.getSegmentsNum()-1; // segments are added at the end of list
|
||||
newSeg = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user