Skip to content

Bug in Example CmdrArduino_accessory.ino #20

@liamoreilly

Description

@liamoreilly

I believe there is a bug with the translation of accessory decoder addresses in the example.

The following two lines of code use incorrect calculations in the arguments:

  • dps.setBasicAccessory((address >> 2) + 1, ((address - 1) & 0x03) << 1);
  • dps.unsetBasicAccessory((address >> 2) + 1, ((address - 1) & 0x03) << 1);

I believe the correct calculations and hence the corrected lines are:

  • dps.setBasicAccessory(((address - 1) >> 2) + 1, ((address - 1) & 0x03));
  • dps.unsetBasicAccessory(((address - 1) >> 2) + 1, ((address - 1) & 0x03));

I hope this can be fixed and changed in the codebase; or at least help others who run into trouble trying to control accessory decoders.

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