summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2006-09-26 20:46:17 +0000
committerMichael Sevakis <jethead71@rockbox.org>2006-09-26 20:46:17 +0000
commite63649279186e119614b9ca892bcfa27e6af8337 (patch)
tree0e70869af41405372a2c229370c3d880719e38c7
parent9e92d06dd16a337dea5d7e80e747a8983e48891f (diff)
downloadrockbox-e63649279186e119614b9ca892bcfa27e6af8337.tar.gz
rockbox-e63649279186e119614b9ca892bcfa27e6af8337.zip
Fixed remote contrast settings. Maybe'll get some build errors here.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11071 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/settings.c12
-rw-r--r--apps/settings.h17
-rw-r--r--apps/settings_menu.c4
-rw-r--r--firmware/drivers/lcd-h100-remote.c6
-rw-r--r--firmware/export/config-h100.h2
-rw-r--r--firmware/export/config-h120.h2
-rw-r--r--firmware/export/config-iaudiox5.h6
-rwxr-xr-xfirmware/target/coldfire/iaudio/x5/lcd-remote-x5.c11
8 files changed, 47 insertions, 13 deletions
diff --git a/apps/settings.c b/apps/settings.c
index 4746c22c87..ee7fa36d39 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -302,7 +302,8 @@ static const struct bit_entry rtc_bits[] =
302 302
303#ifdef HAVE_REMOTE_LCD 303#ifdef HAVE_REMOTE_LCD
304 /* remote lcd */ 304 /* remote lcd */
305 {6, S_O(remote_contrast), 42, "remote contrast", NULL }, 305 {6, S_O(remote_contrast), DEFAULT_REMOTE_CONTRAST_SETTING,
306 "remote contrast", NULL },
306 {1, S_O(remote_invert), false, "remote invert", off_on }, 307 {1, S_O(remote_invert), false, "remote invert", off_on },
307 {1, S_O(remote_flip_display), false, "remote flip display", off_on }, 308 {1, S_O(remote_flip_display), false, "remote flip display", off_on },
308 {5, S_O(remote_backlight_timeout), 6, "remote backlight timeout", 309 {5, S_O(remote_backlight_timeout), 6, "remote backlight timeout",
@@ -1365,11 +1366,18 @@ void settings_load(int which)
1365#ifdef HAVE_RECORDING 1366#ifdef HAVE_RECORDING
1366 global_settings.recscreen_on = false; 1367 global_settings.recscreen_on = false;
1367#endif 1368#endif
1369
1368#ifdef HAVE_LCD_CONTRAST 1370#ifdef HAVE_LCD_CONTRAST
1369 if ( global_settings.contrast < MIN_CONTRAST_SETTING ) 1371 if ( global_settings.contrast < MIN_CONTRAST_SETTING ||
1372 global_settings.contrast > MAX_CONTRAST_SETTING )
1370 global_settings.contrast = lcd_default_contrast(); 1373 global_settings.contrast = lcd_default_contrast();
1371#endif 1374#endif
1372 1375
1376#ifdef HAVE_LCD_REMOTE
1377 if (global_settings.remote_contrast < MIN_REMOTE_CONTRAST_SETTING ||
1378 global_settings.remote_contrast > MAX_REMOTE_CONTRAST_SETTING )
1379 global_settings.remote_contrast = lcd_remote_default_contrast();
1380#endif
1373 i = 0xb8; 1381 i = 0xb8;
1374 strncpy((char *)global_settings.wps_file, (char *)&config_block[i], 1382 strncpy((char *)global_settings.wps_file, (char *)&config_block[i],
1375 MAX_FILENAME); 1383 MAX_FILENAME);
diff --git a/apps/settings.h b/apps/settings.h
index 9f8372415a..3e0b8fcd11 100644
--- a/apps/settings.h
+++ b/apps/settings.h
@@ -108,7 +108,6 @@ extern unsigned char vp_dummy[VIRT_SIZE];
108 simplicity. */ 108 simplicity. */
109#if !defined(HAVE_LCD_COLOR) 109#if !defined(HAVE_LCD_COLOR)
110#define HAVE_LCD_CONTRAST 110#define HAVE_LCD_CONTRAST
111#define DEFAULT_CONTRAST_SETTING 40
112#endif 111#endif
113 112
114struct user_settings 113struct user_settings
@@ -545,6 +544,11 @@ extern const char rec_base_directory[];
545 544
546/* system defines */ 545/* system defines */
547#ifndef TARGET_TREE 546#ifndef TARGET_TREE
547
548#ifndef HAVE_LCD_COLOR
549#define DEFAULT_CONTRAST_SETTING 40
550#endif
551
548#if defined HAVE_LCD_CHARCELLS 552#if defined HAVE_LCD_CHARCELLS
549#define MIN_CONTRAST_SETTING 5 553#define MIN_CONTRAST_SETTING 5
550#define MAX_CONTRAST_SETTING 31 554#define MAX_CONTRAST_SETTING 31
@@ -552,6 +556,17 @@ extern const char rec_base_directory[];
552#define MIN_CONTRAST_SETTING 5 556#define MIN_CONTRAST_SETTING 5
553#define MAX_CONTRAST_SETTING 63 557#define MAX_CONTRAST_SETTING 63
554#endif 558#endif
559
560/* As it was */
561#ifdef HAVE_REMOTE_LCD
562#ifndef DEFAULT_REMOTE_CONTRAST_SETTING
563/* May be defined in config file if driver code needs the value */
564#define DEFAULT_REMOTE_CONTRAST_SETTING 42
565#endif
566#define MIN_REMOTE_CONTRAST_SETTING MIN_CONTRAST_SETTING
567#define MAX_REMOTE_CONTRAST_SETTING MAX_CONTRAST_SETTING
568#endif
569
555#endif /* !TARGET_TREE */ 570#endif /* !TARGET_TREE */
556 571
557/* argument bits for settings_load() */ 572/* argument bits for settings_load() */
diff --git a/apps/settings_menu.c b/apps/settings_menu.c
index 36615cfc6a..27fc5653d1 100644
--- a/apps/settings_menu.c
+++ b/apps/settings_menu.c
@@ -124,8 +124,8 @@ static bool remote_contrast(void)
124{ 124{
125 return set_int( str(LANG_CONTRAST), "", UNIT_INT, 125 return set_int( str(LANG_CONTRAST), "", UNIT_INT,
126 &global_settings.remote_contrast, 126 &global_settings.remote_contrast,
127 lcd_remote_set_contrast, 1, MIN_CONTRAST_SETTING, 127 lcd_remote_set_contrast, 1, MIN_REMOTE_CONTRAST_SETTING,
128 MAX_CONTRAST_SETTING, NULL ); 128 MAX_REMOTE_CONTRAST_SETTING, NULL );
129} 129}
130 130
131static bool remote_invert(void) 131static bool remote_invert(void)
diff --git a/firmware/drivers/lcd-h100-remote.c b/firmware/drivers/lcd-h100-remote.c
index a200c7bcb1..75d42f8371 100644
--- a/firmware/drivers/lcd-h100-remote.c
+++ b/firmware/drivers/lcd-h100-remote.c
@@ -73,8 +73,6 @@ static int xmargin = 0;
73static int ymargin = 0; 73static int ymargin = 0;
74static int curfont = FONT_SYSFIXED; 74static int curfont = FONT_SYSFIXED;
75 75
76#define LCD_REMOTE_DEFAULT_CONTRAST 42;
77
78#ifndef SIMULATOR 76#ifndef SIMULATOR
79static int xoffset; /* needed for flip */ 77static int xoffset; /* needed for flip */
80 78
@@ -99,7 +97,7 @@ static int _remote_type = REMOTETYPE_UNPLUGGED;
99/* cached settings values */ 97/* cached settings values */
100static bool cached_invert = false; 98static bool cached_invert = false;
101static bool cached_flip = false; 99static bool cached_flip = false;
102static int cached_contrast = LCD_REMOTE_DEFAULT_CONTRAST; 100static int cached_contrast = DEFAULT_REMOTE_CONTRAST_SETTING;
103#endif 101#endif
104 102
105/* scrolling */ 103/* scrolling */
@@ -397,7 +395,7 @@ void lcd_remote_write_data(const unsigned char* p_bytes, int count)
397 395
398int lcd_remote_default_contrast(void) 396int lcd_remote_default_contrast(void)
399{ 397{
400 return LCD_REMOTE_DEFAULT_CONTRAST; 398 return DEFAULT_REMOTE_CONTRAST_SETTING;
401} 399}
402 400
403#ifndef SIMULATOR 401#ifndef SIMULATOR
diff --git a/firmware/export/config-h100.h b/firmware/export/config-h100.h
index aacb30dd44..71baa83100 100644
--- a/firmware/export/config-h100.h
+++ b/firmware/export/config-h100.h
@@ -50,6 +50,8 @@
50 50
51#define CONFIG_LCD LCD_S1D15E06 51#define CONFIG_LCD LCD_S1D15E06
52 52
53#define DEFAULT_REMOTE_CONTRAST_SETTING 42
54
53/* Define this for LCD backlight available */ 55/* Define this for LCD backlight available */
54#define CONFIG_BACKLIGHT BL_IRIVER_H100 /* port controlled */ 56#define CONFIG_BACKLIGHT BL_IRIVER_H100 /* port controlled */
55 57
diff --git a/firmware/export/config-h120.h b/firmware/export/config-h120.h
index 79ad613968..e6aa822376 100644
--- a/firmware/export/config-h120.h
+++ b/firmware/export/config-h120.h
@@ -46,6 +46,8 @@
46 46
47#define CONFIG_LCD LCD_S1D15E06 47#define CONFIG_LCD LCD_S1D15E06
48 48
49#define DEFAULT_REMOTE_CONTRAST_SETTING 42
50
49/* Define this for LCD backlight available */ 51/* Define this for LCD backlight available */
50#define CONFIG_BACKLIGHT BL_IRIVER_H100 /* port controlled */ 52#define CONFIG_BACKLIGHT BL_IRIVER_H100 /* port controlled */
51 53
diff --git a/firmware/export/config-iaudiox5.h b/firmware/export/config-iaudiox5.h
index c3cd157781..83f0767723 100644
--- a/firmware/export/config-iaudiox5.h
+++ b/firmware/export/config-iaudiox5.h
@@ -47,10 +47,16 @@
47 47
48#define CONFIG_LCD LCD_X5 48#define CONFIG_LCD LCD_X5
49 49
50/* Main LCD contrast range and defaults */
50#define MIN_CONTRAST_SETTING 1 51#define MIN_CONTRAST_SETTING 1
51#define MAX_CONTRAST_SETTING 30 52#define MAX_CONTRAST_SETTING 30
52#define DEFAULT_CONTRAST_SETTING 19 /* Match boot contrast */ 53#define DEFAULT_CONTRAST_SETTING 19 /* Match boot contrast */
53 54
55/* Remote LCD contrast range and defaults */
56#define MIN_REMOTE_CONTRAST_SETTING 10
57#define MAX_REMOTE_CONTRAST_SETTING 35
58#define DEFAULT_REMOTE_CONTRAST_SETTING 24 /* Match boot contrast */
59
54/* Define this for LCD backlight available */ 60/* Define this for LCD backlight available */
55#define CONFIG_BACKLIGHT BL_X5 /* PCF50606 I2C */ 61#define CONFIG_BACKLIGHT BL_X5 /* PCF50606 I2C */
56#define HAVE_BACKLIGHT_BRIGHTNESS 62#define HAVE_BACKLIGHT_BRIGHTNESS
diff --git a/firmware/target/coldfire/iaudio/x5/lcd-remote-x5.c b/firmware/target/coldfire/iaudio/x5/lcd-remote-x5.c
index 46e1eba1fd..6e3bb01a15 100755
--- a/firmware/target/coldfire/iaudio/x5/lcd-remote-x5.c
+++ b/firmware/target/coldfire/iaudio/x5/lcd-remote-x5.c
@@ -51,12 +51,10 @@
51#define RS_LO and_l(~0x00008000, &GPIO_OUT) 51#define RS_LO and_l(~0x00008000, &GPIO_OUT)
52#define RS_HI or_l(0x00008000, &GPIO_OUT) 52#define RS_HI or_l(0x00008000, &GPIO_OUT)
53 53
54#define LCD_REMOTE_DEFAULT_CONTRAST 0x18;
55
56/* cached settings values */ 54/* cached settings values */
57static bool cached_invert = false; 55static bool cached_invert = false;
58static bool cached_flip = false; 56static bool cached_flip = false;
59static int cached_contrast = LCD_REMOTE_DEFAULT_CONTRAST; 57static int cached_contrast = DEFAULT_REMOTE_CONTRAST_SETTING;
60 58
61bool remote_initialized = false; 59bool remote_initialized = false;
62 60
@@ -294,7 +292,7 @@ void lcd_remote_write_data(const unsigned char* p_bytes, int count)
294 292
295int lcd_remote_default_contrast(void) 293int lcd_remote_default_contrast(void)
296{ 294{
297 return LCD_REMOTE_DEFAULT_CONTRAST; 295 return DEFAULT_REMOTE_CONTRAST_SETTING;
298} 296}
299 297
300void lcd_remote_powersave(bool on) 298void lcd_remote_powersave(bool on)
@@ -309,6 +307,11 @@ void lcd_remote_powersave(bool on)
309 307
310void lcd_remote_set_contrast(int val) 308void lcd_remote_set_contrast(int val)
311{ 309{
310 if (val < 0)
311 val = 0;
312 else if (val > 63)
313 val = 63;
314
312 cached_contrast = val; 315 cached_contrast = val;
313 if(remote_initialized) 316 if(remote_initialized)
314 lcd_remote_write_command_ex(LCD_SET_VOLUME, val); 317 lcd_remote_write_command_ex(LCD_SET_VOLUME, val);