diff options
Diffstat (limited to 'apps/settings.c')
-rw-r--r-- | apps/settings.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/apps/settings.c b/apps/settings.c index b8062be68a..bc5a5bc7b4 100644 --- a/apps/settings.c +++ b/apps/settings.c | |||
@@ -49,6 +49,7 @@ | |||
49 | #include "icons.h" | 49 | #include "icons.h" |
50 | #include "font.h" | 50 | #include "font.h" |
51 | #include "peakmeter.h" | 51 | #include "peakmeter.h" |
52 | #include "hwcompat.h" | ||
52 | #endif | 53 | #endif |
53 | #include "lang.h" | 54 | #include "lang.h" |
54 | #include "language.h" | 55 | #include "language.h" |
@@ -61,7 +62,7 @@ | |||
61 | struct user_settings global_settings; | 62 | struct user_settings global_settings; |
62 | char rockboxdir[] = ROCKBOX_DIR; /* config/font/data file directory */ | 63 | char rockboxdir[] = ROCKBOX_DIR; /* config/font/data file directory */ |
63 | 64 | ||
64 | #define CONFIG_BLOCK_VERSION 5 | 65 | #define CONFIG_BLOCK_VERSION 6 |
65 | #define CONFIG_BLOCK_SIZE 512 | 66 | #define CONFIG_BLOCK_SIZE 512 |
66 | #define RTC_BLOCK_SIZE 44 | 67 | #define RTC_BLOCK_SIZE 44 |
67 | 68 | ||
@@ -549,6 +550,15 @@ void settings_apply(void) | |||
549 | } | 550 | } |
550 | } | 551 | } |
551 | 552 | ||
553 | static int default_contrast(void) | ||
554 | { | ||
555 | #ifdef HAVE_LCD_CHARCELLS | ||
556 | return 30; | ||
557 | #else | ||
558 | return (read_hw_mask() & LCD_CONTRAST_BIAS) ? 31 : 49; | ||
559 | #endif | ||
560 | } | ||
561 | |||
552 | /* | 562 | /* |
553 | * load settings from disk or RTC RAM | 563 | * load settings from disk or RTC RAM |
554 | */ | 564 | */ |
@@ -581,7 +591,7 @@ void settings_load(void) | |||
581 | global_settings.invert = | 591 | global_settings.invert = |
582 | config_block[0xa] & 0x40 ? true : false; | 592 | config_block[0xa] & 0x40 ? true : false; |
583 | if ( global_settings.contrast < MIN_CONTRAST_SETTING ) | 593 | if ( global_settings.contrast < MIN_CONTRAST_SETTING ) |
584 | global_settings.contrast = DEFAULT_CONTRAST_SETTING; | 594 | global_settings.contrast = default_contrast(); |
585 | global_settings.show_icons = | 595 | global_settings.show_icons = |
586 | config_block[0xa] & 0x80 ? true : false; | 596 | config_block[0xa] & 0x80 ? true : false; |
587 | } | 597 | } |
@@ -989,7 +999,7 @@ bool settings_load_config(char* file) | |||
989 | set_cfg_bool(&global_settings.play_selected, value); | 999 | set_cfg_bool(&global_settings.play_selected, value); |
990 | else if (!strcasecmp(name, "contrast")) | 1000 | else if (!strcasecmp(name, "contrast")) |
991 | set_cfg_int(&global_settings.contrast, value, | 1001 | set_cfg_int(&global_settings.contrast, value, |
992 | 0, MAX_CONTRAST_SETTING); | 1002 | MIN_CONTRAST_SETTING, MAX_CONTRAST_SETTING); |
993 | else if (!strcasecmp(name, "scroll speed")) | 1003 | else if (!strcasecmp(name, "scroll speed")) |
994 | set_cfg_int(&global_settings.scroll_speed, value, 1, 10); | 1004 | set_cfg_int(&global_settings.scroll_speed, value, 1, 10); |
995 | else if (!strcasecmp(name, "scan min step")) { | 1005 | else if (!strcasecmp(name, "scan min step")) { |
@@ -1405,7 +1415,7 @@ void settings_reset(void) { | |||
1405 | global_settings.rec_right_gain = 2; /* 0dB */ | 1415 | global_settings.rec_right_gain = 2; /* 0dB */ |
1406 | global_settings.rec_editable = false; | 1416 | global_settings.rec_editable = false; |
1407 | global_settings.resume = RESUME_ASK; | 1417 | global_settings.resume = RESUME_ASK; |
1408 | global_settings.contrast = DEFAULT_CONTRAST_SETTING; | 1418 | global_settings.contrast = default_contrast(); |
1409 | global_settings.invert = DEFAULT_INVERT_SETTING; | 1419 | global_settings.invert = DEFAULT_INVERT_SETTING; |
1410 | global_settings.poweroff = DEFAULT_POWEROFF_SETTING; | 1420 | global_settings.poweroff = DEFAULT_POWEROFF_SETTING; |
1411 | global_settings.backlight_timeout = DEFAULT_BACKLIGHT_TIMEOUT_SETTING; | 1421 | global_settings.backlight_timeout = DEFAULT_BACKLIGHT_TIMEOUT_SETTING; |