From 2ca6fe1a7700cdaf39805677c8cff05e3f022e00 Mon Sep 17 00:00:00 2001 From: Michael Giacomelli Date: Wed, 13 Jun 2012 22:22:34 -0400 Subject: [PATCH] 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 Tested-by: Michael Giacomelli --- apps/plugins/stopwatch.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) mode change 100644 => 100755 apps/plugins/stopwatch.c diff --git a/apps/plugins/stopwatch.c b/apps/plugins/stopwatch.c old mode 100644 new mode 100755 index 7a7828b3f3..49f633a2a9 --- a/apps/plugins/stopwatch.c +++ b/apps/plugins/stopwatch.c @@ -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 */