Skip to content

Commit 64e1218

Browse files
committed
Fixed a bug that caused the program to falter when spinning fast.
1 parent 9e61772 commit 64e1218

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

GroveEncoder.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ inline bool GroveEncoder::pushToQueue( unsigned char myValue )
5353
{
5454
if ( queueIsFull() )
5555
{
56-
Serial.println( "Queue full, overwriting!" );
56+
//Serial.println( "Queue full, overwriting!" );
5757
}
5858
pinDataQueue[INDEX_MASK( writeIndex )] = myValue;
5959
writeIndex++;
@@ -81,7 +81,7 @@ inline unsigned char GroveEncoder::popFromQueue()
8181
outValue = pinDataQueue[INDEX_MASK( readIndex )];
8282
readIndex++;
8383
} else {
84-
Serial.println( "Popped from empty queue" );
84+
//Serial.println( "Popped from empty queue" );
8585
}
8686
return(outValue);
8787
}
@@ -234,6 +234,8 @@ void GroveEncoder::processQueue()
234234
/* failed to stay consistent! */
235235
stage = STAGE_ZERO;
236236
}
237+
}else{
238+
stage = STAGE_ZERO;
237239
}
238240
continue;
239241

@@ -251,7 +253,7 @@ void GroveEncoder::processQueue()
251253
continue;
252254

253255
default:
254-
Serial.println( "Default is bad" );
256+
//Serial.println( "Default is bad" );
255257
DUMP_STATE();
256258
break;
257259
}
@@ -317,5 +319,3 @@ GroveEncoder::GroveEncoder( int pin, void(*optionalCallBack)(int, bool) )
317319
attachInterrupt( digitalPinToInterrupt( LOW_PIN ), privateIntHandler, CHANGE );
318320
attachInterrupt( digitalPinToInterrupt( HIGH_PIN ), privateIntHandler, CHANGE );
319321
}
320-
321-

GroveEncoder.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ class GroveEncoder {
2020
int getValue();
2121
int button_flag;
2222
void setValue( int newValue );
23-
24-
2523
void resetValue();
2624

2725

examples/encoderTest/encoderTest.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#include <GroveEncoder.h>
1+
#include "GroveEncoder.h"
22

33
int value = 0;
44
int bt_flag = 0;

0 commit comments

Comments
 (0)