1
0

fix some things

This commit is contained in:
2026-02-21 14:24:52 +01:00
parent d8228f49ea
commit 426cfad689
2 changed files with 15 additions and 20 deletions

View File

@@ -2,8 +2,7 @@ import struct
from protocol import I2CPCClient, time
from patches import *
from typing import Callable, TypeVar, ParamSpec, Concatenate
from collections.abc import Callable as ABCCallable
from typing import TypeVar, ParamSpec
P = ParamSpec("P")
T = TypeVar("T")

32
tef.py
View File

@@ -1,6 +1,6 @@
from __future__ import annotations
from base_tef import BaseTEF668X, Concatenate, Callable, ParamSpec
from typing import overload, TypeVar
from base_tef import BaseTEF668X
from typing import overload, ParamSpec, TypeVar, Concatenate, Callable
from functools import wraps
import struct
@@ -39,16 +39,15 @@ class TEF6686(BaseTEF668X):
@_command_wrapper
@overload
def FM_Set_Bandwidth(self, mode: bool = True, bandwidth: int = 2360, control_sensitivity: int = 1000, low_level_sensitivity: int = 1000):
return b"\x20\x0a\x01" + pack(mode, bandwidth, control_sensitivity, low_level_sensitivity), None, None
@_command_wrapper
@overload
def FM_Set_Bandwidth(self, mode: bool = True, bandwidth: int = 2360, control_sensitivity: int = 1000, low_level_sensitivity: int = 1000, min_bandwidth: int = 560, nominal_bandwidth: int = 2360, control_attack: int = 300):
"""
Minimal bandwidth requires p2.13, while nominal_bandwidth and control_attack require p2.17 (we have p2.24)
"""
return b"\x20\x0a\x01" + pack(mode, bandwidth, control_sensitivity, low_level_sensitivity, min_bandwidth, nominal_bandwidth, control_attack), None, None
@_command_wrapper
def FM_Set_Bandwidth(self, mode: bool = True, bandwidth: int = 2360, control_sensitivity: int = 1000, low_level_sensitivity: int = 1000):
return b"\x20\x0a\x01" + pack(mode, bandwidth, control_sensitivity, low_level_sensitivity), None, None
@_command_wrapper
def AM_Set_Bandwidth(self, bandwidth: int = 40):
return b"\x21\x0a\x01\x00\x00" + pack(bandwidth), None, None
@@ -77,12 +76,11 @@ class TEF6686(BaseTEF668X):
@_command_wrapper
@overload
def FM_Set_NoiseBlanker(self, mode: bool = True, sensitivity: int = 1000):
return b"\x20\x17\x01" + pack(mode, sensitivity), None, None
@_command_wrapper
@overload
def FM_Set_NoiseBlanker(self, mode: bool = True, sensitivity: int = 1000, modulation: int = 900, offset: int = 1, attack: int = 140, decay: int = 2800):
return b"\x20\x17\x01" + pack(mode, sensitivity, 0, modulation, offset, attack, decay), None, None
@_command_wrapper
def FM_Set_NoiseBlanker(self, mode: bool = True, sensitivity: int = 1000):
return b"\x20\x17\x01" + pack(mode, sensitivity), None, None
@_command_wrapper
def FM_Set_NoiseBlanker_Options(self, blank_time: int = 210, blank_time2: int = 210, blank_modulation: int = 250):
@@ -90,21 +88,19 @@ class TEF6686(BaseTEF668X):
@_command_wrapper
@overload
def AM_Set_NoiseBlanker(self, mode: bool = True, sensitivity: int = 1000):
return b"\x21\x17\x01" + pack(mode, sensitivity), None, None
@_command_wrapper
@overload
def AM_Set_NoiseBlanker(self, mode: bool = True, sensitivity: int = 1000, gain: int = 1000, blank_time: int = 56):
return b"\x21\x17\x01" + pack(mode, sensitivity, gain, blank_time), None, None
@_command_wrapper
@overload
def AM_Set_NoiseBlanker_Audio(self, mode: bool = True, sensitivity: int = 1000):
return b"\x21\x18\x01" + pack(mode, sensitivity), None, None
def AM_Set_NoiseBlanker(self, mode: bool = True, sensitivity: int = 1000):
return b"\x21\x17\x01" + pack(mode, sensitivity), None, None
@_command_wrapper
@overload
def AM_Set_NoiseBlanker_Audio(self, mode: bool = True, sensitivity: int = 1000, blank_time: int = 800):
return b"\x21\x18\x01" + pack(mode, sensitivity, 0, blank_time), None, None
@_command_wrapper
def AM_Set_NoiseBlanker_Audio(self, mode: bool = True, sensitivity: int = 1000):
return b"\x21\x18\x01" + pack(mode, sensitivity), None, None
@_command_wrapper
def FM_Set_Deemphasis(self, timeconstant: int = 500):