I've taken the work of @thiti-y and @paullj1 and added my own fixes to the storage issues.
TLDR; the alignment issues and read write protection of the ESP flash issues are now resolved.
With ESP8266 flash, you can only write data in 4 byte alignments to addresses that have been erased. Once you've written data to an address, you cannot write to the address again until the sector is erased. I've corrected the logic in storage.c based on this and all seems to work well now.
I am now able to added and remove pairing without the "max number of pairings" issues. You may need to do a homekit_storage_reset() or erase the "EEPROM" sector before it will work well.
I have also added a bunch of changes to remove Platform.io warnings.
I've taken the work of @thiti-y and @paullj1 and added my own fixes to the storage issues.
TLDR; the alignment issues and read write protection of the ESP flash issues are now resolved.
With ESP8266 flash, you can only write data in 4 byte alignments to addresses that have been erased. Once you've written data to an address, you cannot write to the address again until the sector is erased. I've corrected the logic in
storage.c
based on this and all seems to work well now.I am now able to added and remove pairing without the "max number of pairings" issues. You may need to do a
homekit_storage_reset()
or erase the "EEPROM" sector before it will work well.I have also added a bunch of changes to remove Platform.io warnings.