From c657763a23797238b4f95f7d52ac4902fd05f306 Mon Sep 17 00:00:00 2001 From: Rani Hod Date: Sun, 23 Jul 2006 22:18:32 +0000 Subject: [PATCH] Accepted FS #5474 by yours truly. Save your settings; CONFIG_BLOCK_VERSION is increased. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10303 a1c6a512-1295-4272-9138-f99709370657 --- apps/settings.c | 6 +++--- apps/settings.h | 7 ++++++- apps/settings_menu.c | 10 +++++----- firmware/backlight.c | 2 +- firmware/export/config-iaudiox5.h | 3 ++- firmware/target/coldfire/iaudio/x5/lcd-x5.c | 11 ++++++++--- 6 files changed, 25 insertions(+), 14 deletions(-) diff --git a/apps/settings.c b/apps/settings.c index 8846fa4bcf..4dbd2bf3ac 100644 --- a/apps/settings.c +++ b/apps/settings.c @@ -94,7 +94,7 @@ const char rec_base_directory[] = REC_BASE_DIR; #include "dsp.h" #endif -#define CONFIG_BLOCK_VERSION 47 +#define CONFIG_BLOCK_VERSION 48 #define CONFIG_BLOCK_SIZE 512 #define RTC_BLOCK_SIZE 44 @@ -1260,7 +1260,7 @@ void settings_load(int which) } if ( global_settings.contrast < MIN_CONTRAST_SETTING ) - global_settings.contrast = lcd_default_contrast(); + global_settings.contrast = DEFAULT_CONTRAST_SETTING; i = 0xb8; strncpy((char *)global_settings.wps_file, (char *)&config_block[i], @@ -1722,7 +1722,7 @@ void settings_reset(void) { global_settings.mdb_enable = sound_default(SOUND_MDB_ENABLE); global_settings.superbass = sound_default(SOUND_SUPERBASS); #endif - global_settings.contrast = lcd_default_contrast(); + global_settings.contrast = DEFAULT_CONTRAST_SETTING; #ifdef HAVE_LCD_REMOTE global_settings.remote_contrast = lcd_remote_default_contrast(); #endif diff --git a/apps/settings.h b/apps/settings.h index 8c47c9253e..51eaca3a51 100644 --- a/apps/settings.h +++ b/apps/settings.h @@ -570,6 +570,11 @@ extern const char rec_base_directory[]; /* system defines */ +#ifdef IAUDIO_X5 +#define MIN_CONTRAST_SETTING 0 +#define MAX_CONTRAST_SETTING 29 +#define DEFAULT_CONTRAST_SETTING 15 +#else #ifdef HAVE_LCD_CHARCELLS #define MAX_CONTRAST_SETTING 31 #define DEFAULT_CONTRAST_SETTING 30 @@ -578,7 +583,7 @@ extern const char rec_base_directory[]; #define DEFAULT_CONTRAST_SETTING 38 #endif #define MIN_CONTRAST_SETTING 5 - +#endif // X5 /* argument bits for settings_load() */ #define SETTINGS_RTC 1 /* only the settings from the RTC nonvolatile RAM */ diff --git a/apps/settings_menu.c b/apps/settings_menu.c index 3e02727f9e..f088c3be3d 100644 --- a/apps/settings_menu.c +++ b/apps/settings_menu.c @@ -266,7 +266,7 @@ static bool remote_caption_backlight(void) } #endif /* HAVE_REMOTE_LCD */ -#ifndef HAVE_LCD_COLOR +#if !defined(HAVE_LCD_COLOR) || defined(IAUDIO_X5) static bool contrast(void) { return set_int( str(LANG_CONTRAST), "", UNIT_INT, @@ -1775,13 +1775,13 @@ static bool lcd_settings_menu(void) #if defined(HAVE_BACKLIGHT_PWM_FADING) && !defined(SIMULATOR) { ID2P(LANG_BACKLIGHT_FADE_IN), backlight_fade_in }, { ID2P(LANG_BACKLIGHT_FADE_OUT), backlight_fade_out }, -#endif -#ifdef HAVE_BACKLIGHT_BRIGHTNESS - { ID2P(LANG_BRIGHTNESS), brightness }, #endif { ID2P(LANG_BACKLIGHT_FILTER_FIRST_KEYPRESS), set_bl_filter_first_keypress }, +#ifdef HAVE_BACKLIGHT_BRIGHTNESS + { ID2P(LANG_BRIGHTNESS), brightness }, +#endif #endif /* CONFIG_BACKLIGHT */ -#ifndef HAVE_LCD_COLOR +#if !defined(HAVE_LCD_COLOR) || defined(IAUDIO_X5) { ID2P(LANG_CONTRAST), contrast }, #endif #ifdef HAVE_LCD_BITMAP diff --git a/firmware/backlight.c b/firmware/backlight.c index 76ffc6f0e4..8568c98829 100644 --- a/firmware/backlight.c +++ b/firmware/backlight.c @@ -655,7 +655,7 @@ bool is_remote_backlight_on(void) {return true;} #endif /* #ifdef CONFIG_BACKLIGHT */ #ifdef HAVE_BACKLIGHT_BRIGHTNESS -#ifdef IRIVER_H300_SERIES +#if defined(IRIVER_H300_SERIES) || defined(IAUDIO_X5) void backlight_set_brightness(int val) { /* set H300 brightness by changing the PWM diff --git a/firmware/export/config-iaudiox5.h b/firmware/export/config-iaudiox5.h index a04967c455..7ce230ee8e 100644 --- a/firmware/export/config-iaudiox5.h +++ b/firmware/export/config-iaudiox5.h @@ -42,7 +42,8 @@ #define CONFIG_LCD LCD_X5 /* Define this for LCD backlight available */ -#define CONFIG_BACKLIGHT BL_IRIVER_H100 /* port controlled */ +#define CONFIG_BACKLIGHT BL_IRIVER_H100 /* port controlled !?!? */ +#define HAVE_BACKLIGHT_BRIGHTNESS /* Define this if you have a software controlled poweroff */ #define HAVE_SW_POWEROFF diff --git a/firmware/target/coldfire/iaudio/x5/lcd-x5.c b/firmware/target/coldfire/iaudio/x5/lcd-x5.c index 75ec2462be..1adcf6aaea 100755 --- a/firmware/target/coldfire/iaudio/x5/lcd-x5.c +++ b/firmware/target/coldfire/iaudio/x5/lcd-x5.c @@ -38,8 +38,8 @@ static bool display_on=false; /* is the display turned on? */ /* register defines for the Renesas HD66773R */ #define R_HORIZ_RAM_ADDR_POS 0x16 #define R_VERT_RAM_ADDR_POS 0x17 -#define R_RAM_ADDR_SET 0x21 -#define R_WRITE_DATA_2_GRAM 0x22 +#define R_RAM_ADDR_SET 0x21 +#define R_WRITE_DATA_2_GRAM 0x22 /***************************************************** The table below was generated by the following script: @@ -139,7 +139,12 @@ inline void lcd_write_data(const unsigned short* p_bytes, int count) void lcd_set_contrast(int val) { - (void)val; + if (val >= 15) // val must'nt be 15 or 31 + ++val; + if (val > 30) + return; + + lcd_write_reg(0x0e, 0x201e + (val << 8)); } void lcd_set_invert_display(bool yesno)