some stuff
This commit is contained in:
@@ -0,0 +1,17 @@
|
|||||||
|
from driver import protocol, tef
|
||||||
|
import os, time
|
||||||
|
|
||||||
|
DEVICE = os.getenv("DEV") or "COM6"
|
||||||
|
CLOCK_ENV = os.getenv("CLK", "").strip().lower() or "dp"
|
||||||
|
if CLOCK_ENV == "dp": CLOCK = 12000000 # DP-666
|
||||||
|
elif CLOCK_ENV == "x": CLOCK = 9216000
|
||||||
|
else: CLOCK = int(CLOCK_ENV)
|
||||||
|
|
||||||
|
p = protocol.I2CPCClient(DEVICE)
|
||||||
|
|
||||||
|
with tef.TEF6686(p) as tf:
|
||||||
|
tf.init(clock=CLOCK)
|
||||||
|
tf.AUDIO_Set_WaveGen(5, 0, 0, 400)
|
||||||
|
tf.AUDIO_Set_Input(240)
|
||||||
|
tf.AUDIO_Set_Mute(False)
|
||||||
|
while True: time.sleep(0.1)
|
||||||
@@ -25,10 +25,14 @@ DEVICE = os.getenv("DEV") or "COM6"
|
|||||||
FREQ_NOT_ALLOWED_RANGE = []
|
FREQ_NOT_ALLOWED_RANGE = []
|
||||||
|
|
||||||
PASSWORD = os.getenv("PW") or "test"
|
PASSWORD = os.getenv("PW") or "test"
|
||||||
CLOCK = 12000000 # DP-666
|
|
||||||
|
CLOCK_ENV = os.getenv("CLK", "").strip().lower() or "dp"
|
||||||
|
if CLOCK_ENV == "dp": CLOCK = 12000000 # DP-666
|
||||||
|
elif CLOCK_ENV == "x": CLOCK = 9216000
|
||||||
|
else: CLOCK = int(CLOCK_ENV)
|
||||||
|
|
||||||
SALT_LENGTH = 16
|
SALT_LENGTH = 16
|
||||||
SS_UPDATE_INTERVAL = 0.115
|
SS_UPDATE_INTERVAL = 0.095
|
||||||
RDS_UPDATE_INTERVAL = 0.086
|
RDS_UPDATE_INTERVAL = 0.086
|
||||||
|
|
||||||
def freq_allowed(freq: int):
|
def freq_allowed(freq: int):
|
||||||
@@ -59,7 +63,7 @@ def authenticate(conn: socket.socket):
|
|||||||
|
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
data = conn.recv(1024)
|
data = conn.recv(len(expected_hash))
|
||||||
if not data: return False
|
if not data: return False
|
||||||
if data.strip() == expected_hash.strip(): return True
|
if data.strip() == expected_hash.strip(): return True
|
||||||
except BlockingIOError:
|
except BlockingIOError:
|
||||||
@@ -280,4 +284,6 @@ def run_server():
|
|||||||
run_periodic(tef, conn, state)
|
run_periodic(tef, conn, state)
|
||||||
time.sleep(0.025)
|
time.sleep(0.025)
|
||||||
|
|
||||||
if __name__ == "__main__": run_server()
|
if __name__ == "__main__":
|
||||||
|
try: run_server()
|
||||||
|
except Exception: pass
|
||||||
Reference in New Issue
Block a user