Step 2: Adding Setting Initialization

Top  Previous  Next

This step corresponds to test_stg_lib_2.

 

Non-volatile settings must be initialized at some point. In our sample project, we check the "health" of settings upon boot using stg_check_all(). Should any setting turn out to be invalid, we initialize all settings with stg_restore_multiple(). Granted, this is a very crude way of handling setting initialization, but it works just fine for a simple project like ours.

We also provided a way to initialize the settings at any time — just press the MD button for more than 2 seconds, then release.

All related changes are in main.tbs.