summaryrefslogtreecommitdiff
path: root/firmware/drivers/lcd-recorder.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/drivers/lcd-recorder.c')
-rw-r--r--firmware/drivers/lcd-recorder.c35
1 files changed, 25 insertions, 10 deletions
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)
337void lcd_puts_style(int x, int y, unsigned char *str, int style) 337void lcd_puts_style(int x, int y, unsigned char *str, int style)
338{ 338{
339 int xpos,ypos,w,h; 339 int xpos,ypos,w,h;
340 struct scrollinfo* s;
341 int index;
340 342
341#if defined(SIMULATOR) && defined(HAVE_LCD_CHARCELLS) 343#if defined(SIMULATOR) && defined(HAVE_LCD_CHARCELLS)
342 /* We make the simulator truncate the string if it reaches the right edge, 344 /* 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)
352 ymargin = 8; 354 ymargin = 8;
353#endif 355#endif
354 356
357 /* make sure scrolling is turned off on the line we are updating */
358 if (scrolling_lines) {
359 for (index = 0; index < SCROLLABLE_LINES; index++) {
360 if (scrolling_lines&(1<<index)) {
361 s = &scroll[index];
362 if (s->starty == y) {
363 scrolling_lines &= ~(1<<index);
364 break;
365 }
366 }
367 }
368 }
369
355 if(!str || !str[0]) 370 if(!str || !str[0])
356 return; 371 return;
357 372
@@ -878,9 +893,9 @@ void lcd_bidir_scroll(int percent)
878} 893}
879static void scroll_thread(void) 894static void scroll_thread(void)
880{ 895{
896 struct font* pf;
881 struct scrollinfo* s; 897 struct scrollinfo* s;
882 int index; 898 int index;
883 int w, h;
884 int xpos, ypos; 899 int xpos, ypos;
885 900
886 /* initialize scroll struct array */ 901 /* initialize scroll struct array */
@@ -903,6 +918,10 @@ static void scroll_thread(void)
903 else 918 else
904 s->offset += scroll_step; 919 s->offset += scroll_step;
905 920
921 pf = font_get(curfont);
922 xpos = xmargin + s->startx * s->width / s->len;
923 ypos = ymargin + s->starty * pf->height;
924
906 if (s->bidir) { /* scroll bidirectional */ 925 if (s->bidir) { /* scroll bidirectional */
907 if (s->offset <= 0) { 926 if (s->offset <= 0) {
908 /* at beginning of line */ 927 /* at beginning of line */
@@ -910,9 +929,9 @@ static void scroll_thread(void)
910 s->backward = false; 929 s->backward = false;
911 s->start_tick = current_tick + scroll_delay * 2; 930 s->start_tick = current_tick + scroll_delay * 2;
912 } 931 }
913 if (s->offset >= s->width - (LCD_WIDTH - xmargin)) { 932 if (s->offset >= s->width - (LCD_WIDTH - xpos)) {
914 /* at end of line */ 933 /* at end of line */
915 s->offset = s->width - (LCD_WIDTH - xmargin); 934 s->offset = s->width - (LCD_WIDTH - xpos);
916 s->backward = true; 935 s->backward = true;
917 s->start_tick = current_tick + scroll_delay * 2; 936 s->start_tick = current_tick + scroll_delay * 2;
918 } 937 }
@@ -923,15 +942,11 @@ static void scroll_thread(void)
923 s->offset %= s->width; 942 s->offset %= s->width;
924 } 943 }
925 944
926 lcd_getstringsize(s->line, &w, &h); 945 lcd_clearrect(xpos, ypos, LCD_WIDTH - xpos, pf->height);
927 xpos = xmargin + s->startx * w / s->len;
928 ypos = ymargin + s->starty * h;
929
930 lcd_clearrect(xpos, ypos, LCD_WIDTH - xmargin, h);
931 lcd_putsxyofs(xpos, ypos, s->offset, s->line); 946 lcd_putsxyofs(xpos, ypos, s->offset, s->line);
932 if (s->invert) 947 if (s->invert)
933 lcd_invertrect(xpos, ypos, LCD_WIDTH - xmargin, h); 948 lcd_invertrect(xpos, ypos, LCD_WIDTH - xpos, pf->height);
934 lcd_update_rect(xpos, ypos, LCD_WIDTH - xmargin, h); 949 lcd_update_rect(xpos, ypos, LCD_WIDTH - xpos, pf->height);
935 } 950 }
936 951
937 sleep(HZ/scroll_speed); 952 sleep(HZ/scroll_speed);