1
0
Fork 0
forked from len0rd/rockbox

Logarithmic scroll speed setting: speed doubles every 3 steps.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5288 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jens Arnold 2004-10-15 20:30:29 +00:00
parent 672305f0a1
commit 566eae2e11
4 changed files with 24 additions and 12 deletions

View file

@ -71,7 +71,7 @@ const char rec_base_directory[] = REC_BASE_DIR;
#define CONFIG_BLOCK_VERSION 17
#define CONFIG_BLOCK_VERSION 18
#define CONFIG_BLOCK_SIZE 512
#define RTC_BLOCK_SIZE 44
@ -250,7 +250,7 @@ static const struct bit_entry hd_bits[] =
#ifdef HAVE_BACKLIGHT
{1, S_O(caption_backlight), false, "caption backlight", off_on },
#endif
{5, S_O(scroll_speed), 8, "scroll speed", NULL }, /* 1...25 */
{4, S_O(scroll_speed), 9, "scroll speed", NULL }, /* 0...15 */
{7, S_O(scroll_step), 6, "scroll step", NULL }, /* 1...112 */
{8, S_O(scroll_delay), 100, "scroll delay", NULL }, /* 0...250 */
{8, S_O(bidir_limit), 50, "bidir limit", NULL }, /* 0...200 */

View file

@ -636,9 +636,9 @@ static bool poweroff_idle_timer(void)
static bool scroll_speed(void)
{
return set_int(str(LANG_SCROLL), "Hz", UNIT_HERTZ,
return set_int(str(LANG_SCROLL), "", UNIT_INT,
&global_settings.scroll_speed,
&lcd_scroll_speed, 1, 1, 25 );
&lcd_scroll_speed, 1, 0, 15 );
}

View file

@ -88,7 +88,7 @@ struct cursorinfo {
static void scroll_thread(void);
static char scroll_stack[DEFAULT_STACK_SIZE];
static const char scroll_name[] = "scroll";
static char scroll_speed = 8; /* updates per second */
static char scroll_ticks = 12; /* # of ticks between updates */
static int scroll_delay = HZ/2; /* delay before starting scroll */
static int jump_scroll_delay = HZ/4; /* delay between jump scroll jumps */
static 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 )
s->direction=+1;
s->jump_scroll=0;
s->jump_scroll_steps=0;
if (jump_scroll && jump_scroll_delay<(HZ/scroll_speed)*(s->textlen-11+x)) {
if (jump_scroll && jump_scroll_delay<scroll_ticks*(s->textlen-11+x)) {
s->jump_scroll_steps=11-x;
s->jump_scroll=jump_scroll;
}
@ -593,9 +593,15 @@ void lcd_allow_bidirectional_scrolling(bool on)
allow_bidirectional_scrolling=on;
}
static const char scroll_tick_table[16] = {
/* Hz values:
1, 1.25, 1.55, 2, 2.5, 3.12, 4, 5, 6.25, 8.33, 10, 12.5, 16.7, 20, 25, 33 */
100, 80, 64, 50, 40, 32, 25, 20, 16, 12, 10, 8, 6, 5, 4, 3
};
void lcd_scroll_speed(int speed)
{
scroll_speed = speed;
scroll_ticks = scroll_tick_table[speed];
}
void lcd_scroll_delay(int ms)
@ -723,7 +729,7 @@ static void scroll_thread(void)
}
}
sleep(HZ/scroll_speed);
sleep(scroll_ticks);
}
}

View file

@ -94,7 +94,7 @@ static volatile int scrolling_lines=0; /* Bitpattern of which lines are scrollin
static void scroll_thread(void);
static char scroll_stack[DEFAULT_STACK_SIZE];
static const char scroll_name[] = "scroll";
static char scroll_speed = 8; /* updates per second */
static char scroll_ticks = 12; /* # of ticks between updates*/
static int scroll_delay = HZ/2; /* ticks delay before start */
static char scroll_step = 6; /* pixels per scroll step */
static int bidir_limit = 50; /* percent */
@ -856,9 +856,15 @@ void lcd_stop_scroll(void)
scrolling_lines=0;
}
static const char scroll_tick_table[16] = {
/* Hz values:
1, 1.25, 1.55, 2, 2.5, 3.12, 4, 5, 6.25, 8.33, 10, 12.5, 16.7, 20, 25, 33 */
100, 80, 64, 50, 40, 32, 25, 20, 16, 12, 10, 8, 6, 5, 4, 3
};
void lcd_scroll_speed(int speed)
{
scroll_speed = speed;
scroll_ticks = scroll_tick_table[speed];
}
void lcd_scroll_step(int step)
@ -933,7 +939,7 @@ static void scroll_thread(void)
lcd_update_rect(xpos, ypos, LCD_WIDTH - xpos, pf->height);
}
sleep(HZ/scroll_speed);
sleep(scroll_ticks);
}
}