summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2004-10-15 20:30:29 +0000
committerJens Arnold <amiconn@rockbox.org>2004-10-15 20:30:29 +0000
commit566eae2e119f3c57b1df0782ddcc29fccedbf816 (patch)
treefc8cced8cd199734b2185a20efdfd2ebbcce41bb
parent672305f0a1fe8e423904f95d5cb22aea68ff4c62 (diff)
downloadrockbox-566eae2e119f3c57b1df0782ddcc29fccedbf816.tar.gz
rockbox-566eae2e119f3c57b1df0782ddcc29fccedbf816.zip
Logarithmic scroll speed setting: speed doubles every 3 steps.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5288 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/settings.c4
-rw-r--r--apps/settings_menu.c6
-rw-r--r--firmware/drivers/lcd-player.c14
-rw-r--r--firmware/drivers/lcd-recorder.c12
4 files changed, 24 insertions, 12 deletions
diff --git a/apps/settings.c b/apps/settings.c
index bbb37db3f1..4bb9adbc81 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -71,7 +71,7 @@ const char rec_base_directory[] = REC_BASE_DIR;
71 71
72 72
73 73
74#define CONFIG_BLOCK_VERSION 17 74#define CONFIG_BLOCK_VERSION 18
75#define CONFIG_BLOCK_SIZE 512 75#define CONFIG_BLOCK_SIZE 512
76#define RTC_BLOCK_SIZE 44 76#define RTC_BLOCK_SIZE 44
77 77
@@ -250,7 +250,7 @@ static const struct bit_entry hd_bits[] =
250#ifdef HAVE_BACKLIGHT 250#ifdef HAVE_BACKLIGHT
251 {1, S_O(caption_backlight), false, "caption backlight", off_on }, 251 {1, S_O(caption_backlight), false, "caption backlight", off_on },
252#endif 252#endif
253 {5, S_O(scroll_speed), 8, "scroll speed", NULL }, /* 1...25 */ 253 {4, S_O(scroll_speed), 9, "scroll speed", NULL }, /* 0...15 */
254 {7, S_O(scroll_step), 6, "scroll step", NULL }, /* 1...112 */ 254 {7, S_O(scroll_step), 6, "scroll step", NULL }, /* 1...112 */
255 {8, S_O(scroll_delay), 100, "scroll delay", NULL }, /* 0...250 */ 255 {8, S_O(scroll_delay), 100, "scroll delay", NULL }, /* 0...250 */
256 {8, S_O(bidir_limit), 50, "bidir limit", NULL }, /* 0...200 */ 256 {8, S_O(bidir_limit), 50, "bidir limit", NULL }, /* 0...200 */
diff --git a/apps/settings_menu.c b/apps/settings_menu.c
index 8877818d43..9ddf4c499b 100644
--- a/apps/settings_menu.c
+++ b/apps/settings_menu.c
@@ -636,9 +636,9 @@ static bool poweroff_idle_timer(void)
636 636
637static bool scroll_speed(void) 637static bool scroll_speed(void)
638{ 638{
639 return set_int(str(LANG_SCROLL), "Hz", UNIT_HERTZ, 639 return set_int(str(LANG_SCROLL), "", UNIT_INT,
640 &global_settings.scroll_speed, 640 &global_settings.scroll_speed,
641 &lcd_scroll_speed, 1, 1, 25 ); 641 &lcd_scroll_speed, 1, 0, 15 );
642} 642}
643 643
644 644
diff --git a/firmware/drivers/lcd-player.c b/firmware/drivers/lcd-player.c
index 01d7cfdb6e..8dd97cac0a 100644
--- a/firmware/drivers/lcd-player.c
+++ b/firmware/drivers/lcd-player.c
@@ -88,7 +88,7 @@ struct cursorinfo {
88static void scroll_thread(void); 88static void scroll_thread(void);
89static char scroll_stack[DEFAULT_STACK_SIZE]; 89static char scroll_stack[DEFAULT_STACK_SIZE];
90static const char scroll_name[] = "scroll"; 90static const char scroll_name[] = "scroll";
91static char scroll_speed = 8; /* updates per second */ 91static char scroll_ticks = 12; /* # of ticks between updates */
92static int scroll_delay = HZ/2; /* delay before starting scroll */ 92static int scroll_delay = HZ/2; /* delay before starting scroll */
93static int jump_scroll_delay = HZ/4; /* delay between jump scroll jumps */ 93static int jump_scroll_delay = HZ/4; /* delay between jump scroll jumps */
94static char scroll_spacing = 3; /* spaces between end and start of text */ 94static char scroll_spacing = 3; /* spaces between end and start of text */
@@ -547,7 +547,7 @@ void lcd_puts_scroll(int x, int y, const unsigned char* string )
547 s->direction=+1; 547 s->direction=+1;
548 s->jump_scroll=0; 548 s->jump_scroll=0;
549 s->jump_scroll_steps=0; 549 s->jump_scroll_steps=0;
550 if (jump_scroll && jump_scroll_delay<(HZ/scroll_speed)*(s->textlen-11+x)) { 550 if (jump_scroll && jump_scroll_delay<scroll_ticks*(s->textlen-11+x)) {
551 s->jump_scroll_steps=11-x; 551 s->jump_scroll_steps=11-x;
552 s->jump_scroll=jump_scroll; 552 s->jump_scroll=jump_scroll;
553 } 553 }
@@ -593,9 +593,15 @@ void lcd_allow_bidirectional_scrolling(bool on)
593 allow_bidirectional_scrolling=on; 593 allow_bidirectional_scrolling=on;
594} 594}
595 595
596static const char scroll_tick_table[16] = {
597 /* Hz values:
598 1, 1.25, 1.55, 2, 2.5, 3.12, 4, 5, 6.25, 8.33, 10, 12.5, 16.7, 20, 25, 33 */
599 100, 80, 64, 50, 40, 32, 25, 20, 16, 12, 10, 8, 6, 5, 4, 3
600};
601
596void lcd_scroll_speed(int speed) 602void lcd_scroll_speed(int speed)
597{ 603{
598 scroll_speed = speed; 604 scroll_ticks = scroll_tick_table[speed];
599} 605}
600 606
601void lcd_scroll_delay(int ms) 607void lcd_scroll_delay(int ms)
@@ -723,7 +729,7 @@ static void scroll_thread(void)
723 } 729 }
724 } 730 }
725 731
726 sleep(HZ/scroll_speed); 732 sleep(scroll_ticks);
727 } 733 }
728} 734}
729 735
diff --git a/firmware/drivers/lcd-recorder.c b/firmware/drivers/lcd-recorder.c
index a711a8fa6d..8f8e9f9332 100644
--- a/firmware/drivers/lcd-recorder.c
+++ b/firmware/drivers/lcd-recorder.c
@@ -94,7 +94,7 @@ static volatile int scrolling_lines=0; /* Bitpattern of which lines are scrollin
94static void scroll_thread(void); 94static void scroll_thread(void);
95static char scroll_stack[DEFAULT_STACK_SIZE]; 95static char scroll_stack[DEFAULT_STACK_SIZE];
96static const char scroll_name[] = "scroll"; 96static const char scroll_name[] = "scroll";
97static char scroll_speed = 8; /* updates per second */ 97static char scroll_ticks = 12; /* # of ticks between updates*/
98static int scroll_delay = HZ/2; /* ticks delay before start */ 98static int scroll_delay = HZ/2; /* ticks delay before start */
99static char scroll_step = 6; /* pixels per scroll step */ 99static char scroll_step = 6; /* pixels per scroll step */
100static int bidir_limit = 50; /* percent */ 100static int bidir_limit = 50; /* percent */
@@ -856,9 +856,15 @@ void lcd_stop_scroll(void)
856 scrolling_lines=0; 856 scrolling_lines=0;
857} 857}
858 858
859static const char scroll_tick_table[16] = {
860 /* Hz values:
861 1, 1.25, 1.55, 2, 2.5, 3.12, 4, 5, 6.25, 8.33, 10, 12.5, 16.7, 20, 25, 33 */
862 100, 80, 64, 50, 40, 32, 25, 20, 16, 12, 10, 8, 6, 5, 4, 3
863};
864
859void lcd_scroll_speed(int speed) 865void lcd_scroll_speed(int speed)
860{ 866{
861 scroll_speed = speed; 867 scroll_ticks = scroll_tick_table[speed];
862} 868}
863 869
864void lcd_scroll_step(int step) 870void lcd_scroll_step(int step)
@@ -933,7 +939,7 @@ static void scroll_thread(void)
933 lcd_update_rect(xpos, ypos, LCD_WIDTH - xpos, pf->height); 939 lcd_update_rect(xpos, ypos, LCD_WIDTH - xpos, pf->height);
934 } 940 }
935 941
936 sleep(HZ/scroll_speed); 942 sleep(scroll_ticks);
937 } 943 }
938} 944}
939 945