Skip to content

Commit

Permalink
Merge pull request letscontrolit#4832 from chromoxdor/rtttl_the_final…
Browse files Browse the repository at this point in the history
…_fix

[RTTTL] the final fix for rtttl parsing :)
  • Loading branch information
TD-er authored Sep 28, 2023
2 parents d125cd3 + 94e1d91 commit bcc555e
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/src/Commands/GPIO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -388,15 +388,9 @@ const __FlashStringHelper * Command_GPIO_RTTTL(struct EventStruct *event, const
// First assume 'new' syntax: rtttl,<gpio>,<rtttl string>
// Difference between 'old' and 'new':
// Comma between the GPIO argument and the melody
String melody = parseStringToEndKeepCase(Line, 3);

// The semicolon may appear several times in a RTTTL melody
// Thus only check if it is part of the 1st argument.
if (parseString(Line, 2).indexOf(':') != -1) {
// Apparently this is still using the 'old' (incorrect) syntax:
// rtttl,<gpio><rtttl string>
melody = parseStringToEndKeepCase(Line, 2);
}
String melody = parseStringToEndKeepCase(Line, 2);
melody = melody.substring(melody.indexOf(':'), melody.length());

melody.replace('-', '#');
melody.replace('_', '#');

Expand Down

0 comments on commit bcc555e

Please sign in to comment.