Skip to content

Commit

Permalink
Fix control code / link magazine decoding
Browse files Browse the repository at this point in the history
  • Loading branch information
ali1234 committed Feb 13, 2019
1 parent 01dddfd commit f2e7c7c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions teletext/t42/elements.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ def from_bytes(cls, bytes):
errors += e
values.append(v)

subpage = (values[0] & 0x7f) | ((values[1] & 0x3f) <<8)
control = (values[0] >> 7) | (values[1] >> 5) | (values[2] << 3)
subpage = (values[0] & 0x7f) | ((values[1] & 0x3f) << 8)
control = (values[0] >> 7) | ((values[1] >> 5) & 0x6) | (values[2] << 3)
return cls(page, subpage, control, errors)

def to_bytes(self):
Expand Down Expand Up @@ -86,8 +86,8 @@ def from_bytes(cls, bytes, current_magazine):
errors += e
values.append(v)

subpage = (values[0] & 0x7f) | ((values[1] & 0x3f) <<8)
magazine = (values[0] >> 7) | ((values[1] >> 6)<<1)
subpage = (values[0] & 0x7f) | ((values[1] & 0x3f) << 8)
magazine = (values[0] >> 7) | ((values[1] >> 5) & 0x6)
return cls(magazine^current_magazine, page, subpage, errors)

def __str__(self):
Expand Down

0 comments on commit f2e7c7c

Please sign in to comment.