Skip to content

bizarre value parsing in attachInterrupt.intHandler #163

Closed

Description

@mvduin

The local intHandler function inside attachInterrupt contains:

m.value = parseInt(Number(gpioInt[n].value), 2);

I was honestly surprised this even works at all since gpioInt[n].value is a Buffer here, and passing it to Number() makes no sense. Apparently however it just stringifies the buffer and then converts that to number. Of course passing a number to parseInt() also makes little sense, it will again stringify it and again convert it to a number.

I'd suggest changing it to parseInt(gpioInt[n].value.toString(), 2) to clarify what it's doing and avoid two pointless conversions.

Activity

  1. jadonk commented on Apr 25, 2018

    @jadonk
    Owner

    This issue was moved to beagleboard#45

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions