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.
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.