Fix stop watch plugin from inserting 0 second laps if a new lap is started with the timer off.

Change-Id: I3d23d6dd47bb3b78a51d8a42b052403f7bf7665c
Reviewed-on: http://gerrit.rockbox.org/276
Reviewed-by: Michael Giacomelli <mgiacomelli@gmail.com>
Tested-by: Michael Giacomelli <mgiacomelli@gmail.com>
This commit is contained in:
Michael Giacomelli 2012-06-13 22:22:34 -04:00 committed by Michael Giacomelli
parent 190577ee9d
commit 2ca6fe1a77

16
apps/plugins/stopwatch.c Normal file → Executable file
View file

@ -539,9 +539,19 @@ enum plugin_status plugin_start(const void* parameter)
/* Lap timer */
case STOPWATCH_LAP_TIMER:
lap_times[curr_lap%MAX_LAPS] = stopwatch;
curr_lap++;
update_lap = true;
/*check if we're timing, and start if not*/
if (counting)
{
lap_times[curr_lap%MAX_LAPS] = stopwatch;
curr_lap++;
update_lap = true;
}
else
{
counting = ! counting;
start_at = *rb->current_tick;
stopwatch = prev_total + *rb->current_tick - start_at;
}
break;
/* Scroll Lap timer up */