-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement persistent storage for attributes with "NVM" storage selected. #13172
Implement persistent storage for attributes with "NVM" storage selected. #13172
Conversation
PR #13172: Size comparison from bf7feea to 7bc13b8 Increases above 0.2%:
Increases (25 builds for efr32, esp32, k32w, linux, mbed, nrfconnect, p6, qpg, telink)
Full report (31 builds for efr32, esp32, k32w, linux, mbed, nrfconnect, p6, qpg, telink)
|
7bc13b8
to
2a1ae49
Compare
PR #13172: Size comparison from bf7feea to 2a1ae49 Increases above 0.2%:
Increases (23 builds for efr32, k32w, linux, mbed, nrfconnect, p6, qpg, telink)
Full report (29 builds for efr32, k32w, linux, mbed, nrfconnect, p6, qpg, telink)
|
2a1ae49
to
3c6525c
Compare
PR #13172: Size comparison from afec776 to 3c6525c Increases above 0.2%:
Increases (25 builds for efr32, esp32, k32w, linux, mbed, nrfconnect, p6, qpg, telink)
Full report (31 builds for efr32, esp32, k32w, linux, mbed, nrfconnect, p6, qpg, telink)
|
3c6525c
to
ca676e0
Compare
PR #13172: Size comparison from afec776 to ca676e0 Increases above 0.2%:
Increases (25 builds for efr32, esp32, k32w, linux, mbed, nrfconnect, p6, qpg, telink)
Full report (31 builds for efr32, esp32, k32w, linux, mbed, nrfconnect, p6, qpg, telink)
|
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
ca676e0
to
87bf813
Compare
General changes: 1. Set the CurrentLevel attribute in all-clusters app to be NVM and default to 254. This requires some YAML changes to expect the new value. 2. Remove the hardcoded setting of that attribute to 255 during boot in the ESP32 all-clusters app. 3. Define and implement AttributePersistenceProvider to read/write persistent attributes. 4. Fix bug in ServerStorageDelegate::SyncGetKeyValue: it was not setting the size outparam to the actual size read. 5. Move EmberAfAttributeMetadata and a few functions for working with strings into a new header that can be included in places where generated headers (which af.h and af-types.h include) can't be. 6. Add those functions to out mock attribute-storage to fix linking of some tests. Fix mistyped "darwin" in gn files so the tests get run on Darwin too, not just on Linux. 7. Rearrange the logic in emAfLoadAttributeDefaults a bit: instead of loading the default value into the RAM store and then checking for a persisted value, check for a persisted value first (if the attribute might have one), and only look for a default value if there is no persisted value. This removes the need for a separate emAfLoadAttributesFromStorage pass (which made sense back when that code was all generated, but it's not anymore). 8. Fix emAfSaveAttributeToStorageIfNeeded to actually store the value.
87bf813
to
8b9a342
Compare
PR #13172: Size comparison from 89b87f1 to 8b9a342 Increases above 0.2%:
Increases (22 builds for efr32, esp32, k32w, linux, nrfconnect, p6, qpg, telink)
Full report (26 builds for efr32, esp32, k32w, linux, nrfconnect, p6, qpg, telink)
|
…ed. (project-chip#13172) General changes: 1. Set the CurrentLevel attribute in all-clusters app to be NVM and default to 254. This requires some YAML changes to expect the new value. 2. Remove the hardcoded setting of that attribute to 255 during boot in the ESP32 all-clusters app. 3. Define and implement AttributePersistenceProvider to read/write persistent attributes. 4. Fix bug in ServerStorageDelegate::SyncGetKeyValue: it was not setting the size outparam to the actual size read. 5. Move EmberAfAttributeMetadata and a few functions for working with strings into a new header that can be included in places where generated headers (which af.h and af-types.h include) can't be. 6. Add those functions to out mock attribute-storage to fix linking of some tests. Fix mistyped "darwin" in gn files so the tests get run on Darwin too, not just on Linux. 7. Rearrange the logic in emAfLoadAttributeDefaults a bit: instead of loading the default value into the RAM store and then checking for a persisted value, check for a persisted value first (if the attribute might have one), and only look for a default value if there is no persisted value. This removes the need for a separate emAfLoadAttributesFromStorage pass (which made sense back when that code was all generated, but it's not anymore). 8. Fix emAfSaveAttributeToStorageIfNeeded to actually store the value.
Problem
Attributes marked as "NVM" storage are not actually stored across reboots.
Change overview
ServerStorageDelegate::SyncGetKeyValue
: it was not setting thesize
outparam to the actual size read.EmberAfAttributeMetadata
and a few functions for working with strings into a new header that can be included in places where generated headers (whichaf.h
andaf-types.h
include) can't be.emAfLoadAttributesFromStorage
pass (which made sense back when that code was all generated, but it's not anymore).emAfSaveAttributeToStorageIfNeeded
to actually store the value.Testing
Manual testing as follows:
chip-tool levelcontrol read current-level 17 1
and verify value is 254chip-tool levelcontrol move-to-level 128 0 0 0 17 1
chip-tool levelcontrol read current-level 17 1
Without these changes, step 5 showed "254". Now it shows "128".