Merge pull request #3612 from jbrazio/feature/stopwatch-misc
Renamed stopwatch::status to stopwatch::state
This commit is contained in:
commit
dd26c67bab
@ -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() {
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
// Print debug messages with M111 S2 (Uses 156 bytes of PROGMEM)
|
// Print debug messages with M111 S2 (Uses 156 bytes of PROGMEM)
|
||||||
//#define DEBUG_STOPWATCH
|
//#define DEBUG_STOPWATCH
|
||||||
|
|
||||||
enum StopwatchStatus {
|
enum StopwatchState {
|
||||||
STPWTCH_STOPPED,
|
STPWTCH_STOPPED,
|
||||||
STPWTCH_RUNNING,
|
STPWTCH_RUNNING,
|
||||||
STPWTCH_PAUSED
|
STPWTCH_PAUSED
|
||||||
@ -41,7 +41,7 @@ enum StopwatchStatus {
|
|||||||
*/
|
*/
|
||||||
class Stopwatch {
|
class Stopwatch {
|
||||||
private:
|
private:
|
||||||
StopwatchStatus status;
|
StopwatchState state;
|
||||||
uint16_t accumulator;
|
uint16_t accumulator;
|
||||||
uint32_t startTimestamp;
|
uint32_t startTimestamp;
|
||||||
uint32_t stopTimestamp;
|
uint32_t stopTimestamp;
|
||||||
|
Loading…
Reference in New Issue
Block a user