Thanks to visit codestin.com
Credit goes to github.com

Skip to content

pulseio.PulseIn maxlen is limited to 128 in esp32 #9234

Closed
@tkomde

Description

@tkomde

CircuitPython version

Adafruit CircuitPython 9.1.0-beta.1-18-g781c577745-dirty on 2024-05-10; M5Stack AtomS3 with ESP32S3

Code/REPL

import board
import pulseio
import adafruit_irremote

pulsein = pulseio.PulseIn(board.D1, maxlen=1020, idle_state=True)
decoder = adafruit_irremote.GenericDecode()

while True:
    pulses = decoder.read_pulses(pulsein,max_pulse=91000)
    print(len(pulses))

Behavior

prints "128"

Description

It is possible that this is an intended specification, but I am reporting it.

I have a HITACHI air conditioner remote control data (848+6 data length) being read by pulseio.pulseIn. Regardless of the maxlen I gave it, it only read a maximum of 128 data.

I looked into the cause and found the following code in ports/espressif/common-hal/pulseio/PulseIn.c#103 .

self->raw_symbols_size = MIN(64, maxlen / 2 + 1) * sizeof(rmt_symbol_word_t);

When I delete the MIN(64, x) calculation as follows, the behavior differed depending on the CPU.
The ESP32S3(M5 AtomS3) and ESP32C6(M5 NanoC6) received all 854 data as desired, but the ESP32-PICO(M5 Matrix) still had 128 data. This seems to reproduce #7352.

self->raw_symbols_size = (maxlen / 2 + 1) * sizeof(rmt_symbol_word_t);

Is MIN(64, x) required by some constraint? If almost esp32 chips can receive more data, I would like to receive it.

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions