diff options
Diffstat (limited to 'firmware/scroll_engine.c')
-rw-r--r-- | firmware/scroll_engine.c | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/firmware/scroll_engine.c b/firmware/scroll_engine.c index bc356a8281..82af26afa8 100644 --- a/firmware/scroll_engine.c +++ b/firmware/scroll_engine.c | |||
@@ -41,6 +41,10 @@ static const char scroll_tick_table[18] = { | |||
41 | 100, 80, 64, 50, 40, 32, 25, 20, 16, 12, 10, 8, 6, 5, 4, 3, 2, 1 | 41 | 100, 80, 64, 50, 40, 32, 25, 20, 16, 12, 10, 8, 6, 5, 4, 3, 2, 1 |
42 | }; | 42 | }; |
43 | 43 | ||
44 | /* imported private functions from lcd-bitmap-common.c */ | ||
45 | extern struct viewport *lcd_get_viewport(void); | ||
46 | extern struct viewport *lcd_remote_get_viewport(void); | ||
47 | |||
44 | static void scroll_thread(void); | 48 | static void scroll_thread(void); |
45 | static char scroll_stack[DEFAULT_STACK_SIZE*3]; | 49 | static char scroll_stack[DEFAULT_STACK_SIZE*3]; |
46 | static const char scroll_name[] = "scroll"; | 50 | static const char scroll_name[] = "scroll"; |
@@ -80,20 +84,21 @@ struct scroll_screen_info lcd_remote_scroll_info = | |||
80 | }; | 84 | }; |
81 | #endif /* HAVE_REMOTE_LCD */ | 85 | #endif /* HAVE_REMOTE_LCD */ |
82 | 86 | ||
83 | void lcd_stop_scroll(void) | 87 | void lcd_scroll_stop(void) |
84 | { | 88 | { |
85 | lcd_scroll_info.lines = 0; | 89 | lcd_scroll_info.lines = 0; |
86 | } | 90 | } |
87 | 91 | ||
88 | /* Stop scrolling line y in the specified viewport, or all lines if y < 0 */ | 92 | /* Stop scrolling line y in the specified viewport, or all lines if y < 0 */ |
89 | void lcd_scroll_stop_line(const struct viewport* current_vp, int y) | 93 | void lcd_scroll_stop_viewport_line(const struct viewport *current_vp, int line) |
90 | { | 94 | { |
91 | int i = 0; | 95 | int i = 0; |
92 | 96 | ||
93 | while (i < lcd_scroll_info.lines) | 97 | while (i < lcd_scroll_info.lines) |
94 | { | 98 | { |
95 | if ((lcd_scroll_info.scroll[i].vp == current_vp) && | 99 | struct viewport *vp = lcd_scroll_info.scroll[i].vp; |
96 | ((y < 0) || (lcd_scroll_info.scroll[i].y == y))) | 100 | if (((vp == current_vp)) && |
101 | ((line < 0) || (lcd_scroll_info.scroll[i].y == line))) | ||
97 | { | 102 | { |
98 | /* If i is not the last active line in the array, then move | 103 | /* If i is not the last active line in the array, then move |
99 | the last item to position i */ | 104 | the last item to position i */ |
@@ -106,7 +111,7 @@ void lcd_scroll_stop_line(const struct viewport* current_vp, int y) | |||
106 | 111 | ||
107 | /* A line can only appear once, so we're done, | 112 | /* A line can only appear once, so we're done, |
108 | * unless we are clearing the whole viewport */ | 113 | * unless we are clearing the whole viewport */ |
109 | if (y >= 0) | 114 | if (line >= 0) |
110 | return ; | 115 | return ; |
111 | } | 116 | } |
112 | else | 117 | else |
@@ -117,9 +122,9 @@ void lcd_scroll_stop_line(const struct viewport* current_vp, int y) | |||
117 | } | 122 | } |
118 | 123 | ||
119 | /* Stop all scrolling lines in the specified viewport */ | 124 | /* Stop all scrolling lines in the specified viewport */ |
120 | void lcd_scroll_stop(const struct viewport* vp) | 125 | void lcd_scroll_stop_viewport(const struct viewport *current_vp) |
121 | { | 126 | { |
122 | lcd_scroll_stop_line(vp, -1); | 127 | lcd_scroll_stop_viewport_line(current_vp, -1); |
123 | } | 128 | } |
124 | 129 | ||
125 | void lcd_scroll_speed(int speed) | 130 | void lcd_scroll_speed(int speed) |
@@ -157,20 +162,21 @@ void lcd_jump_scroll_delay(int ms) | |||
157 | #endif | 162 | #endif |
158 | 163 | ||
159 | #ifdef HAVE_REMOTE_LCD | 164 | #ifdef HAVE_REMOTE_LCD |
160 | void lcd_remote_stop_scroll(void) | 165 | void lcd_remote_scroll_stop(void) |
161 | { | 166 | { |
162 | lcd_remote_scroll_info.lines = 0; | 167 | lcd_remote_scroll_info.lines = 0; |
163 | } | 168 | } |
164 | 169 | ||
165 | /* Stop scrolling line y in the specified viewport, or all lines if y < 0 */ | 170 | /* Stop scrolling line y in the specified viewport, or all lines if y < 0 */ |
166 | void lcd_remote_scroll_stop_line(const struct viewport* current_vp, int y) | 171 | void lcd_remote_scroll_stop_viewport_line(const struct viewport *current_vp, int line) |
167 | { | 172 | { |
168 | int i = 0; | 173 | int i = 0; |
169 | 174 | ||
170 | while (i < lcd_remote_scroll_info.lines) | 175 | while (i < lcd_scroll_info.lines) |
171 | { | 176 | { |
172 | if ((lcd_remote_scroll_info.scroll[i].vp == current_vp) && | 177 | struct viewport *vp = lcd_remote_scroll_info.scroll[i].vp; |
173 | ((y < 0) || (lcd_remote_scroll_info.scroll[i].y == y))) | 178 | if (((vp == current_vp)) && |
179 | ((line < 0) || (lcd_remote_scroll_info.scroll[i].y == line))) | ||
174 | { | 180 | { |
175 | /* If i is not the last active line in the array, then move | 181 | /* If i is not the last active line in the array, then move |
176 | the last item to position i */ | 182 | the last item to position i */ |
@@ -183,7 +189,7 @@ void lcd_remote_scroll_stop_line(const struct viewport* current_vp, int y) | |||
183 | 189 | ||
184 | /* A line can only appear once, so we're done, | 190 | /* A line can only appear once, so we're done, |
185 | * unless we are clearing the whole viewport */ | 191 | * unless we are clearing the whole viewport */ |
186 | if (y >= 0) | 192 | if (line >= 0) |
187 | return ; | 193 | return ; |
188 | } | 194 | } |
189 | else | 195 | else |
@@ -194,9 +200,9 @@ void lcd_remote_scroll_stop_line(const struct viewport* current_vp, int y) | |||
194 | } | 200 | } |
195 | 201 | ||
196 | /* Stop all scrolling lines in the specified viewport */ | 202 | /* Stop all scrolling lines in the specified viewport */ |
197 | void lcd_remote_scroll_stop(const struct viewport* vp) | 203 | void lcd_remote_scroll_stop_viewport(const struct viewport *current_vp) |
198 | { | 204 | { |
199 | lcd_remote_scroll_stop_line(vp, -1); | 205 | lcd_remote_scroll_stop_viewport_line(current_vp, -1); |
200 | } | 206 | } |
201 | 207 | ||
202 | void lcd_remote_scroll_speed(int speed) | 208 | void lcd_remote_scroll_speed(int speed) |