Open-Smartwatch/open-smartwatch-os

stopwatch bug

Closed this issue · 2 comments

I found a bug when I click the reset and continue buttons of the stopwatch at the same time, the time will increase unexpectedly.

  if (hal->btnHasGoneDown(BUTTON_3)) {
    if (reset) {  // Start
      start = hal->getLocalTime();
    } else {  // Continue
      sumPaused += diff;
      start = hal->getLocalTime();
    }
    running = true;
    reset = false;
  }

  if (hal->btnHasGoneDown(BUTTON_2)) {
    if (running) {  // Stop
      running = false;
    } else {  // Reset
      diff = 0;
      sumPaused = 0;
      reset = true;
    }
  }

Should be fixed - could you confirm this with a fresh build from the develop branch?

Yes - It fixes perfectly.