David Johnston wrote:
Okay, after a little exploring I haven't found any further answers, so
let me rephrase my question.
How can I modify an entry in global_settings and have that be
persistent -- that is, that it'll be the same when I reboot?
I've found other places in the code where the same problem occurs as
the one I'm having. For instance, on the recording screen (not the
recording menu) if you change the AGC setting and then reboot, the
setting will remain at its previous value. But if you change the AGC
setting on the record screen, then change an unrelated setting via the
menu, the AGC setting _will_ be saved on shutdown.
Here's the code that decrements the AGC setting in the record screen:
---
case ITEM_AGC_MODE:
agc_preset = MAX(agc_preset - 1, 0);
agc_enable = (agc_preset != 0);
#ifdef HAVE_MIC_REC
if (global_settings.rec_source == AUDIO_SRC_MIC) {
global_settings.rec_agc_preset_mic =
agc_preset;
agc_maxgain =
global_settings.rec_agc_maxgain_mic;
} else
#endif /* MIC */
{
global_settings.rec_agc_preset_line =
agc_preset;
agc_maxgain =
global_settings.rec_agc_maxgain_line;
}
---
Somehow the menu system lets Rockbox know that settings have changed,
but just changing a value in global_settings doesn't.
Hi David,
It appears that the menu system calls the settings_save() function in
settings.c when an item is changed, which saves the user settings
struct. I think all you'd have to do is call this function (be sure to
#include settings.h) whenever your value changes. Give it a try
anyway. While you're at it, fix the above bug too. :)
Jeff