Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 29 additions & 2 deletions lib/dmcomm/hardware/comms/modulated.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ def __init__(self, signal_type):
self.reply_timeout_ms = 40
self.packet_length_timeout_ms = 300
self.packet_continue_timeout_ms = 10
self.input_buffer_size = 300
elif signal_type == "FL":
self.low_bit_first = False
self.low_byte_first = False
Expand All @@ -46,8 +47,30 @@ def __init__(self, signal_type):
self.reply_timeout_ms = 100
self.packet_length_timeout_ms = 300
self.packet_continue_timeout_ms = 10
self.input_buffer_size = 300
elif signal_type == "!TC":
self.low_bit_first = False
self.low_byte_first = False
self.start_pulse_send = 9600
self.start_gap_send = 6000
self.start_min = 500 # Usual problem here?
self.start_max = 18000
self.bit_pulse_send = 680
self.bit_gap_send_short = 620
self.bit_gap_send_long = 1200
self.bit_min = 800
self.bit_threshold = 1600
self.bit_max = 2400
self.stop_pulse_min = 800
self.stop_pulse_send = 1240
self.stop_pulse_max = 1600
self.stop_gap_send = 1500
self.reply_timeout_ms = 200
self.packet_length_timeout_ms = 300
self.packet_continue_timeout_ms = 10
self.input_buffer_size = 1000
else:
raise ValueError("signal_type must be DL/FL")
raise ValueError("signal_type must be DL/FL/!TC")
self.signal_type = signal_type

class ModulatedCommunicator:
Expand All @@ -66,7 +89,11 @@ def enable(self, signal_type):
self._params = ModulatedParams(signal_type)
try:
self._output_pulses = pulseio.PulseOut(self._pin_output, frequency=38000, duty_cycle=0x8000)
self._input_pulses = pulseio.PulseIn(self._pin_input, maxlen=300, idle_state=True)
self._input_pulses = pulseio.PulseIn(
self._pin_input,
maxlen=self._params.input_buffer_size,
idle_state=True,
)
self._input_pulses.pause()
except:
self.disable()
Expand Down
2 changes: 1 addition & 1 deletion lib/dmcomm/hardware/control.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def _prepare(self):
raise CommandError("no raw infrared input registered")
from .comms import xloader
comm = xloader.XLoaderCommunicator(self._ir_output, self._ir_input_raw)
elif signal_type in ["DL", "FL"]:
elif signal_type in ["DL", "FL", "!TC"]:
if self._ir_output is None:
raise CommandError("no infrared output registered")
if self._ir_input_modulated is None:
Expand Down
2 changes: 1 addition & 1 deletion lib/dmcomm/protocol/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def parse_command(text):
DigiROM = digirom.ClassicDigiROM
elif op in ["C"]:
DigiROM = digirom.WordsDigiROM
elif op in ["DL", "FL", "LT", "MW", "!XL"]:
elif op in ["DL", "FL", "LT", "MW", "!XL", "!TC"]:
DigiROM = digirom.BytesDigiROM
elif op in ["BC"]:
DigiROM = digirom.DigitsDigiROM
Expand Down