summaryrefslogtreecommitdiff
path: root/apps/plugins/stopwatch.c
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2004-12-03 07:36:11 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2004-12-03 07:36:11 +0000
commit059ada52d0784c31ec34e651b846e78134f93f61 (patch)
tree74cfb86af1ddbb596976784a73ab6697769a3961 /apps/plugins/stopwatch.c
parenta0d5bea9ec120cb19efedc95e8e96fe1ca88feff (diff)
downloadrockbox-059ada52d0784c31ec34e651b846e78134f93f61.tar.gz
rockbox-059ada52d0784c31ec34e651b846e78134f93f61.zip
Make sure the time is updated before blocking in button_get()
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5477 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/stopwatch.c')
-rw-r--r--apps/plugins/stopwatch.c70
1 files changed, 35 insertions, 35 deletions
diff --git a/apps/plugins/stopwatch.c b/apps/plugins/stopwatch.c
index e21df0d7b6..3843476f78 100644
--- a/apps/plugins/stopwatch.c
+++ b/apps/plugins/stopwatch.c
@@ -111,6 +111,41 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
111 111
112 while (!done) 112 while (!done)
113 { 113 {
114 if (counting)
115 {
116 stopwatch = prev_total + *rb->current_tick - start_at;
117 }
118 else
119 {
120 stopwatch = prev_total;
121 }
122
123 ticks_to_string(stopwatch,0,32,buf);
124 rb->lcd_puts(0, TIMER_Y, buf);
125
126 if(update_lap)
127 {
128 lap_start = curr_lap - lap_scroll;
129 for (lap = lap_start; lap > lap_start - LAP_LINES; lap--)
130 {
131 if (lap > 0)
132 {
133 ticks_to_string(lap_times[(lap-1)%MAX_LAPS],lap,32,buf);
134 rb->lcd_puts_scroll(0, LAP_Y + lap_start - lap, buf);
135 }
136 else
137 {
138 rb->lcd_puts(0, LAP_Y + lap_start - lap,
139 " ");
140 }
141 }
142 update_lap = false;
143 }
144
145#ifdef HAVE_LCD_BITMAP
146 rb->lcd_update();
147#endif
148
114 if (! counting) 149 if (! counting)
115 { 150 {
116 button = rb->button_get(true); 151 button = rb->button_get(true);
@@ -187,41 +222,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
187 return PLUGIN_USB_CONNECTED; 222 return PLUGIN_USB_CONNECTED;
188 break; 223 break;
189 } 224 }
190
191 if (counting)
192 {
193 stopwatch = prev_total + *rb->current_tick - start_at;
194 }
195 else
196 {
197 stopwatch = prev_total;
198 }
199
200 ticks_to_string(stopwatch,0,32,buf);
201 rb->lcd_puts(0, TIMER_Y, buf);
202
203 if(update_lap)
204 {
205 lap_start = curr_lap - lap_scroll;
206 for (lap = lap_start; lap > lap_start - LAP_LINES; lap--)
207 {
208 if (lap > 0)
209 {
210 ticks_to_string(lap_times[(lap-1)%MAX_LAPS],lap,32,buf);
211 rb->lcd_puts_scroll(0, LAP_Y + lap_start - lap, buf);
212 }
213 else
214 {
215 rb->lcd_puts(0, LAP_Y + lap_start - lap,
216 " ");
217 }
218 }
219 update_lap = false;
220 }
221
222#ifdef HAVE_LCD_BITMAP
223 rb->lcd_update();
224#endif
225 } 225 }
226 return PLUGIN_OK; 226 return PLUGIN_OK;
227} 227}