Skip to content

Commit f1ee184

Browse files
authored
Update StrokeEngine.cpp
Fixed race condition
1 parent 9cb6804 commit f1ee184

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/StrokeEngine.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,13 +218,13 @@ bool StrokeEngine::setPattern(int patternIndex, bool applyNow = false) {
218218
#endif
219219
}
220220

221+
// Reset index counter
222+
_index = 0;
223+
221224
// give back mutex
222225
xSemaphoreGive(_patternMutex);
223226
}
224227

225-
// Reset index counter
226-
_index = 0;
227-
228228
#ifdef DEBUG_TALKATIVE
229229
Serial.println("setPattern: [" + String(_patternIndex) + "] " + patternTable[_patternIndex]->getName());
230230
Serial.println("setTimeOfStroke: " + String(_timeOfStroke, 2));

0 commit comments

Comments
 (0)