|
@@ -52,6 +52,7 @@ int heading_direction, text_direction;
|
52
|
52
|
|
53
|
53
|
String menu_pre[LCD_TEXT_LINES], menu_post[LCD_TEXT_LINES];
|
54
|
54
|
int menu_dir[LCD_TEXT_LINES];
|
|
55
|
+int scroll_offset = 0;
|
55
|
56
|
|
56
|
57
|
boolean redraw = false;
|
57
|
58
|
|
|
@@ -62,7 +63,7 @@ enum lcd_text_mode {
|
62
|
63
|
};
|
63
|
64
|
enum lcd_text_mode text_mode = lcd_mode_none;
|
64
|
65
|
|
65
|
|
-#define SCROLL_DELAY 500
|
|
66
|
+#define SCROLL_DELAY 1000
|
66
|
67
|
unsigned long last_scroll_time = 0;
|
67
|
68
|
|
68
|
69
|
#define IS_TEXT_CHAR(x) (((x >= 'a') && (x <= 'z')) || ((x >= 'A') && (x <= 'Z')))
|
|
@@ -124,13 +125,13 @@ void lcd_scroll_multiline(String s[], int n, int w, String &pre, String &post, i
|
124
|
125
|
}
|
125
|
126
|
|
126
|
127
|
// take first char of first line, append to pre
|
127
|
|
- pre = pre + s[0][0];
|
128
|
|
- s[0] = s[0].substring(1);
|
|
128
|
+ pre = pre + s[0][scroll_offset];
|
|
129
|
+ s[0] = s[0].substring(0, scroll_offset) + s[0].substring(scroll_offset + 1);
|
129
|
130
|
|
130
|
131
|
// shift now empty spot to the left through lines
|
131
|
132
|
for (int i = 1; i < n; i++) {
|
132
|
|
- s[i - 1] = s[i - 1] + s[i][0];
|
133
|
|
- s[i] = s[i].substring(1);
|
|
133
|
+ s[i - 1] = s[i - 1] + s[i][scroll_offset];
|
|
134
|
+ s[i] = s[i].substring(0, scroll_offset) + s[i].substring(scroll_offset + 1);
|
134
|
135
|
}
|
135
|
136
|
|
136
|
137
|
// fill empty spot at end of last line with first char of post
|
|
@@ -149,12 +150,12 @@ void lcd_scroll_multiline(String s[], int n, int w, String &pre, String &post, i
|
149
|
150
|
|
150
|
151
|
// shift now empty sport to the right through lines
|
151
|
152
|
for (int i = n - 1; i >= 1; i--) {
|
152
|
|
- s[i] = s[i - 1][s[i - 1].length() - 1] + s[i];
|
|
153
|
+ s[i] = s[i].substring(0, scroll_offset) + s[i - 1][s[i - 1].length() - 1] + s[i].substring(scroll_offset);
|
153
|
154
|
s[i - 1] = s[i - 1].substring(0, s[i - 1].length() - 1);
|
154
|
155
|
}
|
155
|
156
|
|
156
|
157
|
// fill empty spot at beginning with last char of pre
|
157
|
|
- s[0] = pre[pre.length() - 1] + s[0];
|
|
158
|
+ s[0] = s[0].substring(0, scroll_offset) + pre[pre.length() - 1] + s[0].substring(scroll_offset);
|
158
|
159
|
pre = pre.substring(0, pre.length() - 1);
|
159
|
160
|
}
|
160
|
161
|
|
|
@@ -294,6 +295,7 @@ void lcd_set_text(const char *t) {
|
294
|
295
|
Serial.println(t);
|
295
|
296
|
|
296
|
297
|
text_mode = lcd_mode_multiline;
|
|
298
|
+ scroll_offset = 0;
|
297
|
299
|
|
298
|
300
|
#ifdef USE_20X4_TEXT_LCD
|
299
|
301
|
lcd.setCursor(0, LCD_HEADING_LINES);
|
|
@@ -309,7 +311,7 @@ void lcd_set_text(const char *t) {
|
309
|
311
|
#endif // USE_FULL_GRAPHIC_LCD
|
310
|
312
|
}
|
311
|
313
|
|
312
|
|
-void lcd_set_menu_text(int line, const char *t) {
|
|
314
|
+void lcd_set_menu_text(int line, const char *t, int scroll_off) {
|
313
|
315
|
if ((line < 0) || (line >= LCD_TEXT_LINES)) {
|
314
|
316
|
Serial.print(F("Invalid lcd line no: "));
|
315
|
317
|
Serial.println(line);
|
|
@@ -321,6 +323,7 @@ void lcd_set_menu_text(int line, const char *t) {
|
321
|
323
|
Serial.println(t);
|
322
|
324
|
|
323
|
325
|
text_mode = lcd_mode_menu;
|
|
326
|
+ scroll_offset = scroll_off;
|
324
|
327
|
|
325
|
328
|
#ifdef USE_20X4_TEXT_LCD
|
326
|
329
|
lcd.setCursor(0, LCD_HEADING_LINES + line);
|