mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-13 18:17:39 -04:00
Remove NVRAM infavor of a separate cfg file
remove nvram and use the existing settings framework for it add a crc check to the user_settings data to see if we need to save the user setting file or if we can just save the status file (resume.cfg) move volume to the system_status struct so we don't write the whole settings file over volume changes allow user to still export volume with save sound settings allow the user to also export pitch and speed name the file .resume.cfg Rename all the SYSTEM_STATUS save file variables to TLAs to save space and discourage tinkering Cleanup DEBUG_AVAIL_SETTINGS output when saving user_settings it calls status_save as well this cause the resume file to be written twice. instead remove the callback for status_save when setting_save is called remove header text when saving .resume.cfg convert status_save() to status_save(bool force) add SYSTEM_STATUS_UPDATE_TICKS for ATA device set this to 5 minutes since we arlready wait for the disk to be up before saving we don't want to miss our window for all other every 15 minutes that way if the battery is too low by the time shutdown comes around you don't lose much progress Change-Id: I27214ffd6e5d5494ee5ca83b14f04a41ba426ad7
This commit is contained in:
parent
8e293b4948
commit
7100090f99
41 changed files with 299 additions and 340 deletions
35
apps/misc.c
35
apps/misc.c
|
@ -345,7 +345,7 @@ static bool clean_shutdown(enum shutdown_type sd_type,
|
|||
talk_disable(true);
|
||||
}
|
||||
|
||||
status_save();
|
||||
status_save(true);
|
||||
|
||||
#if CONFIG_CHARGING && !defined(HAVE_POWEROFF_WHILE_CHARGING)
|
||||
if(!charger_inserted())
|
||||
|
@ -751,8 +751,8 @@ long default_event_handler_ex(long event, void (*callback)(void *), void *parame
|
|||
* event data is available in the last button data */
|
||||
int volume = button_get_data();
|
||||
DEBUGF("SYS_VOLUME_CHANGED: %d\n", volume);
|
||||
if (global_settings.volume != volume) {
|
||||
global_settings.volume = volume;
|
||||
if (global_status.volume != volume) {
|
||||
global_status.volume = volume;
|
||||
if (firstvolume) {
|
||||
setvol();
|
||||
firstvolume = false;
|
||||
|
@ -859,16 +859,17 @@ void setvol(void)
|
|||
{
|
||||
const int min_vol = sound_min(SOUND_VOLUME);
|
||||
const int max_vol = sound_max(SOUND_VOLUME);
|
||||
if (global_settings.volume < min_vol)
|
||||
global_settings.volume = min_vol;
|
||||
if (global_settings.volume > max_vol)
|
||||
global_settings.volume = max_vol;
|
||||
if (global_settings.volume > global_settings.volume_limit)
|
||||
global_settings.volume = global_settings.volume_limit;
|
||||
|
||||
sound_set_volume(global_settings.volume);
|
||||
int volume = global_status.volume;
|
||||
if (volume < min_vol)
|
||||
volume = min_vol;
|
||||
if (volume > max_vol)
|
||||
volume = max_vol;
|
||||
if (volume > global_settings.volume_limit)
|
||||
volume = global_settings.volume_limit;
|
||||
global_status.volume = volume;
|
||||
sound_set_volume(volume);
|
||||
global_status.last_volume_change = current_tick;
|
||||
settings_save();
|
||||
status_save(false);
|
||||
}
|
||||
|
||||
#ifdef HAVE_PERCEPTUAL_VOLUME
|
||||
|
@ -920,7 +921,7 @@ void set_normalized_volume(int vol)
|
|||
if (vol >= norm_tab_size)
|
||||
vol = norm_tab_size - 1;
|
||||
|
||||
global_settings.volume = norm_tab[vol];
|
||||
global_status.volume = norm_tab[vol];
|
||||
}
|
||||
|
||||
int get_normalized_volume(void)
|
||||
|
@ -931,7 +932,7 @@ int get_normalized_volume(void)
|
|||
while (a != b)
|
||||
{
|
||||
int i = (a + b + 1) / 2;
|
||||
if (global_settings.volume < norm_tab[i])
|
||||
if (global_status.volume < norm_tab[i])
|
||||
b = i - 1;
|
||||
else
|
||||
a = i;
|
||||
|
@ -942,12 +943,12 @@ int get_normalized_volume(void)
|
|||
#else
|
||||
void set_normalized_volume(int vol)
|
||||
{
|
||||
global_settings.volume = vol * sound_steps(SOUND_VOLUME);
|
||||
global_status.volume = vol * sound_steps(SOUND_VOLUME);
|
||||
}
|
||||
|
||||
int get_normalized_volume(void)
|
||||
{
|
||||
return global_settings.volume / sound_steps(SOUND_VOLUME);
|
||||
return global_status.volume / sound_steps(SOUND_VOLUME);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -971,7 +972,7 @@ void adjust_volume_ex(int steps, enum volume_adjust_mode mode)
|
|||
#endif
|
||||
case VOLUME_ADJUST_DIRECT:
|
||||
default:
|
||||
global_settings.volume += steps * sound_steps(SOUND_VOLUME);
|
||||
global_status.volume += steps * sound_steps(SOUND_VOLUME);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue