summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKjell Ericson <kjell@haxx.se>2003-01-10 12:23:36 +0000
committerKjell Ericson <kjell@haxx.se>2003-01-10 12:23:36 +0000
commitdc88e23700e93a83aa24e3a483be4177da1860fb (patch)
treeec45c1d8c598a665da0a189314ed0dcafe46f791
parentf2feb0a5d0b984acbeaeaea18e19cc02dd6d6226 (diff)
downloadrockbox-dc88e23700e93a83aa24e3a483be4177da1860fb.zip
rockbox-dc88e23700e93a83aa24e3a483be4177da1860fb.tar.gz
rockbox-dc88e23700e93a83aa24e3a483be4177da1860fb.tar.bz2
rockbox-dc88e23700e93a83aa24e3a483be4177da1860fb.tar.xz
Fixed the scroll_delay.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3062 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/drivers/lcd-player.c27
1 files changed, 10 insertions, 17 deletions
diff --git a/firmware/drivers/lcd-player.c b/firmware/drivers/lcd-player.c
index f98e210..6e7fe9d 100644
--- a/firmware/drivers/lcd-player.c
+++ b/firmware/drivers/lcd-player.c
@@ -69,16 +69,15 @@ struct scrollinfo {
int startx;
int starty;
int space;
+ long scroll_start_tick;
};
static void scroll_thread(void);
static char scroll_stack[DEFAULT_STACK_SIZE];
static char scroll_name[] = "scroll";
static char scroll_speed = 8; /* updates per second */
-static char scroll_delay = HZ/2; /* delay before starting scroll */
+static int scroll_delay = HZ/2; /* delay before starting scroll */
static char scroll_spacing = 3; /* spaces between end and start of text */
-static long scroll_start_tick;
-
static struct scrollinfo scroll[SCROLLABLE_LINES];
@@ -447,7 +446,6 @@ void lcd_puts_scroll(int x, int y, unsigned char* string )
struct scrollinfo* s;
DEBUGF("lcd_puts_scroll(%d, %d, %s)\n", x, y, string);
- scroll_start_tick = current_tick + scroll_delay;
s = &scroll[y];
@@ -458,6 +456,7 @@ void lcd_puts_scroll(int x, int y, unsigned char* string )
if ( s->textlen > s->space ) {
s->mode = SCROLL_MODE_RUN;
+ s->scroll_start_tick = current_tick + scroll_delay;
s->offset=s->space;
s->startx=x;
s->starty=y;
@@ -468,7 +467,8 @@ void lcd_puts_scroll(int x, int y, unsigned char* string )
s->space > (int)sizeof s->line ?
(int)sizeof s->line : s->space );
s->line[sizeof s->line - 1] = 0;
- }
+ } else
+ s->mode = SCROLL_MODE_OFF;
}
void lcd_stop_scroll(void)
@@ -532,8 +532,6 @@ void lcd_scroll_resume(void)
struct scrollinfo* s;
int index;
- scroll_start_tick = current_tick + scroll_delay;
-
for ( index = 0; index < SCROLLABLE_LINES; index++ ) {
s = &scroll[index];
if ( s->mode == SCROLL_MODE_PAUSE ) {
@@ -546,8 +544,6 @@ void lcd_scroll_resume_line(int line)
{
struct scrollinfo* s;
- scroll_start_tick = current_tick + scroll_delay;
-
s = &scroll[line];
if (s->mode == SCROLL_MODE_PAUSE ) {
s->mode = SCROLL_MODE_RUN;
@@ -562,6 +558,7 @@ void lcd_scroll_speed(int speed)
void lcd_scroll_delay(int ms)
{
scroll_delay = ms / (HZ / 10);
+ DEBUGF("scroll_delay=%d (ms=%d, HZ=%d)\n", scroll_delay, ms, HZ);
}
static void scroll_thread(void)
{
@@ -575,18 +572,14 @@ static void scroll_thread(void)
scroll[index].mode = SCROLL_MODE_OFF;
}
- scroll_start_tick = current_tick;
-
while ( 1 ) {
update = false;
- /* wait 0.5s before starting scroll */
- if ( TIME_AFTER(current_tick, scroll_start_tick) ) {
-
- for ( index = 0; index < SCROLLABLE_LINES; index++ ) {
- s = &scroll[index];
- if ( s->mode == SCROLL_MODE_RUN ) {
+ for ( index = 0; index < SCROLLABLE_LINES; index++ ) {
+ s = &scroll[index];
+ if ( s->mode == SCROLL_MODE_RUN ) {
+ if ( TIME_AFTER(current_tick, s->scroll_start_tick) ) {
update = true;
for ( i = 0; i < s->space - 1; i++ )