diff options
Diffstat (limited to 'apps/settings.c')
-rw-r--r-- | apps/settings.c | 57 |
1 files changed, 31 insertions, 26 deletions
diff --git a/apps/settings.c b/apps/settings.c index 81e4d12f69..74299356bd 100644 --- a/apps/settings.c +++ b/apps/settings.c | |||
@@ -126,6 +126,8 @@ modified unless the header & checksum test fails. | |||
126 | 126 | ||
127 | 127 | ||
128 | Rest of config block, only saved to disk: | 128 | Rest of config block, only saved to disk: |
129 | 0xAA Max number of files in playlist (1000-20000) | ||
130 | 0xAC Max number of files in dir (50-10000) | ||
129 | 0xAE fade on pause/unpause/stop setting (bit 0) | 131 | 0xAE fade on pause/unpause/stop setting (bit 0) |
130 | caption backlight (bit 1) | 132 | caption backlight (bit 1) |
131 | 0xB0 peak meter clip hold timeout (bit 0-4), peak meter performance (bit 7) | 133 | 0xB0 peak meter clip hold timeout (bit 0-4), peak meter performance (bit 7) |
@@ -379,6 +381,14 @@ int settings_save( void ) | |||
379 | config_block[0x29]=(unsigned char)(global_settings.topruntime >> 8); | 381 | config_block[0x29]=(unsigned char)(global_settings.topruntime >> 8); |
380 | } | 382 | } |
381 | 383 | ||
384 | config_block[0xaa] = (unsigned char) | ||
385 | global_settings.max_files_in_playlist & 0xff; | ||
386 | config_block[0xab] = (unsigned char) | ||
387 | (global_settings.max_files_in_playlist >> 8) & 0xff; | ||
388 | config_block[0xac] = (unsigned char) | ||
389 | global_settings.max_files_in_dir & 0xff; | ||
390 | config_block[0xad] = (unsigned char) | ||
391 | (global_settings.max_files_in_dir >> 8) & 0xff; | ||
382 | config_block[0xae] = (unsigned char) | 392 | config_block[0xae] = (unsigned char) |
383 | ((global_settings.fade_on_stop & 1) | | 393 | ((global_settings.fade_on_stop & 1) | |
384 | ((global_settings.caption_backlight & 1) << 1)); | 394 | ((global_settings.caption_backlight & 1) << 1)); |
@@ -695,6 +705,14 @@ void settings_load(void) | |||
695 | if (config_block[0xae] != 0xff) | 705 | if (config_block[0xae] != 0xff) |
696 | global_settings.fade_on_stop = config_block[0xae]; | 706 | global_settings.fade_on_stop = config_block[0xae]; |
697 | 707 | ||
708 | if (config_block[0xac] != 0xff) | ||
709 | global_settings.max_files_in_dir = | ||
710 | config_block[0xac] | (config_block[0xad] << 8); | ||
711 | |||
712 | if (config_block[0xaa] != 0xff) | ||
713 | global_settings.max_files_in_playlist = | ||
714 | config_block[0xaa] | (config_block[0xab] << 8); | ||
715 | |||
698 | memcpy(&global_settings.resume_first_index, &config_block[0xF4], 4); | 716 | memcpy(&global_settings.resume_first_index, &config_block[0xF4], 4); |
699 | memcpy(&global_settings.resume_seed, &config_block[0xF8], 4); | 717 | memcpy(&global_settings.resume_seed, &config_block[0xF8], 4); |
700 | 718 | ||
@@ -1025,6 +1043,12 @@ bool settings_load_config(char* file) | |||
1025 | #endif | 1043 | #endif |
1026 | else if (!strcasecmp(name, "volume fade")) | 1044 | else if (!strcasecmp(name, "volume fade")) |
1027 | set_cfg_bool(&global_settings.fade_on_stop, value); | 1045 | set_cfg_bool(&global_settings.fade_on_stop, value); |
1046 | else if (!strcasecmp(name, "max files in dir")) | ||
1047 | set_cfg_int(&global_settings.max_files_in_dir, value, | ||
1048 | 50, 10000); | ||
1049 | else if (!strcasecmp(name, "max files in playlist")) | ||
1050 | set_cfg_int(&global_settings.max_files_in_playlist, value, | ||
1051 | 1000, 20000); | ||
1028 | } | 1052 | } |
1029 | 1053 | ||
1030 | close(fd); | 1054 | close(fd); |
@@ -1302,6 +1326,11 @@ bool settings_save_config(void) | |||
1302 | boolopt[global_settings.rec_editable]); | 1326 | boolopt[global_settings.rec_editable]); |
1303 | 1327 | ||
1304 | #endif | 1328 | #endif |
1329 | |||
1330 | fprintf(fd, "max files in dir: %d\r\n", global_settings.max_files_in_dir); | ||
1331 | fprintf(fd, "max files in playlist: %d\r\n", | ||
1332 | global_settings.max_files_in_playlist); | ||
1333 | |||
1305 | close(fd); | 1334 | close(fd); |
1306 | 1335 | ||
1307 | lcd_clear_display(); | 1336 | lcd_clear_display(); |
@@ -1384,32 +1413,8 @@ void settings_reset(void) { | |||
1384 | global_settings.runtime = 0; | 1413 | global_settings.runtime = 0; |
1385 | global_settings.topruntime = 0; | 1414 | global_settings.topruntime = 0; |
1386 | global_settings.fade_on_stop = true; | 1415 | global_settings.fade_on_stop = true; |
1387 | } | 1416 | global_settings.max_files_in_dir = 400; |
1388 | 1417 | global_settings.max_files_in_playlist = 10000; | |
1389 | |||
1390 | /* | ||
1391 | * dump the list of current settings | ||
1392 | */ | ||
1393 | void settings_display(void) | ||
1394 | { | ||
1395 | #ifdef DEBUG | ||
1396 | DEBUGF( "\nsettings_display()\n" ); | ||
1397 | |||
1398 | DEBUGF( "\nvolume:\t\t%d\nbalance:\t%d\nbass:\t\t%d\ntreble:\t\t%d\n" | ||
1399 | "loudness:\t%d\nbass boost:\t%d\n", | ||
1400 | global_settings.volume, | ||
1401 | global_settings.balance, | ||
1402 | global_settings.bass, | ||
1403 | global_settings.treble, | ||
1404 | global_settings.loudness, | ||
1405 | global_settings.bass_boost ); | ||
1406 | |||
1407 | DEBUGF( "contrast:\t%d\ninvert:\t%d\npoweroff:\t%d\nbacklight_timeout:\t%d\n", | ||
1408 | global_settings.contrast, | ||
1409 | global_settings.invert, | ||
1410 | global_settings.poweroff, | ||
1411 | global_settings.backlight_timeout ); | ||
1412 | #endif | ||
1413 | } | 1418 | } |
1414 | 1419 | ||
1415 | bool set_bool(char* string, bool* variable ) | 1420 | bool set_bool(char* string, bool* variable ) |