Skip to content

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

Closed
@Alexislilei

Description

@Alexislilei

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions