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.zip
rockbox-e63649279186e119614b9ca892bcfa27e6af8337.tar.gz
rockbox-e63649279186e119614b9ca892bcfa27e6af8337.tar.bz2
rockbox-e63649279186e119614b9ca892bcfa27e6af8337.tar.xz
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 4746c22..ee7fa36 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -302,7 +302,8 @@ static const struct bit_entry rtc_bits[] =
#ifdef HAVE_REMOTE_LCD
/* remote lcd */
- {6, S_O(remote_contrast), 42, "remote contrast", NULL },
+ {6, S_O(remote_contrast), DEFAULT_REMOTE_CONTRAST_SETTING,
+ "remote contrast", NULL },
{1, S_O(remote_invert), false, "remote invert", off_on },
{1, S_O(remote_flip_display), false, "remote flip display", off_on },
{5, S_O(remote_backlight_timeout), 6, "remote backlight timeout",
@@ -1365,11 +1366,18 @@ void settings_load(int which)
#ifdef HAVE_RECORDING
global_settings.recscreen_on = false;
#endif
+
#ifdef HAVE_LCD_CONTRAST
- if ( global_settings.contrast < MIN_CONTRAST_SETTING )
+ if ( global_settings.contrast < MIN_CONTRAST_SETTING ||
+ global_settings.contrast > MAX_CONTRAST_SETTING )
global_settings.contrast = lcd_default_contrast();
#endif
+#ifdef HAVE_LCD_REMOTE
+ if (global_settings.remote_contrast < MIN_REMOTE_CONTRAST_SETTING ||
+ global_settings.remote_contrast > MAX_REMOTE_CONTRAST_SETTING )
+ global_settings.remote_contrast = lcd_remote_default_contrast();
+#endif
i = 0xb8;
strncpy((char *)global_settings.wps_file, (char *)&config_block[i],
MAX_FILENAME);
diff --git a/apps/settings.h b/apps/settings.h
index 9f83724..3e0b8fc 100644
--- a/apps/settings.h
+++ b/apps/settings.h
@@ -108,7 +108,6 @@ extern unsigned char vp_dummy[VIRT_SIZE];
simplicity. */
#if !defined(HAVE_LCD_COLOR)
#define HAVE_LCD_CONTRAST
-#define DEFAULT_CONTRAST_SETTING 40
#endif
struct user_settings
@@ -545,6 +544,11 @@ extern const char rec_base_directory[];
/* system defines */
#ifndef TARGET_TREE
+
+#ifndef HAVE_LCD_COLOR
+#define DEFAULT_CONTRAST_SETTING 40
+#endif
+
#if defined HAVE_LCD_CHARCELLS
#define MIN_CONTRAST_SETTING 5
#define MAX_CONTRAST_SETTING 31
@@ -552,6 +556,17 @@ extern const char rec_base_directory[];
#define MIN_CONTRAST_SETTING 5
#define MAX_CONTRAST_SETTING 63
#endif
+
+/* As it was */
+#ifdef HAVE_REMOTE_LCD
+#ifndef DEFAULT_REMOTE_CONTRAST_SETTING
+/* May be defined in config file if driver code needs the value */
+#define DEFAULT_REMOTE_CONTRAST_SETTING 42
+#endif
+#define MIN_REMOTE_CONTRAST_SETTING MIN_CONTRAST_SETTING
+#define MAX_REMOTE_CONTRAST_SETTING MAX_CONTRAST_SETTING
+#endif
+
#endif /* !TARGET_TREE */
/* argument bits for settings_load() */
diff --git a/apps/settings_menu.c b/apps/settings_menu.c
index 36615cf..27fc565 100644
--- a/apps/settings_menu.c
+++ b/apps/settings_menu.c
@@ -124,8 +124,8 @@ static bool remote_contrast(void)
{
return set_int( str(LANG_CONTRAST), "", UNIT_INT,
&global_settings.remote_contrast,
- lcd_remote_set_contrast, 1, MIN_CONTRAST_SETTING,
- MAX_CONTRAST_SETTING, NULL );
+ lcd_remote_set_contrast, 1, MIN_REMOTE_CONTRAST_SETTING,
+ MAX_REMOTE_CONTRAST_SETTING, NULL );
}
static bool remote_invert(void)
diff --git a/firmware/drivers/lcd-h100-remote.c b/firmware/drivers/lcd-h100-remote.c
index a200c7b..75d42f8 100644
--- a/firmware/drivers/lcd-h100-remote.c
+++ b/firmware/drivers/lcd-h100-remote.c
@@ -73,8 +73,6 @@ static int xmargin = 0;
static int ymargin = 0;
static int curfont = FONT_SYSFIXED;
-#define LCD_REMOTE_DEFAULT_CONTRAST 42;
-
#ifndef SIMULATOR
static int xoffset; /* needed for flip */
@@ -99,7 +97,7 @@ static int _remote_type = REMOTETYPE_UNPLUGGED;
/* cached settings values */
static bool cached_invert = false;
static bool cached_flip = false;
-static int cached_contrast = LCD_REMOTE_DEFAULT_CONTRAST;
+static int cached_contrast = DEFAULT_REMOTE_CONTRAST_SETTING;
#endif
/* scrolling */
@@ -397,7 +395,7 @@ void lcd_remote_write_data(const unsigned char* p_bytes, int count)
int lcd_remote_default_contrast(void)
{
- return LCD_REMOTE_DEFAULT_CONTRAST;
+ return DEFAULT_REMOTE_CONTRAST_SETTING;
}
#ifndef SIMULATOR
diff --git a/firmware/export/config-h100.h b/firmware/export/config-h100.h
index aacb30d..71baa83 100644
--- a/firmware/export/config-h100.h
+++ b/firmware/export/config-h100.h
@@ -50,6 +50,8 @@
#define CONFIG_LCD LCD_S1D15E06
+#define DEFAULT_REMOTE_CONTRAST_SETTING 42
+
/* Define this for LCD backlight available */
#define CONFIG_BACKLIGHT BL_IRIVER_H100 /* port controlled */
diff --git a/firmware/export/config-h120.h b/firmware/export/config-h120.h
index 79ad613..e6aa822 100644
--- a/firmware/export/config-h120.h
+++ b/firmware/export/config-h120.h
@@ -46,6 +46,8 @@
#define CONFIG_LCD LCD_S1D15E06
+#define DEFAULT_REMOTE_CONTRAST_SETTING 42
+
/* Define this for LCD backlight available */
#define CONFIG_BACKLIGHT BL_IRIVER_H100 /* port controlled */
diff --git a/firmware/export/config-iaudiox5.h b/firmware/export/config-iaudiox5.h
index c3cd157..83f0767 100644
--- a/firmware/export/config-iaudiox5.h
+++ b/firmware/export/config-iaudiox5.h
@@ -47,10 +47,16 @@
#define CONFIG_LCD LCD_X5
+/* Main LCD contrast range and defaults */
#define MIN_CONTRAST_SETTING 1
#define MAX_CONTRAST_SETTING 30
#define DEFAULT_CONTRAST_SETTING 19 /* Match boot contrast */
+/* Remote LCD contrast range and defaults */
+#define MIN_REMOTE_CONTRAST_SETTING 10
+#define MAX_REMOTE_CONTRAST_SETTING 35
+#define DEFAULT_REMOTE_CONTRAST_SETTING 24 /* Match boot contrast */
+
/* Define this for LCD backlight available */
#define CONFIG_BACKLIGHT BL_X5 /* PCF50606 I2C */
#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 46e1eba..6e3bb01 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 @@
#define RS_LO and_l(~0x00008000, &GPIO_OUT)
#define RS_HI or_l(0x00008000, &GPIO_OUT)
-#define LCD_REMOTE_DEFAULT_CONTRAST 0x18;
-
/* cached settings values */
static bool cached_invert = false;
static bool cached_flip = false;
-static int cached_contrast = LCD_REMOTE_DEFAULT_CONTRAST;
+static int cached_contrast = DEFAULT_REMOTE_CONTRAST_SETTING;
bool remote_initialized = false;
@@ -294,7 +292,7 @@ void lcd_remote_write_data(const unsigned char* p_bytes, int count)
int lcd_remote_default_contrast(void)
{
- return LCD_REMOTE_DEFAULT_CONTRAST;
+ return DEFAULT_REMOTE_CONTRAST_SETTING;
}
void lcd_remote_powersave(bool on)
@@ -309,6 +307,11 @@ void lcd_remote_powersave(bool on)
void lcd_remote_set_contrast(int val)
{
+ if (val < 0)
+ val = 0;
+ else if (val > 63)
+ val = 63;
+
cached_contrast = val;
if(remote_initialized)
lcd_remote_write_command_ex(LCD_SET_VOLUME, val);