Skip to content

number of Pulses of NEC repeat code ---should be 3 not 4 #53

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Alexislilei opened this issue Jul 31, 2022 · 1 comment · Fixed by #67
Closed

number of Pulses of NEC repeat code ---should be 3 not 4 #53

Alexislilei opened this issue Jul 31, 2022 · 1 comment · Fixed by #67

Comments

@Alexislilei
Copy link

Alexislilei commented Jul 31, 2022

I am a beginner to use python. My English is not good enough, Hope you can understand the issue.
lib from: adafruit-circuitpython-bundle-7.x-mpy-20220715
my board: raspberry pi pico
IR receiver: HW-490
IR input pin: GP27
Remote controller: Hisense TV remote
example: ir_noneblock.py
When running, it can't detect NEC repeat code. print out:

_----------------------------
Heard 68 Pulses: (8918, 4453, 439, 473, 392, 488, 436, 534, 454, 522, 408, 509, 486, 461, 503, 570, 488, 460, 503, 1665, 439, 1663, 460, 1689, 427, 1619, 450, 1614, 510, 1642, 410, 475, 495, 1685, 420, 487, 437, 1599, 437, 1691, 489, 461, 471, 1637, 468, 536, 517, 487, 478, 566, 485, 1619, 516, 451, 466, 531, 482, 1644, 500, 544, 456, 1633, 493, 1616, 488, 1729, 529, 38655)
Decoded: (255, 2, 151, 104)

Heard 4 Pulses: (8971, 2258, 500, 65535)
Failed to decode Too short

Heard 4 Pulses: (8869, 2200, 426, 65535)
Failed to decode Too short

-----------------------------_

the NEC repeat code should be three pluses: a 9ms leading pulse burst, a 2.25ms space, and a 562.5µs pulse burst to mark the end of the space (and hence the end of the transmitted repeat code).

But we heard 4 Pulses (8971, 2258, 500, 65535)

I tried to change the code :(in adafruit_irremote.py , from line 103)

# special exception for NEC repeat code!
if (
(len(pulses) == 3)
and (8000 <= pulses[0] <= 10000)
and (2000 <= pulses[1] <= 3000)
and (450 <= pulses[2] <= 700)
):
return NECRepeatIRMessage(input_pulses)

changed 3 to 4, as below:

# special exception for NEC repeat code!
if (
(len(pulses) == 4)
and (8000 <= pulses[0] <= 10000)
and (2000 <= pulses[1] <= 3000)
and (450 <= pulses[2] <= 700)
):
return NECRepeatIRMessage(input_pulses)

it worked:
_Heard 68 Pulses: (8840, 4430, 442, 506, 433, 525, 506, 546, 465, 530, 509, 483, 367, 591, 533, 478, 492, 467, 476, 1671, 454, 1634, 377, 1728, 400, 1594, 486, 1679, 475, 1646, 421, 511, 460, 1659, 463, 556, 507, 1669, 468, 1669, 463, 562, 422, 1675, 438, 476, 491, 461, 476, 545, 431, 1657, 458, 580, 530, 441, 459, 1739, 383, 520, 406, 1633, 429, 1682, 423, 1587, 449, 41612)
Decoded: (255, 2, 151, 104)

Heard 4 Pulses: (8966, 2210, 524, 65535)
NEC repeat!
_

So I think the Pluses should not have the last one (65535). Or maybe we should change len(pulses) == 3 to 4

@deshipu
Copy link

deshipu commented Mar 14, 2023

I have the same problem. I also noticed that when the receiver gets some random pulses from the ambient lighting, they look like (197, 65535) — it looks like the pulseio is adding that reading at the end?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants