summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--firmware/drivers/lcd-player.c8
-rw-r--r--firmware/drivers/lcd.h2
2 files changed, 8 insertions, 2 deletions
diff --git a/firmware/drivers/lcd-player.c b/firmware/drivers/lcd-player.c
index 23dc774e83..ea759544eb 100644
--- a/firmware/drivers/lcd-player.c
+++ b/firmware/drivers/lcd-player.c
@@ -79,6 +79,7 @@ static char scroll_speed = 8; /* updates per second */
79static int scroll_delay = HZ/2; /* delay before starting scroll */ 79static int scroll_delay = HZ/2; /* delay before starting scroll */
80static char scroll_spacing = 3; /* spaces between end and start of text */ 80static char scroll_spacing = 3; /* spaces between end and start of text */
81static bool allow_bidirectional_scrolling = true; 81static bool allow_bidirectional_scrolling = true;
82static int bidir_limit = 50; /* percent */
82 83
83static struct scrollinfo scroll[SCROLLABLE_LINES]; 84static struct scrollinfo scroll[SCROLLABLE_LINES];
84 85
@@ -442,6 +443,11 @@ void lcd_init (void)
442 sizeof(scroll_stack), scroll_name); 443 sizeof(scroll_stack), scroll_name);
443} 444}
444 445
446void lcd_bidir_scroll(int percent)
447{
448 bidir_limit = percent;
449}
450
445void lcd_puts_scroll(int x, int y, unsigned char* string ) 451void lcd_puts_scroll(int x, int y, unsigned char* string )
446{ 452{
447 struct scrollinfo* s; 453 struct scrollinfo* s;
@@ -463,7 +469,7 @@ void lcd_puts_scroll(int x, int y, unsigned char* string )
463 s->direction=+1; 469 s->direction=+1;
464 strncpy(s->text,string,sizeof s->text); 470 strncpy(s->text,string,sizeof s->text);
465 s->turn_offset=-1; 471 s->turn_offset=-1;
466 if (allow_bidirectional_scrolling && s->textlen + x > 11+4) { 472 if (bidir_limit && (s->textlen < ((11-x)*(100+bidir_limit))/100)) {
467 s->turn_offset=s->textlen+x-11; 473 s->turn_offset=s->textlen+x-11;
468 } else { 474 } else {
469 for (i=0; i<scroll_spacing && s->textlen<(int)sizeof(s->text); i++) { 475 for (i=0; i<scroll_spacing && s->textlen<(int)sizeof(s->text); i++) {
diff --git a/firmware/drivers/lcd.h b/firmware/drivers/lcd.h
index 8c57aa9f05..a4d8178b87 100644
--- a/firmware/drivers/lcd.h
+++ b/firmware/drivers/lcd.h
@@ -88,7 +88,7 @@ extern void lcd_double_height (bool on);
88unsigned char lcd_get_locked_pattern(void); 88unsigned char lcd_get_locked_pattern(void);
89void lcd_unlock_pattern(unsigned char pat); 89void lcd_unlock_pattern(unsigned char pat);
90void lcd_allow_bidirectional_scrolling(bool on); 90void lcd_allow_bidirectional_scrolling(bool on);
91 91extern void lcd_bidir_scroll(int threshold);
92#endif 92#endif
93 93
94#if defined(HAVE_LCD_BITMAP) || defined(SIMULATOR) 94#if defined(HAVE_LCD_BITMAP) || defined(SIMULATOR)