diff options
-rw-r--r-- | apps/settings.c | 17 | ||||
-rw-r--r-- | firmware/drivers/lcd-player.c | 7 | ||||
-rw-r--r-- | firmware/drivers/lcd-recorder.c | 41 | ||||
-rw-r--r-- | firmware/export/lcd.h | 1 |
4 files changed, 34 insertions, 32 deletions
diff --git a/apps/settings.c b/apps/settings.c index 8a98010a5c..06a44a34cc 100644 --- a/apps/settings.c +++ b/apps/settings.c | |||
@@ -542,19 +542,6 @@ void settings_apply(void) | |||
542 | } | 542 | } |
543 | } | 543 | } |
544 | 544 | ||
545 | static int default_contrast(void) | ||
546 | { | ||
547 | #ifdef SIMULATOR | ||
548 | return 30; | ||
549 | #else | ||
550 | #ifdef HAVE_LCD_CHARCELLS | ||
551 | return 30; | ||
552 | #else | ||
553 | return (read_hw_mask() & LCD_CONTRAST_BIAS) ? 31 : 49; | ||
554 | #endif | ||
555 | #endif | ||
556 | } | ||
557 | |||
558 | /* | 545 | /* |
559 | * load settings from disk or RTC RAM | 546 | * load settings from disk or RTC RAM |
560 | */ | 547 | */ |
@@ -587,7 +574,7 @@ void settings_load(void) | |||
587 | global_settings.invert = | 574 | global_settings.invert = |
588 | config_block[0xa] & 0x40 ? true : false; | 575 | config_block[0xa] & 0x40 ? true : false; |
589 | if ( global_settings.contrast < MIN_CONTRAST_SETTING ) | 576 | if ( global_settings.contrast < MIN_CONTRAST_SETTING ) |
590 | global_settings.contrast = default_contrast(); | 577 | global_settings.contrast = lcd_default_contrast(); |
591 | global_settings.show_icons = | 578 | global_settings.show_icons = |
592 | config_block[0xa] & 0x80 ? true : false; | 579 | config_block[0xa] & 0x80 ? true : false; |
593 | } | 580 | } |
@@ -1414,7 +1401,7 @@ void settings_reset(void) { | |||
1414 | global_settings.rec_right_gain = 2; /* 0dB */ | 1401 | global_settings.rec_right_gain = 2; /* 0dB */ |
1415 | global_settings.rec_editable = false; | 1402 | global_settings.rec_editable = false; |
1416 | global_settings.resume = RESUME_ASK; | 1403 | global_settings.resume = RESUME_ASK; |
1417 | global_settings.contrast = default_contrast(); | 1404 | global_settings.contrast = lcd_default_contrast(); |
1418 | global_settings.invert = DEFAULT_INVERT_SETTING; | 1405 | global_settings.invert = DEFAULT_INVERT_SETTING; |
1419 | global_settings.poweroff = DEFAULT_POWEROFF_SETTING; | 1406 | global_settings.poweroff = DEFAULT_POWEROFF_SETTING; |
1420 | global_settings.backlight_timeout = DEFAULT_BACKLIGHT_TIMEOUT_SETTING; | 1407 | global_settings.backlight_timeout = DEFAULT_BACKLIGHT_TIMEOUT_SETTING; |
diff --git a/firmware/drivers/lcd-player.c b/firmware/drivers/lcd-player.c index 6f58f8ec1a..bbb157a94f 100644 --- a/firmware/drivers/lcd-player.c +++ b/firmware/drivers/lcd-player.c | |||
@@ -278,6 +278,11 @@ bool lcdx_putc(int x, int y, unsigned short ch) | |||
278 | return false; | 278 | return false; |
279 | } | 279 | } |
280 | 280 | ||
281 | int lcd_default_contrast(void) | ||
282 | { | ||
283 | return 30; | ||
284 | } | ||
285 | |||
281 | void lcd_clear_display(void) | 286 | void lcd_clear_display(void) |
282 | { | 287 | { |
283 | int i; | 288 | int i; |
@@ -497,6 +502,8 @@ void lcd_init (void) | |||
497 | pattern_size=3; /* Last pattern, 3 for old LCD, 7 for new LCD */ | 502 | pattern_size=3; /* Last pattern, 3 for old LCD, 7 for new LCD */ |
498 | } | 503 | } |
499 | 504 | ||
505 | lcd_set_contrast(lcd_default_contrast()); | ||
506 | |||
500 | create_thread(scroll_thread, scroll_stack, | 507 | create_thread(scroll_thread, scroll_stack, |
501 | sizeof(scroll_stack), scroll_name); | 508 | sizeof(scroll_stack), scroll_name); |
502 | } | 509 | } |
diff --git a/firmware/drivers/lcd-recorder.c b/firmware/drivers/lcd-recorder.c index 00b4ed78b2..597c7d246a 100644 --- a/firmware/drivers/lcd-recorder.c +++ b/firmware/drivers/lcd-recorder.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include "debug.h" | 29 | #include "debug.h" |
30 | #include "system.h" | 30 | #include "system.h" |
31 | #include "font.h" | 31 | #include "font.h" |
32 | #include "hwcompat.h" | ||
32 | 33 | ||
33 | /*** definitions ***/ | 34 | /*** definitions ***/ |
34 | 35 | ||
@@ -113,6 +114,15 @@ static unsigned char zeros[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; | |||
113 | static unsigned char ones[8] = { 0xff, 0xff, 0xff, 0xff, | 114 | static unsigned char ones[8] = { 0xff, 0xff, 0xff, 0xff, |
114 | 0xff, 0xff, 0xff, 0xff}; | 115 | 0xff, 0xff, 0xff, 0xff}; |
115 | 116 | ||
117 | int lcd_default_contrast(void) | ||
118 | { | ||
119 | #ifdef SIMULATOR | ||
120 | return 30; | ||
121 | #else | ||
122 | return (read_hw_mask() & LCD_CONTRAST_BIAS) ? 31 : 49; | ||
123 | #endif | ||
124 | } | ||
125 | |||
116 | #ifdef SIMULATOR | 126 | #ifdef SIMULATOR |
117 | 127 | ||
118 | void lcd_init(void) | 128 | void lcd_init(void) |
@@ -132,23 +142,20 @@ void lcd_init (void) | |||
132 | PBCR2 &= 0xff00; /* MD = 00 */ | 142 | PBCR2 &= 0xff00; /* MD = 00 */ |
133 | PBIOR |= 0x000f; /* IOR = 1 */ | 143 | PBIOR |= 0x000f; /* IOR = 1 */ |
134 | 144 | ||
135 | /* inits like the original firmware */ | 145 | /* inits like the original firmware */ |
136 | lcd_write(true, LCD_SOFTWARE_RESET); | 146 | lcd_write(true, LCD_SOFTWARE_RESET); |
137 | lcd_write(true, LCD_SET_INTERNAL_REGULATOR_RESISTOR_RATIO + 4); | 147 | lcd_write(true, LCD_SET_INTERNAL_REGULATOR_RESISTOR_RATIO + 4); |
138 | lcd_write(true, LCD_SET_1OVER4_BIAS_RATIO + 0); /* force 1/4 bias: 0 */ | 148 | lcd_write(true, LCD_SET_1OVER4_BIAS_RATIO + 0); /* force 1/4 bias: 0 */ |
139 | lcd_write(true, LCD_SET_POWER_CONTROL_REGISTER + 7); /* power control register: op-amp=1, regulator=1, booster=1 */ | 149 | lcd_write(true, LCD_SET_POWER_CONTROL_REGISTER + 7); /* power control register: op-amp=1, regulator=1, booster=1 */ |
140 | lcd_write(true, LCD_SET_DISPLAY_ON); | 150 | lcd_write(true, LCD_SET_DISPLAY_ON); |
141 | lcd_write(true, LCD_SET_NORMAL_DISPLAY); | 151 | lcd_write(true, LCD_SET_NORMAL_DISPLAY); |
142 | lcd_write(true, LCD_SET_SEGMENT_REMAP + 1); /* mirror horizontal: 1 */ | 152 | lcd_write(true, LCD_SET_SEGMENT_REMAP + 1); /* mirror horizontal: 1 */ |
143 | lcd_write(true, LCD_SET_COM_OUTPUT_SCAN_DIRECTION + 8); /* mirror vertical: 1 */ | 153 | lcd_write(true, LCD_SET_COM_OUTPUT_SCAN_DIRECTION + 8); /* mirror vertical: 1 */ |
144 | lcd_write(true, LCD_SET_DISPLAY_START_LINE + 0); | 154 | lcd_write(true, LCD_SET_DISPLAY_START_LINE + 0); |
145 | #if 0 /* done later, depending on h/w mask bit and settings */ | 155 | lcd_set_contrast(lcd_default_contrast()); |
146 | lcd_write(true, LCD_SET_CONTRAST_CONTROL_REGISTER); | 156 | lcd_write(true, LCD_SET_PAGE_ADDRESS); |
147 | lcd_write(true, 0xF1); /* contrast set to 49/64 */ | 157 | lcd_write(true, LCD_SET_LOWER_COLUMN_ADDRESS + 0); |
148 | #endif | 158 | lcd_write(true, LCD_SET_HIGHER_COLUMN_ADDRESS + 0); |
149 | lcd_write(true, LCD_SET_PAGE_ADDRESS); | ||
150 | lcd_write(true, LCD_SET_LOWER_COLUMN_ADDRESS + 0); | ||
151 | lcd_write(true, LCD_SET_HIGHER_COLUMN_ADDRESS + 0); | ||
152 | 159 | ||
153 | lcd_clear_display(); | 160 | lcd_clear_display(); |
154 | lcd_update(); | 161 | lcd_update(); |
diff --git a/firmware/export/lcd.h b/firmware/export/lcd.h index 0818f9d92e..3f3ea972c3 100644 --- a/firmware/export/lcd.h +++ b/firmware/export/lcd.h | |||
@@ -44,6 +44,7 @@ extern void lcd_scroll_speed( int speed ); | |||
44 | extern void lcd_scroll_delay( int ms ); | 44 | extern void lcd_scroll_delay( int ms ); |
45 | extern void lcd_set_contrast(int val); | 45 | extern void lcd_set_contrast(int val); |
46 | extern void lcd_write( bool command, int byte ); | 46 | extern void lcd_write( bool command, int byte ); |
47 | extern int lcd_default_contrast(void); | ||
47 | 48 | ||
48 | #if defined(SIMULATOR) || defined(HAVE_LCD_BITMAP) | 49 | #if defined(SIMULATOR) || defined(HAVE_LCD_BITMAP) |
49 | extern void lcd_update(void); | 50 | extern void lcd_update(void); |