hollie/misterhouse — pull request #293 by krkeegan (2013-10-20 03:46:10+00:00)
Title: Rewrite/Rework of Sync_Links and Delete_Orphan_Links

This fixes issues #272 and #176.

- This is a complete rewrite of the Sync_Links and Delete_Orphan_links routines. In theory they are both easier to read and understand (at least they are for me). About 400 lines of extraneous code was removed. The separate Delete Orphans routine for the PLM has been condensed into a single codebase. Same with sync_links.

- The Data3 value on control links is now properly set to the same value as the group value. (This will cause all old control links for buttons 2 and higher on devices to be deleted and resynced. Links on the PLM will not be touched as Data3 doesn't appear to have any ill effects if it is improperly set. All new controller links on the PLM will have the correct data3 value.)

- The default Data3 value for responder links is set to 01 for i2cs devices, but remains 00 for non i2cs devices for the root device.

- Sync links will now add the appropriate links to devices linked to deaf devices. Linked cannot be added to the deaf devices themselves, but at least half of the problem is handled.

The current code is completely stable. In my initial testing the links added and deleted by the respective routines appears to be accurate. But more elaborate testing will be needed to confirm.

One caveat, many of the links involving non_root devices will be recreated by running sync_links and delete_orphans (this is kind of the goal of the whole thing). But as a result, you probably don't want to switch back and forth between master and this.