 // if it's CW or CCW, reset stage to 0
 byte EncoderState[ENCODER_COUNT];
 
-const byte CWPattern1 = B00011110, CWPattern2 = B01111000, CWPattern3 = B11100001, CWPattern4 = B10000111;
-const byte CCWPattern1 = B00101101, CCWPattern2 = B10110100, CCWPattern3 = B11010010, CCWPattern4 = B01001110;
+//const byte CWPattern1 = B00011110, CWPattern2 = B01111000, CWPattern3 = B11100001, CWPattern4 = B10000111;
+//const byte CCWPattern1 = B00101101, CCWPattern2 = B10110100, CCWPattern3 = B11010010, CCWPattern4 = B01001110;
+const byte CWPattern1 = B00000001, CWPattern2 = B00000111, CWPattern3 = B00001110, CWPattern4 = B00001000;
+const byte CCWPattern1 = B00000010, CCWPattern2 = B00001011, CCWPattern3 = B00001101, CCWPattern4 = B00000100;
+//const byte CWCCWCompareMask = B11111111;
+const byte CWCCWCompareMask = B00001111;
 
 //store the rotary encoder's last pulse time, this will be used to remove the drift effect
 unsigned long prevEncoderMillis[ENCODER_COUNT];

		//we must have such a delay so the digital pin output can go LOW steadily, 
		//without this delay, the row PIN will not 100% at LOW during yet,
		//so check the first column pin's value will return incorrect result.
		delayMicroseconds(3);

		byte colResult[16];
		//pin 38, PD7

		//joyReport.axis[ind] = map(analogRead(54+ind), 0, 1023, -32768,32767 );
	}
	sendJoyReport(&joyReport);
//	delay(20);
}
