1
0

unmute if needed

This commit is contained in:
2026-02-21 22:12:45 +01:00
parent e0d82c5995
commit e138dcbc62

3
xrd.py
View File

@@ -64,6 +64,7 @@ def process_command(tef: TEF6686, data: bytes, state: dict, conn: socket.socket)
state['last_tune'] = freq
tef.FM_Tune_To(1, freq)
if FREQ_NOT_ALLOWED_RANGE and freq >= FREQ_NOT_ALLOWED_RANGE[0] and freq <= FREQ_NOT_ALLOWED_RANGE[1]: tef.AUDIO_Set_Mute(True)
else: tef.AUDIO_Set_Mute(False)
out += f"T{freq*10}\n".encode()
elif cmd.startswith(b"G"):
eqims = int(cmd.decode().removeprefix("G").strip(), 2)
@@ -87,6 +88,7 @@ def process_command(tef: TEF6686, data: bytes, state: dict, conn: socket.socket)
tef.APPL_Set_OperationMode(False)
tef.FM_Tune_To(1, state["last_tune"])
if FREQ_NOT_ALLOWED_RANGE and state["last_tune"] >= FREQ_NOT_ALLOWED_RANGE[0] and state["last_tune"] <= FREQ_NOT_ALLOWED_RANGE[1]: tef.AUDIO_Set_Mute(True)
else: tef.AUDIO_Set_Mute(False)
elif cmd.startswith(b"X"):
tef.APPL_Set_OperationMode(True)
elif cmd.startswith(b"W"):
@@ -122,6 +124,7 @@ def process_command(tef: TEF6686, data: bytes, state: dict, conn: socket.socket)
tef.FM_Tune_To(1, state["last_tune"])
if FREQ_NOT_ALLOWED_RANGE and freq >= FREQ_NOT_ALLOWED_RANGE[0] and freq <= FREQ_NOT_ALLOWED_RANGE[1]: tef.AUDIO_Set_Mute(True)
else: tef.AUDIO_Set_Mute(False)
tef.FM_Set_Bandwidth((state["bw"] == 0), 2360 if (state["bw"] == 0) else (state["bw"] // 100))
return out