Added previous duration

This commit is contained in:
Thomas O Fredericks
2018-09-11 10:09:57 -04:00
parent d3ef0365eb
commit d422d7c054
2 changed files with 12 additions and 6 deletions
+4 -4
View File
@@ -107,12 +107,12 @@ bool Bounce::update()
return getStateFlag(CHANGED_STATE);
}
/*
// WIP HELD
unsigned long Bounce::held() {
unsigned long Bounce::previousDuration() {
return durationOfPreviousState;
}
*/
unsigned long Bounce::duration() {
return (millis() - stateChangeLastTime);
}
@@ -120,7 +120,7 @@ unsigned long Bounce::duration() {
inline void Bounce::changeState() {
toggleStateFlag(DEBOUNCED_STATE);
setStateFlag(CHANGED_STATE) ;
// WIP HELD : durationOfPreviousState = millis() - stateChangeLastTime;
durationOfPreviousState = millis() - stateChangeLastTime;
stateChangeLastTime = millis();
}