-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't Assume Last Mem Location is Unused
Insteon devices always keep the last memory location as unused and all 0x00s. However, it looks like ISY may use the last location. Our code also didn't treat the last_loc as unused even when it was marked as so. Now, the last_loc is only put in the unused array if it is unused. This means that to write to an existing mem_loc we need >1 unused address. To bring an ISY database into alignment with how we use it if the last loc is used, we do 3 things. 1. Change the last_loc flag on the current last entry to false 2. Write the new entry in the slot just below #1 marked as used and not last 3. Write a new all 0x00 entry marked unused and last below #2 Finally rearrange how we write new entrys so that: 1. Write the new entry in the slot currently marked as last 2. Write a new all 0x00 entry marked unused and last below #2 This could mean that if things fail before #2 happens a bunch of bizarre old links may reappear, but I think this is extremely unlikely, and organizing it this way enables the ISY fix to be done in only 3 database writes.
- Loading branch information
Showing
1 changed file
with
53 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters