From 6b4a5bdaf33b9460d0e539c37647f33ca0b14f95 Mon Sep 17 00:00:00 2001 From: John Wyman Date: Sun, 14 Aug 2022 00:27:09 -0700 Subject: [PATCH 1/3] move round() call to baro == None else clause --- pyModeS/decoder/bds/bds62.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pyModeS/decoder/bds/bds62.py b/pyModeS/decoder/bds/bds62.py index 16db8f1..2d070d7 100644 --- a/pyModeS/decoder/bds/bds62.py +++ b/pyModeS/decoder/bds/bds62.py @@ -274,8 +274,7 @@ def baro_pressure_setting(msg): ) baro = common.bin2int(mb[20:29]) - baro = None if baro == 0 else 800 + (baro - 1) * 0.8 - baro = round(baro, 1) + baro = None if baro == 0 else round(800 + (baro - 1) * 0.8, 1) return baro From afd53af87b0a19f57c9b5d2491604a260b979863 Mon Sep 17 00:00:00 2001 From: John Wyman Date: Sun, 14 Aug 2022 00:34:17 -0700 Subject: [PATCH 2/3] Increase padding on _print to fit baro --- pyModeS/decoder/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyModeS/decoder/__init__.py b/pyModeS/decoder/__init__.py index aa4b901..2b80d1f 100644 --- a/pyModeS/decoder/__init__.py +++ b/pyModeS/decoder/__init__.py @@ -2,7 +2,7 @@ def tell(msg: str) -> None: from pyModeS import common, adsb, commb, bds def _print(label, value, unit=None): - print("%20s: " % label, end="") + print("%28s: " % label, end="") print("%s " % value, end="") if unit: print(unit) From 6a427c08b58a654c474f1e340ba01f6aad3401d5 Mon Sep 17 00:00:00 2001 From: John Wyman Date: Sun, 14 Aug 2022 00:45:13 -0700 Subject: [PATCH 3/3] Update display to remove units if baro == none --- pyModeS/decoder/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyModeS/decoder/__init__.py b/pyModeS/decoder/__init__.py index 2b80d1f..53ecf72 100644 --- a/pyModeS/decoder/__init__.py +++ b/pyModeS/decoder/__init__.py @@ -127,7 +127,7 @@ def tell(msg: str) -> None: lnav = adsb.lnav_mode(msg) _print("Selected altitude", alt, "feet") _print("Altitude source", alt_source) - _print("Barometric pressure setting", baro, "millibars") + _print("Barometric pressure setting", baro, "" if baro == None else "millibars") _print("Selected Heading", hdg, "°") if not (common.bin2int((common.hex2bin(msg)[32:])[46]) == 0): _print("Autopilot", types_29[autopilot] if autopilot else None)