diff --git a/firmware/drivers/lcd-recorder.c b/firmware/drivers/lcd-recorder.c index 08c58e0bf9..f7eb529fea 100644 --- a/firmware/drivers/lcd-recorder.c +++ b/firmware/drivers/lcd-recorder.c @@ -337,6 +337,8 @@ void lcd_puts(int x, int y, unsigned char *str) void lcd_puts_style(int x, int y, unsigned char *str, int style) { int xpos,ypos,w,h; + struct scrollinfo* s; + int index; #if defined(SIMULATOR) && defined(HAVE_LCD_CHARCELLS) /* We make the simulator truncate the string if it reaches the right edge, @@ -352,6 +354,19 @@ void lcd_puts_style(int x, int y, unsigned char *str, int style) ymargin = 8; #endif + /* make sure scrolling is turned off on the line we are updating */ + if (scrolling_lines) { + for (index = 0; index < SCROLLABLE_LINES; index++) { + if (scrolling_lines&(1<starty == y) { + scrolling_lines &= ~(1<offset += scroll_step; + pf = font_get(curfont); + xpos = xmargin + s->startx * s->width / s->len; + ypos = ymargin + s->starty * pf->height; + if (s->bidir) { /* scroll bidirectional */ if (s->offset <= 0) { /* at beginning of line */ @@ -910,9 +929,9 @@ static void scroll_thread(void) s->backward = false; s->start_tick = current_tick + scroll_delay * 2; } - if (s->offset >= s->width - (LCD_WIDTH - xmargin)) { + if (s->offset >= s->width - (LCD_WIDTH - xpos)) { /* at end of line */ - s->offset = s->width - (LCD_WIDTH - xmargin); + s->offset = s->width - (LCD_WIDTH - xpos); s->backward = true; s->start_tick = current_tick + scroll_delay * 2; } @@ -923,15 +942,11 @@ static void scroll_thread(void) s->offset %= s->width; } - lcd_getstringsize(s->line, &w, &h); - xpos = xmargin + s->startx * w / s->len; - ypos = ymargin + s->starty * h; - - lcd_clearrect(xpos, ypos, LCD_WIDTH - xmargin, h); + lcd_clearrect(xpos, ypos, LCD_WIDTH - xpos, pf->height); lcd_putsxyofs(xpos, ypos, s->offset, s->line); if (s->invert) - lcd_invertrect(xpos, ypos, LCD_WIDTH - xmargin, h); - lcd_update_rect(xpos, ypos, LCD_WIDTH - xmargin, h); + lcd_invertrect(xpos, ypos, LCD_WIDTH - xpos, pf->height); + lcd_update_rect(xpos, ypos, LCD_WIDTH - xpos, pf->height); } sleep(HZ/scroll_speed);