Browse files

cleanup

  • Loading branch information...
1 parent b6dfffd commit c4634dc0b49096137f29b455cb9c28444662f953 @kra kra committed Jul 30, 2012
Showing with 0 additions and 87 deletions.
  1. +0 −61 effects/Metro/Metro.cpp-
  2. +0 −26 effects/Metro/Metro.h-
View
61 effects/Metro/Metro.cpp-
@@ -1,61 +0,0 @@
-
-#include "WProgram.h"
-#include "Metro.h"
-
-
-Metro::Metro(unsigned long interval_millis)
-{
- interval(interval_millis);
- reset();
-}
-
-// New creator so I can use either the original check behavior or benjamin.soelberg's
-// suggested one (see below)
-
-Metro::Metro(unsigned long interval_millis, uint8_t autoreset)
-{
- this->autoreset = autoreset;
- interval(interval_millis);
- reset();
-}
-
-void Metro::interval(unsigned long interval_millis)
-{
- this->interval_millis = interval_millis;
-}
-
-char Metro::check()
-{
- if (millis() - this->previous_millis >= this->interval_millis) {
- // As suggested by benjamin.soelberg@gmail.com, the following line
- // this->previous_millis = millis();
- // was changed to
- // this->previous_millis += this->interval_millis;
-
- // But then a bug would sometimes occur when the interval was set with random,
- // so I added the following check to reinstate the previous behavior, but I am
- // not sure this fixes it
-
- if (this->interval_millis == 0 || this->autoreset ) {
- this->previous_millis = millis();
- } else {
- this->previous_millis += this->interval_millis;
- }
-
- return 1;
- }
-
-
-
- return 0;
-
-}
-
-void Metro::reset()
-{
-
- this->previous_millis = millis();
-
-}
-
-
View
26 effects/Metro/Metro.h-
@@ -1,26 +0,0 @@
-
-
-#ifndef Metro_h
-#define Metro_h
-
-#include <inttypes.h>
-
-class Metro
-{
-
-public:
- Metro(unsigned long interval_millis);
- Metro(unsigned long interval_millis, uint8_t autoreset);
- void interval(unsigned long interval_millis);
- char check();
- void reset();
-
-private:
- uint8_t autoreset;
- unsigned long previous_millis, interval_millis;
-
-};
-
-#endif
-
-

0 comments on commit c4634dc

Please sign in to comment.