Skip to content

Commit

Permalink
Merge pull request #198 from kmarwah/bch_plugin_fix
Browse files Browse the repository at this point in the history
Fix bug in BCHPlugin
  • Loading branch information
nttoole committed Aug 23, 2022
2 parents 56dbb13 + e1fb147 commit 654bc55
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions ait/dsn/bch/bch_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,11 @@ def process(self, input_data, topic=None):

# handle case where number of bytes is not evenly divisible by 7
# CCSDS standard states add alternating 0/1 fill bits starting with 0
number_of_filler_bytes = 7 - remainder_bytes
filler_bytes = bytearray(b"\x55")*number_of_filler_bytes
last_chunk = input_data[-remainder_bytes:] + filler_bytes
last_chunk_with_bch = BCH.generateBCH(last_chunk)
output_bytes = output_bytes + last_chunk_with_bch
if remainder_bytes != 0:
number_of_filler_bytes = 7 - remainder_bytes
filler_bytes = bytearray(b"\x55")*number_of_filler_bytes
last_chunk = input_data[-remainder_bytes:] + filler_bytes
last_chunk_with_bch = BCH.generateBCH(last_chunk)
output_bytes = output_bytes + last_chunk_with_bch

self.publish(output_bytes)

0 comments on commit 654bc55

Please sign in to comment.