diff options
author | Kjell Ericson <kjell@haxx.se> | 2003-01-10 12:23:36 +0000 |
---|---|---|
committer | Kjell Ericson <kjell@haxx.se> | 2003-01-10 12:23:36 +0000 |
commit | dc88e23700e93a83aa24e3a483be4177da1860fb (patch) | |
tree | ec45c1d8c598a665da0a189314ed0dcafe46f791 | |
parent | f2feb0a5d0b984acbeaeaea18e19cc02dd6d6226 (diff) | |
download | rockbox-dc88e23700e93a83aa24e3a483be4177da1860fb.tar.gz rockbox-dc88e23700e93a83aa24e3a483be4177da1860fb.zip |
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.c | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/firmware/drivers/lcd-player.c b/firmware/drivers/lcd-player.c index f98e210bfd..6e7fe9d170 100644 --- a/firmware/drivers/lcd-player.c +++ b/firmware/drivers/lcd-player.c | |||
@@ -69,16 +69,15 @@ struct scrollinfo { | |||
69 | int startx; | 69 | int startx; |
70 | int starty; | 70 | int starty; |
71 | int space; | 71 | int space; |
72 | long scroll_start_tick; | ||
72 | }; | 73 | }; |
73 | 74 | ||
74 | static void scroll_thread(void); | 75 | static void scroll_thread(void); |
75 | static char scroll_stack[DEFAULT_STACK_SIZE]; | 76 | static char scroll_stack[DEFAULT_STACK_SIZE]; |
76 | static char scroll_name[] = "scroll"; | 77 | static char scroll_name[] = "scroll"; |
77 | static char scroll_speed = 8; /* updates per second */ | 78 | static char scroll_speed = 8; /* updates per second */ |
78 | static char scroll_delay = HZ/2; /* delay before starting scroll */ | 79 | static int scroll_delay = HZ/2; /* delay before starting scroll */ |
79 | static char scroll_spacing = 3; /* spaces between end and start of text */ | 80 | static char scroll_spacing = 3; /* spaces between end and start of text */ |
80 | static long scroll_start_tick; | ||
81 | |||
82 | 81 | ||
83 | static struct scrollinfo scroll[SCROLLABLE_LINES]; | 82 | static struct scrollinfo scroll[SCROLLABLE_LINES]; |
84 | 83 | ||
@@ -447,7 +446,6 @@ void lcd_puts_scroll(int x, int y, unsigned char* string ) | |||
447 | struct scrollinfo* s; | 446 | struct scrollinfo* s; |
448 | 447 | ||
449 | DEBUGF("lcd_puts_scroll(%d, %d, %s)\n", x, y, string); | 448 | DEBUGF("lcd_puts_scroll(%d, %d, %s)\n", x, y, string); |
450 | scroll_start_tick = current_tick + scroll_delay; | ||
451 | 449 | ||
452 | s = &scroll[y]; | 450 | s = &scroll[y]; |
453 | 451 | ||
@@ -458,6 +456,7 @@ void lcd_puts_scroll(int x, int y, unsigned char* string ) | |||
458 | 456 | ||
459 | if ( s->textlen > s->space ) { | 457 | if ( s->textlen > s->space ) { |
460 | s->mode = SCROLL_MODE_RUN; | 458 | s->mode = SCROLL_MODE_RUN; |
459 | s->scroll_start_tick = current_tick + scroll_delay; | ||
461 | s->offset=s->space; | 460 | s->offset=s->space; |
462 | s->startx=x; | 461 | s->startx=x; |
463 | s->starty=y; | 462 | s->starty=y; |
@@ -468,7 +467,8 @@ void lcd_puts_scroll(int x, int y, unsigned char* string ) | |||
468 | s->space > (int)sizeof s->line ? | 467 | s->space > (int)sizeof s->line ? |
469 | (int)sizeof s->line : s->space ); | 468 | (int)sizeof s->line : s->space ); |
470 | s->line[sizeof s->line - 1] = 0; | 469 | s->line[sizeof s->line - 1] = 0; |
471 | } | 470 | } else |
471 | s->mode = SCROLL_MODE_OFF; | ||
472 | } | 472 | } |
473 | 473 | ||
474 | void lcd_stop_scroll(void) | 474 | void lcd_stop_scroll(void) |
@@ -532,8 +532,6 @@ void lcd_scroll_resume(void) | |||
532 | struct scrollinfo* s; | 532 | struct scrollinfo* s; |
533 | int index; | 533 | int index; |
534 | 534 | ||
535 | scroll_start_tick = current_tick + scroll_delay; | ||
536 | |||
537 | for ( index = 0; index < SCROLLABLE_LINES; index++ ) { | 535 | for ( index = 0; index < SCROLLABLE_LINES; index++ ) { |
538 | s = &scroll[index]; | 536 | s = &scroll[index]; |
539 | if ( s->mode == SCROLL_MODE_PAUSE ) { | 537 | if ( s->mode == SCROLL_MODE_PAUSE ) { |
@@ -546,8 +544,6 @@ void lcd_scroll_resume_line(int line) | |||
546 | { | 544 | { |
547 | struct scrollinfo* s; | 545 | struct scrollinfo* s; |
548 | 546 | ||
549 | scroll_start_tick = current_tick + scroll_delay; | ||
550 | |||
551 | s = &scroll[line]; | 547 | s = &scroll[line]; |
552 | if (s->mode == SCROLL_MODE_PAUSE ) { | 548 | if (s->mode == SCROLL_MODE_PAUSE ) { |
553 | s->mode = SCROLL_MODE_RUN; | 549 | s->mode = SCROLL_MODE_RUN; |
@@ -562,6 +558,7 @@ void lcd_scroll_speed(int speed) | |||
562 | void lcd_scroll_delay(int ms) | 558 | void lcd_scroll_delay(int ms) |
563 | { | 559 | { |
564 | scroll_delay = ms / (HZ / 10); | 560 | scroll_delay = ms / (HZ / 10); |
561 | DEBUGF("scroll_delay=%d (ms=%d, HZ=%d)\n", scroll_delay, ms, HZ); | ||
565 | } | 562 | } |
566 | static void scroll_thread(void) | 563 | static void scroll_thread(void) |
567 | { | 564 | { |
@@ -575,18 +572,14 @@ static void scroll_thread(void) | |||
575 | scroll[index].mode = SCROLL_MODE_OFF; | 572 | scroll[index].mode = SCROLL_MODE_OFF; |
576 | } | 573 | } |
577 | 574 | ||
578 | scroll_start_tick = current_tick; | ||
579 | |||
580 | while ( 1 ) { | 575 | while ( 1 ) { |
581 | 576 | ||
582 | update = false; | 577 | update = false; |
583 | 578 | ||
584 | /* wait 0.5s before starting scroll */ | 579 | for ( index = 0; index < SCROLLABLE_LINES; index++ ) { |
585 | if ( TIME_AFTER(current_tick, scroll_start_tick) ) { | 580 | s = &scroll[index]; |
586 | 581 | if ( s->mode == SCROLL_MODE_RUN ) { | |
587 | for ( index = 0; index < SCROLLABLE_LINES; index++ ) { | 582 | if ( TIME_AFTER(current_tick, s->scroll_start_tick) ) { |
588 | s = &scroll[index]; | ||
589 | if ( s->mode == SCROLL_MODE_RUN ) { | ||
590 | update = true; | 583 | update = true; |
591 | 584 | ||
592 | for ( i = 0; i < s->space - 1; i++ ) | 585 | for ( i = 0; i < s->space - 1; i++ ) |