Skip to content

Commit 8c6f826

Browse files
committed
only consider line break when not reading command
1 parent 263837d commit 8c6f826

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

src/Command.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ bool Command::isValid() {
2121
this->values[INDEX_END_MARKER] == END_MARKER;
2222
}
2323

24+
bool Command::isReading() {
25+
return this->index > 0 && this->index < LENGTH;
26+
}
27+
2428
byte Command::getServoID() {
2529
return this->values[INDEX_SERVO_ID];
2630
}

src/Command.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ class Command {
1414

1515
bool isValid();
1616

17+
bool isReading();
18+
1719
byte getServoID();
1820

1921
int getServoPosition();

src/ServoManager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ void ServoManager::parseData(AnimationData *data, bool considerLineBreaks) {
4242
while (data->isAvailable()) {
4343
byte value = data->getNextByte();
4444

45-
if (considerLineBreaks && value == Command::LINE_BREAK) {
45+
if (considerLineBreaks && value == Command::LINE_BREAK && !this->command.isReading()) {
4646
break;
4747
}
4848

0 commit comments

Comments
 (0)