summaryrefslogtreecommitdiff
path: root/firmware/drivers/lcd-bitmap-common.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/drivers/lcd-bitmap-common.c')
-rw-r--r--firmware/drivers/lcd-bitmap-common.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/firmware/drivers/lcd-bitmap-common.c b/firmware/drivers/lcd-bitmap-common.c
index fa18f9fa1f..1a504c6f40 100644
--- a/firmware/drivers/lcd-bitmap-common.c
+++ b/firmware/drivers/lcd-bitmap-common.c
@@ -435,6 +435,7 @@ void LCDFN(scroll_fn)(void)
435 int index; 435 int index;
436 int xpos, ypos; 436 int xpos, ypos;
437 struct viewport* old_vp = current_vp; 437 struct viewport* old_vp = current_vp;
438 bool makedelay = false;
438 439
439 for ( index = 0; index < LCDFN(scroll_info).lines; index++ ) { 440 for ( index = 0; index < LCDFN(scroll_info).lines; index++ ) {
440 s = &LCDFN(scroll_info).scroll[index]; 441 s = &LCDFN(scroll_info).scroll[index];
@@ -459,26 +460,31 @@ void LCDFN(scroll_fn)(void)
459 /* at beginning of line */ 460 /* at beginning of line */
460 s->offset = 0; 461 s->offset = 0;
461 s->backward = false; 462 s->backward = false;
462 s->start_tick = current_tick + LCDFN(scroll_info).delay * 2; 463 makedelay = true;
463 } 464 }
464 if (s->offset >= s->width - (current_vp->width - xpos)) { 465 else if (s->offset >= s->width - (current_vp->width - xpos)) {
465 /* at end of line */ 466 /* at end of line */
466 s->offset = s->width - (current_vp->width - xpos); 467 s->offset = s->width - (current_vp->width - xpos);
467 s->backward = true; 468 s->backward = true;
468 s->start_tick = current_tick + LCDFN(scroll_info).delay * 2; 469 makedelay = true;
469 } 470 }
470 } 471 }
471 else { 472 else {
472 /* scroll forward the whole time */ 473 /* scroll forward the whole time */
473 if (s->offset >= s->width) { 474 if (s->offset >= s->width) {
474 s->offset = 0; 475 s->offset = 0;
475 s->start_tick = current_tick + LCDFN(scroll_info).delay * 2; 476 makedelay = true;
476 } 477 }
477 } 478 }
479
480 if (makedelay)
481 s->start_tick = current_tick + LCDFN(scroll_info).delay +
482 LCDFN(scroll_info).ticks;
483
478 LCDFN(putsxyofs_style)(xpos, ypos, s->line, s->style, s->width, 484 LCDFN(putsxyofs_style)(xpos, ypos, s->line, s->style, s->width,
479 pf->height, s->offset); 485 pf->height, s->offset);
480 LCDFN(update_viewport_rect)(xpos, ypos, current_vp->width - xpos, 486 LCDFN(update_viewport_rect)(xpos, ypos, current_vp->width - xpos,
481 pf->height); 487 pf->height);
482 } 488 }
483 LCDFN(set_viewport)(old_vp); 489 LCDFN(set_viewport)(old_vp);
484} 490}