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
This commit is contained in:
Linus Nielsen Feltzing 2004-04-22 01:09:12 +00:00
parent 3ec6f5f823
commit 1363e74972

View file

@ -73,6 +73,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
int button; int button;
int lap; int lap;
int done = false; int done = false;
bool update_lap = true;
TEST_PLUGIN_API(api); TEST_PLUGIN_API(api);
(void)parameter; (void)parameter;
@ -131,6 +132,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
{ {
prev_total = 0; prev_total = 0;
curr_lap = 0; curr_lap = 0;
update_lap = true;
} }
break; break;
@ -138,6 +140,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
case BUTTON_ON: case BUTTON_ON:
lap_times[curr_lap%MAX_LAPS] = stopwatch; lap_times[curr_lap%MAX_LAPS] = stopwatch;
curr_lap++; curr_lap++;
update_lap = true;
break; break;
/* UP (RIGHT/+) = Scroll Lap timer up */ /* UP (RIGHT/+) = Scroll Lap timer up */
@ -147,7 +150,10 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
case BUTTON_RIGHT: case BUTTON_RIGHT:
#endif #endif
if (lap_scroll > 0) if (lap_scroll > 0)
{
lap_scroll --; lap_scroll --;
update_lap = true;
}
break; break;
/* DOWN (LEFT/-) = Scroll Lap timer down */ /* 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 < MAX_SCROLL) )
{ {
lap_scroll ++; lap_scroll ++;
update_lap = true;
} }
break; break;
case SYS_USB_CONNECTED:
rb->usb_screen();
return PLUGIN_USB_CONNECTED;
} }
if (counting) if (counting)
@ -176,19 +187,23 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
ticks_to_string(stopwatch,0,32,buf); ticks_to_string(stopwatch,0,32,buf);
rb->lcd_puts(0, TIMER_Y, buf); rb->lcd_puts(0, TIMER_Y, buf);
lap_start = MIN(curr_lap, lap_scroll); if(update_lap)
lap_start = curr_lap - lap_scroll;
for (lap = lap_start; lap > lap_start - LAP_LINES; lap--)
{ {
if (lap > 0) lap_start = curr_lap - lap_scroll;
for (lap = lap_start; lap > lap_start - LAP_LINES; lap--)
{ {
ticks_to_string(lap_times[(lap-1)%MAX_LAPS],lap,32,buf); if (lap > 0)
rb->lcd_puts(0, LAP_Y + lap_start - lap, buf); {
} ticks_to_string(lap_times[(lap-1)%MAX_LAPS],lap,32,buf);
else rb->lcd_puts_scroll(0, LAP_Y + lap_start - lap, buf);
{ }
rb->lcd_puts(0, LAP_Y + lap_start - lap, " "); else
{
rb->lcd_puts(0, LAP_Y + lap_start - lap,
" ");
}
} }
update_lap = false;
} }
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP