Skip to content

Commit ec3985a

Browse files
committed
Prior to merge.
1 parent e14e621 commit ec3985a

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

tx/__init__.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def __init__(self, pin, fname, reps=5):
4747
self._tim = Timer(5) # Timer 5 controls carrier on/off times
4848
self._tcb = self._cb # Pre-allocate
4949
asize = reps * max([len(x) for x in self._data.values()]) + 1 # Array size
50-
self._arr = array('H', 0 for _ in range(asize)) # on/off times (μs)
50+
self._arr = array('H', (0 for _ in range(asize))) # on/off times (μs)
5151
self._aptr = 0 # Index into array
5252

5353
def _cb(self, t): # T5 callback, generate a carrier mark or space
@@ -80,13 +80,14 @@ def __call__(self, key):
8080
gc.collect()
8181
lst = self[key]
8282
if lst is not None:
83-
lst = lst * self._reps
8483
if ESP32:
85-
self._rmt.write_pulses(lst, start = 1) # Active high
84+
self._rmt.write_pulses(lst * self._reps, start = 1) # Active high
8685
else:
87-
for x, t in enumerate(lst):
88-
self._arr[x] = t
89-
x += 1
86+
x = 0
87+
for _ in range(self._reps):
88+
for t in lst:
89+
self._arr[x] = t
90+
x += 1
9091
self._arr[x] = STOP
9192
self._aptr = 0 # Reset pointer
9293
self._cb(self._tim) # Initiate physical transmission.

0 commit comments

Comments
 (0)