This commit is contained in:
2026-03-21 20:30:33 +01:00
parent 6f7bd2dd2c
commit 3d8239617d
-5
View File
@@ -136,22 +136,18 @@ def process_command(tef: AutoFMAM, data: bytes, state: State, conn: socket.socke
case Modulation.AM:
tef.Tune_To(TEF6686.TuneTo_Mode.Preset, freq)
state.last_tune_am = freq
out += f"T{freq}\nM{tef.modulation}\n".encode()
elif cmd.startswith(b"G"):
eqims = int(cmd.decode().removeprefix("G").strip(), 2)
tef.FM_Set_ChannelEqualizer((eqims & 1) == 1)
tef.FM_Set_MphSuppression((eqims & 2) == 2)
out += f"G{bin(eqims).removeprefix('0b').zfill(2)}\n".encode()
state.last_eqims = eqims
elif cmd.startswith(b"B"):
state.forced_mono = bool(int(cmd.decode().removeprefix("B").strip(), 2))
tef.FM_Set_Stereo_Min(2 if state.forced_mono else 0)
out += f"B{int(state.forced_mono)}\n".encode()
elif cmd.startswith(b"D"):
state.deemp = int(cmd.decode().removeprefix("D").strip())
dtime = 500 if state.deemp == 0 else (750 if state.deemp == 1 else 0)
tef.FM_Set_Deemphasis(dtime)
out += f"D{state.deemp}\n".encode()
elif cmd.startswith(b"x"): tef.Tune_To(TEF6686.TuneTo_Mode.Preset, tef.last_tune)
elif cmd.startswith(b"X"): tef.APPL_Set_OperationMode(True) # turn off
elif cmd.startswith(b"W"):
@@ -159,7 +155,6 @@ 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)
out += f"W{bw}\n".encode()
elif cmd.startswith(b"?"): out += b">XRD Python driver\n"
elif cmd.startswith(b"S"):
cmd = cmd[1:]