some changes
This commit is contained in:
@@ -8,8 +8,8 @@ import secrets
|
||||
import string
|
||||
import libtimer
|
||||
import time
|
||||
from tef import TEF6686
|
||||
from protocol import I2CPCClient
|
||||
from driver.tef import TEF6686
|
||||
from driver.protocol import I2CPCClient
|
||||
import os
|
||||
from functools import wraps
|
||||
from typing import Callable
|
||||
@@ -193,22 +193,20 @@ def send_rds_data(tef: TEF6686, conn: socket.socket, state: dict):
|
||||
status, A, B, C, D, dec_error = res
|
||||
dec_error >>= 8
|
||||
|
||||
if (status & (1 << 9) == 0) or (status & (1 << 15) == 0): return
|
||||
if (status & (1 << 9) == 0) or (status & (1 << 15) == 0) or (status & (1 << 13) == (1 << 13)): return
|
||||
|
||||
data = b""
|
||||
a_error = dec_error >> 6
|
||||
c_error = (dec_error >> 2) & 0b11
|
||||
if (status & (1 << 13) == 0):
|
||||
if (status & (1 << 12) == 0):
|
||||
# Type A, PI in A
|
||||
data = f"R{A:04X}{B:04X}{C:04X}".encode()
|
||||
elif (status >> 12) & 1:
|
||||
# Type B, PI in A and C
|
||||
pi = A
|
||||
if c_error < a_error: pi = C
|
||||
data = f"R{pi:04X}{B:04X}{pi:04X}".encode()
|
||||
data += f"{D:04X}{dec_error:02X}\n".encode()
|
||||
else: data = f"P{A:04X}{"?" * a_error}\n".encode() # No group data, only PI
|
||||
if (status & (1 << 12) == 0):
|
||||
# Type A, PI in A
|
||||
data = f"R{A:04X}{B:04X}{C:04X}".encode()
|
||||
elif (status >> 12) & 1:
|
||||
# Type B, PI in A and C
|
||||
pi = A
|
||||
if c_error < a_error: pi = C
|
||||
data = f"R{pi:04X}{B:04X}{pi:04X}".encode()
|
||||
data += f"{D:04X}{dec_error:02X}\n".encode()
|
||||
|
||||
if not data.strip(): return
|
||||
conn.sendall(data)
|
||||
|
||||
Reference in New Issue
Block a user