|
|
@ -34,7 +34,7 @@ void Stopwatch::stop() {
|
|
|
|
|
|
|
|
|
|
|
|
if (!this->isRunning()) return;
|
|
|
|
if (!this->isRunning()) return;
|
|
|
|
|
|
|
|
|
|
|
|
this->status = STPWTCH_STOPPED;
|
|
|
|
this->state = STPWTCH_STOPPED;
|
|
|
|
this->stopTimestamp = millis();
|
|
|
|
this->stopTimestamp = millis();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -45,7 +45,7 @@ void Stopwatch::pause() {
|
|
|
|
|
|
|
|
|
|
|
|
if (!this->isRunning()) return;
|
|
|
|
if (!this->isRunning()) return;
|
|
|
|
|
|
|
|
|
|
|
|
this->status = STPWTCH_PAUSED;
|
|
|
|
this->state = STPWTCH_PAUSED;
|
|
|
|
this->stopTimestamp = millis();
|
|
|
|
this->stopTimestamp = millis();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -59,7 +59,7 @@ void Stopwatch::start() {
|
|
|
|
if (this->isPaused()) this->accumulator = this->duration();
|
|
|
|
if (this->isPaused()) this->accumulator = this->duration();
|
|
|
|
else this->reset();
|
|
|
|
else this->reset();
|
|
|
|
|
|
|
|
|
|
|
|
this->status = STPWTCH_RUNNING;
|
|
|
|
this->state = STPWTCH_RUNNING;
|
|
|
|
this->startTimestamp = millis();
|
|
|
|
this->startTimestamp = millis();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -68,18 +68,18 @@ void Stopwatch::reset() {
|
|
|
|
debug(PSTR("reset"));
|
|
|
|
debug(PSTR("reset"));
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
this->status = STPWTCH_STOPPED;
|
|
|
|
this->state = STPWTCH_STOPPED;
|
|
|
|
this->startTimestamp = 0;
|
|
|
|
this->startTimestamp = 0;
|
|
|
|
this->stopTimestamp = 0;
|
|
|
|
this->stopTimestamp = 0;
|
|
|
|
this->accumulator = 0;
|
|
|
|
this->accumulator = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool Stopwatch::isRunning() {
|
|
|
|
bool Stopwatch::isRunning() {
|
|
|
|
return (this->status == STPWTCH_RUNNING) ? true : false;
|
|
|
|
return (this->state == STPWTCH_RUNNING) ? true : false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool Stopwatch::isPaused() {
|
|
|
|
bool Stopwatch::isPaused() {
|
|
|
|
return (this->status == STPWTCH_PAUSED) ? true : false;
|
|
|
|
return (this->state == STPWTCH_PAUSED) ? true : false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
uint16_t Stopwatch::duration() {
|
|
|
|
uint16_t Stopwatch::duration() {
|
|
|
|