summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/lang/english.lang5
-rw-r--r--apps/settings.c36
-rw-r--r--apps/settings.h8
-rw-r--r--apps/settings_menu.c17
4 files changed, 55 insertions, 11 deletions
diff --git a/apps/lang/english.lang b/apps/lang/english.lang
index afea869bee..9ff2b66e44 100644
--- a/apps/lang/english.lang
+++ b/apps/lang/english.lang
@@ -864,3 +864,8 @@ id: LANG_PM_UNITS_PER_READ
864desc: in the peak meter menu 864desc: in the peak meter menu
865eng: "Units per read" 865eng: "Units per read"
866new: 866new:
867
868id: LANG_BACKLIGHT_ON_WHEN_CHARGING
869desc: in display_settings_menu
870eng: "Backlight on when charging"
871new:
diff --git a/apps/settings.c b/apps/settings.c
index 1b4f864ec5..450a85b2da 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -74,7 +74,7 @@ offset abs
740x08 0x1c <loudness byte> 740x08 0x1c <loudness byte>
750x09 0x1d <bass boost byte> 750x09 0x1d <bass boost byte>
760x0a 0x1e <contrast byte> 760x0a 0x1e <contrast byte>
770x0b 0x1f <backlight byte> 770x0b 0x1f <backlight_on_when_charging, backlight_timeout>
780x0c 0x20 <poweroff timer byte> 780x0c 0x20 <poweroff timer byte>
790x0d 0x21 <resume settings byte> 790x0d 0x21 <resume settings byte>
800x0e 0x22 <shuffle,dirfilter,sort_case,discharge,statusbar,show_hidden, 800x0e 0x22 <shuffle,dirfilter,sort_case,discharge,statusbar,show_hidden,
@@ -270,7 +270,16 @@ int settings_save( void )
270 config_block[0x9] = (unsigned char)global_settings.bass_boost; 270 config_block[0x9] = (unsigned char)global_settings.bass_boost;
271 271
272 config_block[0xa] = (unsigned char)global_settings.contrast; 272 config_block[0xa] = (unsigned char)global_settings.contrast;
273 config_block[0xb] = (unsigned char)global_settings.backlight; 273
274#ifdef HAVE_CHARGE_CTRL
275 if( global_settings.backlight_on_when_charging ) {
276 config_block[0xb] = (unsigned char) (global_settings.backlight_timeout + 128);
277 } else {
278 config_block[0xb] = (unsigned char)global_settings.backlight_timeout;
279 }
280#else
281 config_block[0xb] = (unsigned char)global_settings.backlight_timeout;
282#endif
274 config_block[0xc] = (unsigned char)global_settings.poweroff; 283 config_block[0xc] = (unsigned char)global_settings.poweroff;
275 config_block[0xd] = (unsigned char)global_settings.resume; 284 config_block[0xd] = (unsigned char)global_settings.resume;
276 285
@@ -366,8 +375,15 @@ void settings_load(void)
366 if ( global_settings.contrast < MIN_CONTRAST_SETTING ) 375 if ( global_settings.contrast < MIN_CONTRAST_SETTING )
367 global_settings.contrast = DEFAULT_CONTRAST_SETTING; 376 global_settings.contrast = DEFAULT_CONTRAST_SETTING;
368 } 377 }
378#ifdef HAVE_CHARGE_CTRL
379 if (config_block[0xb] != 0xFF) {
380 global_settings.backlight_timeout = config_block[0xb] & 127;
381 global_settings.backlight_on_when_charging = config_block[0xb] & 128 ? 1 : 0;
382 }
383#else
369 if (config_block[0xb] != 0xFF) 384 if (config_block[0xb] != 0xFF)
370 global_settings.backlight = config_block[0xb]; 385 global_settings.backlight_timeout = config_block[0xb];
386#endif
371 if (config_block[0xc] != 0xFF) 387 if (config_block[0xc] != 0xFF)
372 global_settings.poweroff = config_block[0xc]; 388 global_settings.poweroff = config_block[0xc];
373 if (config_block[0xd] != 0xFF) 389 if (config_block[0xd] != 0xFF)
@@ -432,7 +448,10 @@ void settings_load(void)
432 } 448 }
433 lcd_set_contrast(global_settings.contrast); 449 lcd_set_contrast(global_settings.contrast);
434 lcd_scroll_speed(global_settings.scroll_speed); 450 lcd_scroll_speed(global_settings.scroll_speed);
435 backlight_time(global_settings.backlight); 451 backlight_set_timeout(global_settings.backlight_timeout);
452#ifdef HAVE_CHARGE_CTRL
453 backlight_set_on_when_charging(global_settings.backlight_on_when_charging);
454#endif
436 ata_spindown(global_settings.disk_spindown); 455 ata_spindown(global_settings.disk_spindown);
437 set_poweroff_timeout(global_settings.poweroff); 456 set_poweroff_timeout(global_settings.poweroff);
438#ifdef HAVE_CHARGE_CTRL 457#ifdef HAVE_CHARGE_CTRL
@@ -615,7 +634,10 @@ void settings_reset(void) {
615 global_settings.resume = RESUME_ASK; 634 global_settings.resume = RESUME_ASK;
616 global_settings.contrast = DEFAULT_CONTRAST_SETTING; 635 global_settings.contrast = DEFAULT_CONTRAST_SETTING;
617 global_settings.poweroff = DEFAULT_POWEROFF_SETTING; 636 global_settings.poweroff = DEFAULT_POWEROFF_SETTING;
618 global_settings.backlight = DEFAULT_BACKLIGHT_SETTING; 637 global_settings.backlight_timeout = DEFAULT_BACKLIGHT_TIMEOUT_SETTING;
638#ifdef HAVE_CHARGE_CTRL
639 global_settings.backlight_on_when_charging = DEFAULT_BACKLIGHT_ON_WHEN_CHARGING_SETTING;
640#endif
619 global_settings.dirfilter = SHOW_MUSIC; 641 global_settings.dirfilter = SHOW_MUSIC;
620 global_settings.sort_case = false; 642 global_settings.sort_case = false;
621 global_settings.statusbar = true; 643 global_settings.statusbar = true;
@@ -654,10 +676,10 @@ void settings_display(void)
654 global_settings.loudness, 676 global_settings.loudness,
655 global_settings.bass_boost ); 677 global_settings.bass_boost );
656 678
657 DEBUGF( "contrast:\t%d\npoweroff:\t%d\nbacklight:\t%d\n", 679 DEBUGF( "contrast:\t%d\npoweroff:\t%d\nbacklight_timeout:\t%d\n",
658 global_settings.contrast, 680 global_settings.contrast,
659 global_settings.poweroff, 681 global_settings.poweroff,
660 global_settings.backlight ); 682 global_settings.backlight_timeout );
661#endif 683#endif
662} 684}
663 685
diff --git a/apps/settings.h b/apps/settings.h
index bbc7bb3dcc..eed0b61c20 100644
--- a/apps/settings.h
+++ b/apps/settings.h
@@ -63,7 +63,10 @@ struct user_settings
63 63
64 int contrast; /* lcd contrast: 0-100 0=low 100=high */ 64 int contrast; /* lcd contrast: 0-100 0=low 100=high */
65 int poweroff; /* power off timer */ 65 int poweroff; /* power off timer */
66 int backlight; /* backlight off timer: 0-100 0=never:each 1% = 10 secs */ 66 int backlight_timeout; /* backlight off timeout: 0-18 0=never,1=always,then according to timeout_values[] */
67#ifdef HAVE_CHARGE_CTRL
68 bool backlight_on_when_charging;
69#endif
67 bool discharge; /* maintain charge of at least: false = 90%, true = 10% */ 70 bool discharge; /* maintain charge of at least: false = 90%, true = 10% */
68 71
69 /* resume settings */ 72 /* resume settings */
@@ -144,7 +147,8 @@ extern char rockboxdir[];
144#endif 147#endif
145#define MIN_CONTRAST_SETTING 5 148#define MIN_CONTRAST_SETTING 5
146#define DEFAULT_POWEROFF_SETTING 0 149#define DEFAULT_POWEROFF_SETTING 0
147#define DEFAULT_BACKLIGHT_SETTING 5 150#define DEFAULT_BACKLIGHT_TIMEOUT_SETTING 5
151#define DEFAULT_BACKLIGHT_ON_WHEN_CHARGING_SETTING 0
148#define DEFAULT_FF_REWIND_MIN_STEP FF_REWIND_1000 152#define DEFAULT_FF_REWIND_MIN_STEP FF_REWIND_1000
149#define DEFAULT_FF_REWIND_ACCEL_SETTING 3 153#define DEFAULT_FF_REWIND_ACCEL_SETTING 3
150 154
diff --git a/apps/settings_menu.c b/apps/settings_menu.c
index 3cb270dafe..4e521bca84 100644
--- a/apps/settings_menu.c
+++ b/apps/settings_menu.c
@@ -144,6 +144,16 @@ static bool resume(void)
144 names, 3, NULL ); 144 names, 3, NULL );
145} 145}
146 146
147#ifdef HAVE_CHARGE_CTRL
148static bool backlight_on_when_charging(void)
149{
150 bool result = set_bool(str(LANG_BACKLIGHT_ON_WHEN_CHARGING),
151 &global_settings.backlight_on_when_charging);
152 backlight_set_on_when_charging(global_settings.backlight_on_when_charging);
153 return result;
154}
155#endif
156
147static bool backlight_timer(void) 157static bool backlight_timer(void)
148{ 158{
149 char* names[] = { str(LANG_OFF), str(LANG_ON), 159 char* names[] = { str(LANG_OFF), str(LANG_ON),
@@ -151,8 +161,8 @@ static bool backlight_timer(void)
151 "6s ", "7s ", "8s ", "9s ", "10s", 161 "6s ", "7s ", "8s ", "9s ", "10s",
152 "15s", "20s", "25s", "30s", "45s", 162 "15s", "20s", "25s", "30s", "45s",
153 "60s", "90s"}; 163 "60s", "90s"};
154 return set_option(str(LANG_BACKLIGHT), &global_settings.backlight, 164 return set_option(str(LANG_BACKLIGHT), &global_settings.backlight_timeout,
155 names, 19, backlight_time ); 165 names, 19, backlight_set_timeout );
156} 166}
157 167
158static bool poweroff_idle_timer(void) 168static bool poweroff_idle_timer(void)
@@ -377,6 +387,9 @@ static bool display_settings_menu(void)
377 struct menu_items items[] = { 387 struct menu_items items[] = {
378 { str(LANG_SCROLL_MENU), scroll_speed }, 388 { str(LANG_SCROLL_MENU), scroll_speed },
379 { str(LANG_BACKLIGHT), backlight_timer }, 389 { str(LANG_BACKLIGHT), backlight_timer },
390#ifdef HAVE_CHARGE_CTRL
391 { str(LANG_BACKLIGHT_ON_WHEN_CHARGING), backlight_on_when_charging },
392#endif
380 { str(LANG_CONTRAST), contrast }, 393 { str(LANG_CONTRAST), contrast },
381#ifdef HAVE_LCD_BITMAP 394#ifdef HAVE_LCD_BITMAP
382 { str(LANG_PM_MENU), peak_meter_menu }, 395 { str(LANG_PM_MENU), peak_meter_menu },