diff --git a/xrd.py b/xrd.py index 7c09b7e..c857043 100644 --- a/xrd.py +++ b/xrd.py @@ -131,11 +131,11 @@ def process_command(tef: AutoFMAM, data: bytes, state: State, conn: socket.socke tef.set_modulation(freq) match tef.modulation: case Modulation.FM: - tef.Tune_To(mode, freq // 10) - state.last_tune_fm = freq // 10 + tef.FM_Tune_To(mode, freq // 10) + state.last_tune_fm = tef.last_tune = freq // 10 case Modulation.AM: - tef.Tune_To(TEF6686.TuneTo_Mode.Preset, freq) - state.last_tune_am = freq + tef.AM_Tune_To(TEF6686.TuneTo_Mode.Preset, freq) + state.last_tune_am = tef.last_tune = freq out += f"T{freq}\nM{tef.modulation}\n".encode() elif cmd.startswith(b"G"): eqims = int(cmd.decode().removeprefix("G").strip(), 2) @@ -159,15 +159,7 @@ 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() - 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() + out += f"W{bw}\n".encode() elif cmd.startswith(b"?"): out += b">XRD Python driver\n" elif cmd.startswith(b"S"): cmd = cmd[1:]