diff options
author | Linus Nielsen Feltzing <linus@haxx.se> | 2004-04-22 01:09:12 +0000 |
---|---|---|
committer | Linus Nielsen Feltzing <linus@haxx.se> | 2004-04-22 01:09:12 +0000 |
commit | 1363e74972deee56aaf23e120317dd5f26e5e434 (patch) | |
tree | 101880ef41dc4babf5f23cf97fabc5d8bf165c29 /apps/plugins/stopwatch.c | |
parent | 3ec6f5f823b984bb104ea80d04acd2764f67ac50 (diff) |
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/stopwatch.c')
-rw-r--r-- | apps/plugins/stopwatch.c | 35 |
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) int button; int lap; int done = false; + bool update_lap = true; TEST_PLUGIN_API(api); (void)parameter; @@ -131,6 +132,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) { prev_total = 0; curr_lap = 0; + update_lap = true; } break; @@ -138,6 +140,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) case BUTTON_ON: lap_times[curr_lap%MAX_LAPS] = stopwatch; curr_lap++; + update_lap = true; break; /* UP (RIGHT/+) = Scroll Lap timer up */ @@ -147,7 +150,10 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) case BUTTON_RIGHT: #endif if (lap_scroll > 0) + { lap_scroll --; + update_lap = true; + } break; /* DOWN (LEFT/-) = Scroll Lap timer down */ @@ -160,8 +166,13 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) (lap_scroll < MAX_SCROLL) ) { lap_scroll ++; + update_lap = true; } break; + + case SYS_USB_CONNECTED: + rb->usb_screen(); + return PLUGIN_USB_CONNECTED; } if (counting) @@ -176,19 +187,23 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) ticks_to_string(stopwatch,0,32,buf); rb->lcd_puts(0, TIMER_Y, buf); - lap_start = MIN(curr_lap, lap_scroll); - lap_start = curr_lap - lap_scroll; - for (lap = lap_start; lap > lap_start - LAP_LINES; lap--) + if(update_lap) { - if (lap > 0) - { - ticks_to_string(lap_times[(lap-1)%MAX_LAPS],lap,32,buf); - rb->lcd_puts(0, LAP_Y + lap_start - lap, buf); - } - else + lap_start = curr_lap - lap_scroll; + for (lap = lap_start; lap > lap_start - LAP_LINES; lap--) { - rb->lcd_puts(0, LAP_Y + lap_start - lap, " "); + if (lap > 0) + { + ticks_to_string(lap_times[(lap-1)%MAX_LAPS],lap,32,buf); + rb->lcd_puts_scroll(0, LAP_Y + lap_start - lap, buf); + } + else + { + rb->lcd_puts(0, LAP_Y + lap_start - lap, + " "); + } } + update_lap = false; } #ifdef HAVE_LCD_BITMAP |