Browse Source

Fix xap cli bcd output

zvecr 3 years ago
parent
commit
3c0280b668
2 changed files with 7 additions and 2 deletions
  1. 1 1
      lib/chibios-contrib
  2. 6 1
      lib/python/xap_client/device.py

+ 1 - 1
lib/chibios-contrib

@@ -1 +1 @@
-Subproject commit da78eb3759b8d1779b237657c7667baa4aa95ca1
+Subproject commit a224be155ae18d38deccf33a6c1d259b9a5ad8d3

+ 6 - 1
lib/python/xap_client/device.py

@@ -17,7 +17,12 @@ from .routes import XAPRoutes, XAPRouteError
 def _u32_to_bcd(val: bytes) -> str:  # noqa: N802
     """Create BCD string
     """
-    return f'{val>>24}.{val>>16 & 0xFF}.{val & 0xFFFF}'
+    tmp = "{:08x}".format(val)
+    major = int(tmp[0:2])
+    minor = int(tmp[2:4])
+    patch = int(tmp[4:8])
+
+    return f'{major}.{minor}.{patch}'
 
 
 def _gen_token() -> bytes: