Skip to content

Off-by-one Error In RMT Example #2921

Closed
@tedhenry100

Description

@tedhenry100

In https://github.com/espressif/arduino-esp32/blob/master/libraries/ESP32/examples/RMT/RMTWriteNeoPixel/RMTWriteNeoPixel.ino lines 64 and 65 there is an off by one error.

The shift is too much. for the first iteration of the loop 1<<(8-0) is 100000000 which is not the desired bit mask. The desired bit mask is 1000000. It should be 1<<(7-0)

        for (bit=0; bit<8; bit++){
            if ( (color[col] & (1<<(8-bit))) && (led == led_index) ) {

There is a comment from @VerusLogic in the related commit about this problem.

4e96bff#diff-e59a7abf6f432b9f3d716a15f5f9b715

@david-cermak

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