diff --git a/xrd.py b/xrd.py index 22f8964..5aa8cf3 100644 --- a/xrd.py +++ b/xrd.py @@ -159,7 +159,15 @@ def process_command(tef: AutoFMAM, data: bytes, state: State, conn: socket.socke if tef.modulation == Modulation.FM: state.bw_fm = bw else: state.bw_am = bw tef.Set_Bandwidth(bw) - if tef.modulation == Modulation.FM: out += f"W{bw}\n".encode() # Enhanced tuning is full of terrible + if tef.modulation == Modulation.FM: out += f"W{bw}\n".encode() + else: + out_bw = bw + match out_bw: + case 3000: out_bw = 56000 + case 4000: out_bw = 64000 + case 6000: out_bw = 72000 + case 8000: out_bw = 84000 + out += f"W{out_bw}\n".encode() elif cmd.startswith(b"?"): out += b">XRD Python driver\n" elif cmd.startswith(b"S"): cmd = cmd[1:] @@ -225,6 +233,12 @@ def send_signal_status(tef: AutoFMAM, conn: socket.socket, state: State): status, level, usn, wam, _, bandwidth, *_ = res + match bandwidth: + case 3000: bandwidth = 56000 + case 4000: bandwidth = 64000 + case 6000: bandwidth = 72000 + case 8000: bandwidth = 84000 + ms_since_tune = (status & 0x3ff) / 10 if ms_since_tune < 36: return # Give only "quality data"