From e0a71de244af24b62b4243536b713873346bfe45 Mon Sep 17 00:00:00 2001 From: Rossen Georgiev Date: Sun, 11 Jan 2015 17:18:24 +0000 Subject: [PATCH] rotated base91 telemetry bits in output; v0.6.35 The least significant bit is now at the begining. This makes accessing the char array more intuative as the first bit will be first in the array (e.g. bits[0] instead of bits[7]) --- aprslib/__init__.py | 2 +- aprslib/parse.py | 2 +- tests/test_parse_comment_telemetry.py | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/aprslib/__init__.py b/aprslib/__init__.py index a8d1db3..781c80a 100644 --- a/aprslib/__init__.py +++ b/aprslib/__init__.py @@ -37,7 +37,7 @@ from datetime import date as _date __date__ = str(_date.today()) del _date -__version__ = "0.6.34" +__version__ = "0.6.35" __author__ = "Rossen Georgiev" __all__ = ['IS', 'parse', 'passcode'] diff --git a/aprslib/parse.py b/aprslib/parse.py index 44bb31f..43a5bf4 100644 --- a/aprslib/parse.py +++ b/aprslib/parse.py @@ -413,7 +413,7 @@ def _parse_comment_telemetry(text): if temp[6] != '': parsed['telemetry'].update({ - 'bits': "{0:08b}".format(temp[6] & 0xFF) + 'bits': "{0:08b}".format(temp[6] & 0xFF)[::-1] }) return (text, parsed) diff --git a/tests/test_parse_comment_telemetry.py b/tests/test_parse_comment_telemetry.py index 3665c16..d0c8f4b 100644 --- a/tests/test_parse_comment_telemetry.py +++ b/tests/test_parse_comment_telemetry.py @@ -34,7 +34,7 @@ class ParseCommentTelemetry(unittest.TestCase): # bits as str(11111111) if 'bits' in telem: - val = int(telem['bits'], 2) + val = int(telem['bits'][::-1], 2) text.append(base91.from_decimal(val, 2)) text.append("|") @@ -48,7 +48,7 @@ class ParseCommentTelemetry(unittest.TestCase): bits = None if len(vals) is 5 and randint(1, 10) > 5: - bits = "{:08b}".format(randint(0, 255)) + bits = "{:08b}".format(randint(0, 255))[::-1] testData = self.genTelem(i, vals, bits)