diff options
Diffstat (limited to 'apps/settings.c')
-rw-r--r-- | apps/settings.c | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/apps/settings.c b/apps/settings.c index b2fa22170b..35e75d12ca 100644 --- a/apps/settings.c +++ b/apps/settings.c | |||
@@ -129,6 +129,9 @@ location used, and reset the setting in question with a factory default if | |||
129 | needed. Memory locations not used by a given version should not be | 129 | needed. Memory locations not used by a given version should not be |
130 | modified unless the header & checksum test fails. | 130 | modified unless the header & checksum test fails. |
131 | 131 | ||
132 | Because 0xff mean that the byte is unused, care must be taken so that | ||
133 | a used byte can't have the value 0xff. Either use only 7 bits, or make sure | ||
134 | that the value will never be 0xff. | ||
132 | 135 | ||
133 | Rest of config block, only saved to disk: | 136 | Rest of config block, only saved to disk: |
134 | 0xA8 (char)jump scroll mode (only for player) | 137 | 0xA8 (char)jump scroll mode (only for player) |
@@ -151,9 +154,8 @@ Rest of config block, only saved to disk: | |||
151 | 0xB8 (char[20]) WPS file | 154 | 0xB8 (char[20]) WPS file |
152 | 0xCC (char[20]) Lang file | 155 | 0xCC (char[20]) Lang file |
153 | 0xE0 (char[20]) Font file | 156 | 0xE0 (char[20]) Font file |
154 | 0xF4 <unused> | 157 | 0xF4 Prerecording time (bit 0-4) |
155 | 0xF8 <unused> | 158 | 0xF5-0xFF <unused> |
156 | 0xFC <unused> | ||
157 | 159 | ||
158 | *************************************/ | 160 | *************************************/ |
159 | 161 | ||
@@ -432,6 +434,8 @@ int settings_save( void ) | |||
432 | strncpy(&config_block[0xcc], global_settings.lang_file, MAX_FILENAME); | 434 | strncpy(&config_block[0xcc], global_settings.lang_file, MAX_FILENAME); |
433 | strncpy(&config_block[0xe0], global_settings.font_file, MAX_FILENAME); | 435 | strncpy(&config_block[0xe0], global_settings.font_file, MAX_FILENAME); |
434 | 436 | ||
437 | config_block[0xf4]=(unsigned char)global_settings.rec_prerecord_time; | ||
438 | |||
435 | if(save_config_buffer()) | 439 | if(save_config_buffer()) |
436 | { | 440 | { |
437 | lcd_clear_display(); | 441 | lcd_clear_display(); |
@@ -756,6 +760,10 @@ void settings_load(void) | |||
756 | strncpy(global_settings.wps_file, &config_block[0xb8], MAX_FILENAME); | 760 | strncpy(global_settings.wps_file, &config_block[0xb8], MAX_FILENAME); |
757 | strncpy(global_settings.lang_file, &config_block[0xcc], MAX_FILENAME); | 761 | strncpy(global_settings.lang_file, &config_block[0xcc], MAX_FILENAME); |
758 | strncpy(global_settings.font_file, &config_block[0xe0], MAX_FILENAME); | 762 | strncpy(global_settings.font_file, &config_block[0xe0], MAX_FILENAME); |
763 | |||
764 | if (config_block[0xf4] != 0xff) | ||
765 | global_settings.rec_prerecord_time = config_block[0xf4]; | ||
766 | |||
759 | #ifdef HAVE_LCD_CHARCELLS | 767 | #ifdef HAVE_LCD_CHARCELLS |
760 | if (config_block[0xa8] != 0xff) | 768 | if (config_block[0xa8] != 0xff) |
761 | global_settings.jump_scroll = config_block[0xa8]; | 769 | global_settings.jump_scroll = config_block[0xa8]; |
@@ -1079,6 +1087,9 @@ bool settings_load_config(char* file) | |||
1079 | else if (!strcasecmp(name, "editable recordings")) { | 1087 | else if (!strcasecmp(name, "editable recordings")) { |
1080 | set_cfg_bool(&global_settings.rec_editable, value); | 1088 | set_cfg_bool(&global_settings.rec_editable, value); |
1081 | } | 1089 | } |
1090 | else if (!strcasecmp(name, "prerecording time")) { | ||
1091 | set_cfg_int(&global_settings.rec_prerecord_time, value, 0, 30); | ||
1092 | } | ||
1082 | #endif | 1093 | #endif |
1083 | else if (!strcasecmp(name, "idle poweroff")) { | 1094 | else if (!strcasecmp(name, "idle poweroff")) { |
1084 | static char* options[] = {"off","1","2","3","4","5","6","7","8", | 1095 | static char* options[] = {"off","1","2","3","4","5","6","7","8", |
@@ -1379,6 +1390,10 @@ bool settings_save_config(void) | |||
1379 | fprintf(fd, "line in: %s\r\n", boolopt[global_settings.line_in]); | 1390 | fprintf(fd, "line in: %s\r\n", boolopt[global_settings.line_in]); |
1380 | #endif | 1391 | #endif |
1381 | 1392 | ||
1393 | fprintf(fd, "max files in dir: %d\r\n", global_settings.max_files_in_dir); | ||
1394 | fprintf(fd, "max files in playlist: %d\r\n", | ||
1395 | global_settings.max_files_in_playlist); | ||
1396 | |||
1382 | #ifdef HAVE_MAS3587F | 1397 | #ifdef HAVE_MAS3587F |
1383 | fprintf(fd, "#\r\n# Recording\r\n#\r\n"); | 1398 | fprintf(fd, "#\r\n# Recording\r\n#\r\n"); |
1384 | fprintf(fd, "rec quality: %d\r\n", global_settings.rec_quality); | 1399 | fprintf(fd, "rec quality: %d\r\n", global_settings.rec_quality); |
@@ -1409,12 +1424,12 @@ bool settings_save_config(void) | |||
1409 | fprintf(fd, "editable recordings: %s\r\n", | 1424 | fprintf(fd, "editable recordings: %s\r\n", |
1410 | boolopt[global_settings.rec_editable]); | 1425 | boolopt[global_settings.rec_editable]); |
1411 | 1426 | ||
1427 | fprintf(fd, "prerecording time: %d\r\n", | ||
1428 | global_settings.rec_prerecord_time); | ||
1429 | |||
1412 | #endif | 1430 | #endif |
1413 | 1431 | ||
1414 | fprintf(fd, "max files in dir: %d\r\n", global_settings.max_files_in_dir); | 1432 | fprintf(fd, "#\r\n# Playlists\r\n#\r\n"); |
1415 | fprintf(fd, "max files in playlist: %d\r\n", | ||
1416 | global_settings.max_files_in_playlist); | ||
1417 | |||
1418 | { | 1433 | { |
1419 | static char* options[] = {"off", "on", "ask"}; | 1434 | static char* options[] = {"off", "on", "ask"}; |
1420 | fprintf(fd, "recursive directory insert: %s\r\n", | 1435 | fprintf(fd, "recursive directory insert: %s\r\n", |
@@ -1454,6 +1469,7 @@ void settings_reset(void) { | |||
1454 | global_settings.rec_left_gain = 2; /* 0dB */ | 1469 | global_settings.rec_left_gain = 2; /* 0dB */ |
1455 | global_settings.rec_right_gain = 2; /* 0dB */ | 1470 | global_settings.rec_right_gain = 2; /* 0dB */ |
1456 | global_settings.rec_editable = false; | 1471 | global_settings.rec_editable = false; |
1472 | global_settings.rec_prerecord_time = 0; | ||
1457 | global_settings.resume = RESUME_ASK; | 1473 | global_settings.resume = RESUME_ASK; |
1458 | global_settings.contrast = lcd_default_contrast(); | 1474 | global_settings.contrast = lcd_default_contrast(); |
1459 | global_settings.invert = DEFAULT_INVERT_SETTING; | 1475 | global_settings.invert = DEFAULT_INVERT_SETTING; |