Skip to content

Commit 9a8886b

Browse files
authored
Fix index offset when using setPattern()
1 parent bd70145 commit 9a8886b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/StrokeEngine.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ float StrokeEngine::getSensation() {
197197

198198
bool StrokeEngine::setPattern(int patternIndex, bool applyNow = false) {
199199
// Check wether pattern Index is in range
200-
if ((patternIndex < patternTableSize) && (patternIndex >= 0)) {
200+
if ((patternIndex < patternTableSize) && (patternIndex >= 0) && (patternIndex != _patternIndex)) {
201201
_patternIndex = patternIndex;
202202

203203
// Inject current motion parameters into new pattern
@@ -219,7 +219,7 @@ bool StrokeEngine::setPattern(int patternIndex, bool applyNow = false) {
219219
}
220220

221221
// Reset index counter
222-
_index = 0;
222+
_index = -1;
223223

224224
// give back mutex
225225
xSemaphoreGive(_patternMutex);

0 commit comments

Comments
 (0)