'Remove Carrier' encoding truncates initial input #997
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.
Hi,
I had an issue while trying to fuzz a remote control switch, despite successful decoding.
The issue
Basically, the raw signal gets perfectly decoded by a 'Remove Carrier' function with a
0_0_0_0_0_0_0_0_0_0_0_0_0
pattern. (12 data symbols interleaved with 0s)However, the inverse function truncates the very first
0_
pair, whatever the value of the input data.This happens if the very first character does not represent input data, as the code does not enter the
if
statement.This makes the
for
loop skip the first input sequence altogether.The proposed fix
I managed to solve this problem by inverting the two actions within the
for
loop (i.e. consume the carrier first).Once all the input is consumed, the remaining carrier pattern is appended until it wraps around.
I hope you'll find this useful too!
Commit 8fbab14
Addresses truncation by consuming any leading carrier symbol before the
for
loop.Commit 523a1d9
Addresses an issue with 8fbab14 where extra carrier symbols get included, due to the pattern wrapping around after all input data has been consumed.