Accept all line ending styles for USB load #306
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do?
previously, only *nix style line endings (LF) were accepted. i've updated deserialization code to accept DOS (CRLF) and Mac (CR) line ending styles as well. i also used it as an opportunity to make the deserialization code more robust.
as a consequence of this update, now it will also ignore any lines that start with
#
and are not followed by M, I, P, G or 1-8, which means script files can be annotated with comments. it also effectively fixes #104.while working on this, i realized that we use magic numbers for script numbers in multiple places, which makes it more difficult to create firmware mods for increased script count, so i've addressed that as well (i'm also considering revisiting the idea of shadow scripts..)
finally, as there was no need for a dedicated enum for script number, i've changed it to uint8_t and this surfaced an issue in our tests where the script number wasn't set properly, and a couple of places in the main code where we weren't doing boundary checks, so i fixed that as well.
How should this be manually tested?
save/load scenes to USB using different line endings.
If the related Github issues aren't referenced in your commits, please link to them here.
#104
I have,
CHANGELOG.md
andwhats_new.md
help_mode.c
(if applicable)make format
on each commit