summaryrefslogtreecommitdiff
path: root/apps/plugins
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2004-04-22 01:09:12 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2004-04-22 01:09:12 +0000
commit1363e74972deee56aaf23e120317dd5f26e5e434 (patch)
tree101880ef41dc4babf5f23cf97fabc5d8bf165c29 /apps/plugins
parent3ec6f5f823b984bb104ea80d04acd2764f67ac50 (diff)
downloadrockbox-1363e74972deee56aaf23e120317dd5f26e5e434.tar.gz
rockbox-1363e74972deee56aaf23e120317dd5f26e5e434.zip
Some changes to make the stop watch work better on the player, like scrolling the lap times. Now it also handles the USB.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4547 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins')
-rw-r--r--apps/plugins/stopwatch.c35
1 files changed, 25 insertions, 10 deletions
diff --git a/apps/plugins/stopwatch.c b/apps/plugins/stopwatch.c
index c2f5a7940e..f4da7bfeaf 100644
--- a/apps/plugins/stopwatch.c
+++ b/apps/plugins/stopwatch.c
@@ -73,6 +73,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
73 int button; 73 int button;
74 int lap; 74 int lap;
75 int done = false; 75 int done = false;
76 bool update_lap = true;
76 77
77 TEST_PLUGIN_API(api); 78 TEST_PLUGIN_API(api);
78 (void)parameter; 79 (void)parameter;
@@ -131,6 +132,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
131 { 132 {
132 prev_total = 0; 133 prev_total = 0;
133 curr_lap = 0; 134 curr_lap = 0;
135 update_lap = true;
134 } 136 }
135 break; 137 break;
136 138
@@ -138,6 +140,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
138 case BUTTON_ON: 140 case BUTTON_ON:
139 lap_times[curr_lap%MAX_LAPS] = stopwatch; 141 lap_times[curr_lap%MAX_LAPS] = stopwatch;
140 curr_lap++; 142 curr_lap++;
143 update_lap = true;
141 break; 144 break;
142 145
143 /* UP (RIGHT/+) = Scroll Lap timer up */ 146 /* UP (RIGHT/+) = Scroll Lap timer up */
@@ -147,7 +150,10 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
147 case BUTTON_RIGHT: 150 case BUTTON_RIGHT:
148#endif 151#endif
149 if (lap_scroll > 0) 152 if (lap_scroll > 0)
153 {
150 lap_scroll --; 154 lap_scroll --;
155 update_lap = true;
156 }
151 break; 157 break;
152 158
153 /* DOWN (LEFT/-) = Scroll Lap timer down */ 159 /* DOWN (LEFT/-) = Scroll Lap timer down */
@@ -160,8 +166,13 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
160 (lap_scroll < MAX_SCROLL) ) 166 (lap_scroll < MAX_SCROLL) )
161 { 167 {
162 lap_scroll ++; 168 lap_scroll ++;
169 update_lap = true;
163 } 170 }
164 break; 171 break;
172
173 case SYS_USB_CONNECTED:
174 rb->usb_screen();
175 return PLUGIN_USB_CONNECTED;
165 } 176 }
166 177
167 if (counting) 178 if (counting)
@@ -176,19 +187,23 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
176 ticks_to_string(stopwatch,0,32,buf); 187 ticks_to_string(stopwatch,0,32,buf);
177 rb->lcd_puts(0, TIMER_Y, buf); 188 rb->lcd_puts(0, TIMER_Y, buf);
178 189
179 lap_start = MIN(curr_lap, lap_scroll); 190 if(update_lap)
180 lap_start = curr_lap - lap_scroll;
181 for (lap = lap_start; lap > lap_start - LAP_LINES; lap--)
182 { 191 {
183 if (lap > 0) 192 lap_start = curr_lap - lap_scroll;
184 { 193 for (lap = lap_start; lap > lap_start - LAP_LINES; lap--)
185 ticks_to_string(lap_times[(lap-1)%MAX_LAPS],lap,32,buf);
186 rb->lcd_puts(0, LAP_Y + lap_start - lap, buf);
187 }
188 else
189 { 194 {
190 rb->lcd_puts(0, LAP_Y + lap_start - lap, " "); 195 if (lap > 0)
196 {
197 ticks_to_string(lap_times[(lap-1)%MAX_LAPS],lap,32,buf);
198 rb->lcd_puts_scroll(0, LAP_Y + lap_start - lap, buf);
199 }
200 else
201 {
202 rb->lcd_puts(0, LAP_Y + lap_start - lap,
203 " ");
204 }
191 } 205 }
206 update_lap = false;
192 } 207 }
193 208
194#ifdef HAVE_LCD_BITMAP 209#ifdef HAVE_LCD_BITMAP