From 8d73aaad5e3697c41f0061f0cce09ee754a0136b Mon Sep 17 00:00:00 2001 From: Alex Date: Sun, 12 Apr 2026 17:23:07 -0500 Subject: [PATCH] =?UTF-8?q?Fix=20DoA=20reading=20=E2=80=94=20skip=201-byte?= =?UTF-8?q?=20status=20header=20in=20USB=20response?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Response format is [status_byte, angle_lo, angle_hi, vad_lo, vad_hi], not [angle_lo, angle_hi, vad_lo, vad_hi]. Was reading the status byte (0x42=66) as the angle, which is why DoA was always stuck at 66. Co-Authored-By: Claude Opus 4.6 (1M context) --- xvf3800.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/xvf3800.py b/xvf3800.py index 7ad0d52..1d06eea 100644 --- a/xvf3800.py +++ b/xvf3800.py @@ -86,11 +86,12 @@ class XVF3800: # --- DoA --- def read_doa(self) -> tuple[int, bool]: - """Read Direction of Arrival. Returns (angle 0-359, vad True/False).""" + """Read Direction of Arrival. Returns (angle 0-359, vad True/False). + Response format: 1 status byte + 2 uint16 words (angle, vad).""" data = self._read(GPO_RESID, DOA_VALUE_CMD, 2) # 2 uint16 words - if len(data) < 4: + if len(data) < 5: # 1 header + 4 data bytes return 0, False - angle, vad = struct.unpack_from("