I create a project to learn details of settings module and code as above.
When the code running ,I try to trigger settings_save_one to save data,the function return -2.
How can I repair it?
I create a project to learn details of settings module and code as above.
When the code running ,I try to trigger settings_save_one to save data,the function return -2.
How can I repair it?
Can you provide more information about your firmware and hardware setup?
Like NCS version, which sample you modified with, which chip or DK are you using?
I using NCS v2.6.0 with nRF52840DK.
The code I upload at the start of the ticket,not a sample.
Have you managed to test with the following official sample? If not, can you have a try? It demonstrates usage of settings_save_one function.
zephyr/samples/subsys/settings
I tried the settings sample,always some places I can not understand but almost settings_save_one() will run successfully.
So I don't know where is wrong.
I would suggest you modify your settings to test codes from existing settings sample. It will save some effort on debugging and help you quickly learn how to use settings system in a propery way.