summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/lang/english.lang5
-rw-r--r--apps/settings.c7
-rw-r--r--apps/settings.h1
-rw-r--r--apps/settings_menu.c22
-rw-r--r--firmware/drivers/lcd-player.c33
-rw-r--r--firmware/export/lcd.h4
6 files changed, 58 insertions, 14 deletions
diff --git a/apps/lang/english.lang b/apps/lang/english.lang
index 604a77bd2e..a35db446ec 100644
--- a/apps/lang/english.lang
+++ b/apps/lang/english.lang
@@ -1532,3 +1532,8 @@ id: LANG_ALWAYS
1532desc: (player) the jump scroll shall be done "always" 1532desc: (player) the jump scroll shall be done "always"
1533eng: "Always" 1533eng: "Always"
1534new: 1534new:
1535
1536id: LANG_JUMP_SCROLL_DELAY
1537desc: (player) Delay before making a jump scroll
1538eng: "Jump Scroll Delay"
1539new:
diff --git a/apps/settings.c b/apps/settings.c
index 5c7ef7e645..5c12422056 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -145,6 +145,7 @@ Rest of config block, only saved to disk:
1450xF8 (int) Playlist shuffle seed 1450xF8 (int) Playlist shuffle seed
1460xFC (char[260]) Resume playlist (path/to/dir or path/to/playlist.m3u) 1460xFC (char[260]) Resume playlist (path/to/dir or path/to/playlist.m3u)
1470xFD (char)jump scroll mode (only for player) 1470xFD (char)jump scroll mode (only for player)
1480xFE (char)jump scroll delay (only for player)
148 149
149*************************************/ 150*************************************/
150 151
@@ -414,6 +415,7 @@ int settings_save( void )
414 strncpy(&config_block[0xFC], global_settings.resume_file, MAX_PATH); 415 strncpy(&config_block[0xFC], global_settings.resume_file, MAX_PATH);
415#ifdef HAVE_LCD_CHARCELLS 416#ifdef HAVE_LCD_CHARCELLS
416 config_block[0xfd]=(unsigned char)global_settings.jump_scroll; 417 config_block[0xfd]=(unsigned char)global_settings.jump_scroll;
418 config_block[0xfe]=(unsigned char)global_settings.jump_scroll_delay;
417#endif 419#endif
418 DEBUGF( "+Resume file %s\n",global_settings.resume_file ); 420 DEBUGF( "+Resume file %s\n",global_settings.resume_file );
419 DEBUGF( "+Resume index %X offset %X\n", 421 DEBUGF( "+Resume index %X offset %X\n",
@@ -533,6 +535,7 @@ void settings_apply(void)
533 lcd_scroll_step(global_settings.scroll_step); 535 lcd_scroll_step(global_settings.scroll_step);
534#else 536#else
535 lcd_jump_scroll(global_settings.jump_scroll); 537 lcd_jump_scroll(global_settings.jump_scroll);
538 lcd_jump_scroll_delay(global_settings.jump_scroll_delay);
536#endif 539#endif
537 lcd_bidir_scroll(global_settings.bidir_limit); 540 lcd_bidir_scroll(global_settings.bidir_limit);
538 lcd_scroll_delay(global_settings.scroll_delay * (HZ/10)); 541 lcd_scroll_delay(global_settings.scroll_delay * (HZ/10));
@@ -735,6 +738,8 @@ void settings_load(void)
735#ifdef HAVE_LCD_CHARSCELLS 738#ifdef HAVE_LCD_CHARSCELLS
736 if (config_block[0xfd] != 0xff) 739 if (config_block[0xfd] != 0xff)
737 global_settings.jump_scroll = config_block[0xfd]; 740 global_settings.jump_scroll = config_block[0xfd];
741 if (config_block[0xfe] != 0xff)
742 global_settings.jump_scroll_delay = config_block[0xfe];
738#endif 743#endif
739 global_settings.resume_file[MAX_PATH]=0; 744 global_settings.resume_file[MAX_PATH]=0;
740 } 745 }
@@ -1228,6 +1233,7 @@ bool settings_save_config(void)
1228 fprintf(fd, "scroll step: %d\r\n", global_settings.scroll_step); 1233 fprintf(fd, "scroll step: %d\r\n", global_settings.scroll_step);
1229#else 1234#else
1230 fprintf(fd, "jump scroll: %d\r\n", global_settings.jump_scroll); 1235 fprintf(fd, "jump scroll: %d\r\n", global_settings.jump_scroll);
1236 fprintf(fd, "jump scroll delay: %d\r\n", global_settings.jump_scroll_delay);
1231#endif 1237#endif
1232 1238
1233 fprintf(fd, "bidir limit: %d\r\n", global_settings.bidir_limit); 1239 fprintf(fd, "bidir limit: %d\r\n", global_settings.bidir_limit);
@@ -1406,6 +1412,7 @@ void settings_reset(void) {
1406 global_settings.bidir_limit = 50; 1412 global_settings.bidir_limit = 50;
1407#ifdef HAVE_LCD_CHARCELLS 1413#ifdef HAVE_LCD_CHARCELLS
1408 global_settings.jump_scroll = 1; 1414 global_settings.jump_scroll = 1;
1415 global_settings.jump_scroll_delay = 50;
1409#endif 1416#endif
1410 global_settings.scroll_delay = 100; 1417 global_settings.scroll_delay = 100;
1411 global_settings.scroll_step = 6; 1418 global_settings.scroll_step = 6;
diff --git a/apps/settings.h b/apps/settings.h
index 2d4d9fac2f..56bba8878d 100644
--- a/apps/settings.h
+++ b/apps/settings.h
@@ -153,6 +153,7 @@ struct user_settings
153 int scroll_step; /* pixels to advance per update */ 153 int scroll_step; /* pixels to advance per update */
154#ifdef HAVE_LCD_CHARCELLS 154#ifdef HAVE_LCD_CHARCELLS
155 int jump_scroll; /* Fast jump when scrolling */ 155 int jump_scroll; /* Fast jump when scrolling */
156 int jump_scroll_delay; /* Delay between jump scroll screens */
156#endif 157#endif
157 bool fade_on_stop; /* fade on pause/unpause/stop */ 158 bool fade_on_stop; /* fade on pause/unpause/stop */
158 bool caption_backlight; /* turn on backlight at end and start of track */ 159 bool caption_backlight; /* turn on backlight at end and start of track */
diff --git a/apps/settings_menu.c b/apps/settings_menu.c
index 52b8d86aac..db6499a313 100644
--- a/apps/settings_menu.c
+++ b/apps/settings_menu.c
@@ -459,10 +459,23 @@ static bool bidir_limit(void)
459#ifdef HAVE_LCD_CHARCELLS 459#ifdef HAVE_LCD_CHARCELLS
460static bool jump_scroll(void) 460static bool jump_scroll(void)
461{ 461{
462 char* names[] = { str(LANG_OFF), str(LANG_ONE_TIME), str(LANG_ALWAYS)}; 462 char* names[] = { str(LANG_OFF), str(LANG_ONE_TIME), "2",
463 463 "3", "4", str(LANG_ALWAYS)};
464 return set_option(str(LANG_JUMP_SCROLL), &global_settings.jump_scroll, 464 bool ret;
465 names, 3, lcd_jump_scroll); 465 ret=set_option(str(LANG_JUMP_SCROLL), &global_settings.jump_scroll,
466 names, 6, lcd_jump_scroll);
467 if (!ret && global_settings.jump_scroll>=JUMP_SCROLL_ALWAYS) {
468 global_settings.jump_scroll=254; /* Nice future "safe" value */
469 }
470 return ret;
471}
472static bool jump_scroll_delay(void)
473{
474 int dummy = global_settings.jump_scroll_delay * (HZ/10);
475 int rc = set_int(str(LANG_JUMP_SCROLL_DELAY), "ms", &dummy,
476 &lcd_jump_scroll_delay, 100, 0, 2500 );
477 global_settings.jump_scroll_delay = dummy / (HZ/10);
478 return rc;
466} 479}
467#endif 480#endif
468 481
@@ -761,6 +774,7 @@ static bool scroll_settings_menu(void)
761 { str(LANG_BIDIR_SCROLL), bidir_limit }, 774 { str(LANG_BIDIR_SCROLL), bidir_limit },
762#ifdef HAVE_LCD_CHARCELLS 775#ifdef HAVE_LCD_CHARCELLS
763 { str(LANG_JUMP_SCROLL), jump_scroll }, 776 { str(LANG_JUMP_SCROLL), jump_scroll },
777 { str(LANG_JUMP_SCROLL_DELAY), jump_scroll_delay },
764#endif 778#endif
765 }; 779 };
766 780
diff --git a/firmware/drivers/lcd-player.c b/firmware/drivers/lcd-player.c
index 2496fb6f66..6e62358da7 100644
--- a/firmware/drivers/lcd-player.c
+++ b/firmware/drivers/lcd-player.c
@@ -71,6 +71,7 @@ struct scrollinfo {
71 long scroll_start_tick; 71 long scroll_start_tick;
72 int direction; /* +1 for right or -1 for left*/ 72 int direction; /* +1 for right or -1 for left*/
73 int jump_scroll; 73 int jump_scroll;
74 int jump_scroll_steps;
74}; 75};
75 76
76#define MAX_CURSOR_CHARS 8 77#define MAX_CURSOR_CHARS 8
@@ -89,10 +90,11 @@ static char scroll_stack[DEFAULT_STACK_SIZE];
89static char scroll_name[] = "scroll"; 90static char scroll_name[] = "scroll";
90static char scroll_speed = 8; /* updates per second */ 91static char scroll_speed = 8; /* updates per second */
91static int scroll_delay = HZ/2; /* delay before starting scroll */ 92static int scroll_delay = HZ/2; /* delay before starting scroll */
93static int jump_scroll_delay = HZ/4; /* delay between jump scroll jumps */
92static char scroll_spacing = 3; /* spaces between end and start of text */ 94static char scroll_spacing = 3; /* spaces between end and start of text */
93static bool allow_bidirectional_scrolling = true; 95static bool allow_bidirectional_scrolling = true;
94static int bidir_limit = 50; /* percent */ 96static int bidir_limit = 50; /* percent */
95static int jump_scroll = 0; /* 0=off, 1=once, 2=always */ 97static int jump_scroll = 0; /* 0=off, 1=once, ..., JUMP_SCROLL_ALWAYS */
96 98
97static struct scrollinfo scroll[SCROLLABLE_LINES]; 99static struct scrollinfo scroll[SCROLLABLE_LINES];
98 100
@@ -500,7 +502,7 @@ void lcd_init (void)
500 sizeof(scroll_stack), scroll_name); 502 sizeof(scroll_stack), scroll_name);
501} 503}
502 504
503void lcd_jump_scroll (int mode) /* 0=off, 1=once, 2=always */ 505void lcd_jump_scroll (int mode) /* 0=off, 1=once, ..., JUMP_SCROLL_ALWAYS */
504{ 506{
505 jump_scroll=mode; 507 jump_scroll=mode;
506} 508}
@@ -530,8 +532,11 @@ void lcd_puts_scroll(int x, int y, unsigned char* string )
530 s->starty=y; 532 s->starty=y;
531 s->direction=+1; 533 s->direction=+1;
532 s->jump_scroll=0; 534 s->jump_scroll=0;
533 if (jump_scroll && scroll_delay/2<(HZ/scroll_speed)*(s->textlen-11+x)) 535 s->jump_scroll_steps=0;
534 s->jump_scroll=11-x; 536 if (jump_scroll && jump_scroll_delay<(HZ/scroll_speed)*(s->textlen-11+x)) {
537 s->jump_scroll_steps=11-x;
538 s->jump_scroll=jump_scroll;
539 }
535 strncpy(s->text,string,sizeof s->text); 540 strncpy(s->text,string,sizeof s->text);
536 s->turn_offset=-1; 541 s->turn_offset=-1;
537 if (bidir_limit && (s->textlen < ((11-x)*(100+bidir_limit))/100)) { 542 if (bidir_limit && (s->textlen < ((11-x)*(100+bidir_limit))/100)) {
@@ -584,6 +589,13 @@ void lcd_scroll_delay(int ms)
584 scroll_delay = ms / (HZ / 10); 589 scroll_delay = ms / (HZ / 10);
585 DEBUGF("scroll_delay=%d (ms=%d, HZ=%d)\n", scroll_delay, ms, HZ); 590 DEBUGF("scroll_delay=%d (ms=%d, HZ=%d)\n", scroll_delay, ms, HZ);
586} 591}
592
593void lcd_jump_scroll_delay(int ms)
594{
595 jump_scroll_delay = ms / (HZ / 10);
596 DEBUGF("jump_scroll_delay=%d (ms=%d, HZ=%d)\n", jump_scroll_delay, ms, HZ);
597}
598
587static void scroll_thread(void) 599static void scroll_thread(void)
588{ 600{
589 struct scrollinfo* s; 601 struct scrollinfo* s;
@@ -605,11 +617,12 @@ static void scroll_thread(void)
605 if ( s->mode == SCROLL_MODE_RUN ) { 617 if ( s->mode == SCROLL_MODE_RUN ) {
606 if ( TIME_AFTER(current_tick, s->scroll_start_tick) ) { 618 if ( TIME_AFTER(current_tick, s->scroll_start_tick) ) {
607 char buffer[12]; 619 char buffer[12];
620 int jumping_scroll=s->jump_scroll;
608 update = true; 621 update = true;
609 if (s->jump_scroll) { 622 if (s->jump_scroll) {
610 s->offset+=s->jump_scroll; 623 s->offset+=s->jump_scroll_steps;
611 s->scroll_start_tick = current_tick + 624 s->scroll_start_tick = current_tick +
612 scroll_delay/2; 625 jump_scroll_delay;
613 /* Eat space */ 626 /* Eat space */
614 while (s->offset < s->textlen && 627 while (s->offset < s->textlen &&
615 s->text[s->offset] == ' ') { 628 s->text[s->offset] == ' ') {
@@ -617,8 +630,10 @@ static void scroll_thread(void)
617 } 630 }
618 if (s->offset >= s->textlen) { 631 if (s->offset >= s->textlen) {
619 s->offset=0; 632 s->offset=0;
620 if (jump_scroll!=2) { 633 s->scroll_start_tick = current_tick +
621 s->jump_scroll=0; 634 scroll_delay;
635 if (s->jump_scroll != JUMP_SCROLL_ALWAYS) {
636 s->jump_scroll--;
622 s->direction=1; 637 s->direction=1;
623 } 638 }
624 } 639 }
@@ -650,7 +665,7 @@ static void scroll_thread(void)
650 break; 665 break;
651 } 666 }
652 o=0; 667 o=0;
653 if (s->turn_offset == -1 && !s->jump_scroll) { 668 if (s->turn_offset == -1 && !jumping_scroll) {
654 while (i<11) { 669 while (i<11) {
655 buffer[i++]=s->text[o++]; 670 buffer[i++]=s->text[o++];
656 } 671 }
diff --git a/firmware/export/lcd.h b/firmware/export/lcd.h
index ff955e170b..0818f9d92e 100644
--- a/firmware/export/lcd.h
+++ b/firmware/export/lcd.h
@@ -87,7 +87,9 @@ enum
87extern void lcd_define_hw_pattern (int which,char *pattern,int length); 87extern void lcd_define_hw_pattern (int which,char *pattern,int length);
88extern void lcd_define_pattern (int which,char *pattern); 88extern void lcd_define_pattern (int which,char *pattern);
89extern void lcd_double_height (bool on); 89extern void lcd_double_height (bool on);
90extern void lcd_jump_scroll (int mode); /* 0=off, 1=once, 2=always */ 90#define JUMP_SCROLL_ALWAYS 5
91extern void lcd_jump_scroll (int mode); /* 0=off, 1=once, ..., ALWAYS */
92extern void lcd_jump_scroll_delay( int ms );
91unsigned char lcd_get_locked_pattern(void); 93unsigned char lcd_get_locked_pattern(void);
92void lcd_unlock_pattern(unsigned char pat); 94void lcd_unlock_pattern(unsigned char pat);
93void lcd_allow_bidirectional_scrolling(bool on); 95void lcd_allow_bidirectional_scrolling(bool on);