zephyr settings part 4: CAF settings module,
July 31, 2022•213 words
TODO:
check the use of : settingsruntimeset, settingsruntimeget
CAF settings loader module: takes care of settings initialization ( settingssubsysinit ) and settingsload automatically. Don't know if it works without SETTINGSSTATICHANDLERDEFINE,
docs: https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/libraries/caf/settings_loader.html
CONCLUSION: settings works but is really shitty because of very limited documentation and the need to implement handlers for parsing the keys with confusing functions ( settingsnamesteq , settingsnamenext ). I say shitty because if you want to do something that goes beyond the samples you'll have to understand what's happening under the hood and this is time consuming and really not fun (I know....who said coding in C should be fun? ... I come from the web world, I just feel that C is prehistoric, development is slow and requires a perfect knowledge of the language because it has no mercy). The fact that settings relies on the data stored in the backend to autoload variables can mislead you if you don't know it. So while you are developping don't forget to erase your storage flash partition until your code is stable.
Suggestions: explain in the samples why one should follow one technique instead of the other (handler, no handler,settingsloadsubtreedirect, settingsload_subtree ...) and maybe offer a basic solution loadSetting()/saveSetting() that might be more then enough for 90
99% of developpers.