Easier rotary encoder inversion code (#1326)
* Easier inversion code. * Evaluate define INVERTED_ROTARY_ENCODER instead. * Make Zorro roller direction more natural and matching also TX16S navigation style.
This commit is contained in:
@@ -104,18 +104,14 @@ void rotaryEncoderCheck()
|
|||||||
#else
|
#else
|
||||||
uint8_t newPosition = ROTARY_ENCODER_POSITION();
|
uint8_t newPosition = ROTARY_ENCODER_POSITION();
|
||||||
if (newPosition != rotencPosition && !(readKeys() & (1 << KEY_ENTER))) {
|
if (newPosition != rotencPosition && !(readKeys() & (1 << KEY_ENTER))) {
|
||||||
|
#if defined(ROTARY_ENCODER_INVERT)
|
||||||
|
if (!((rotencPosition & 0x01) ^ ((newPosition & 0x02) >> 1))) {
|
||||||
|
#else
|
||||||
if ((rotencPosition & 0x01) ^ ((newPosition & 0x02) >> 1)) {
|
if ((rotencPosition & 0x01) ^ ((newPosition & 0x02) >> 1)) {
|
||||||
#if defined(ROTARY_ENCODER_INVERT)
|
|
||||||
++rotencValue;
|
|
||||||
#else
|
|
||||||
--rotencValue;
|
|
||||||
#endif
|
#endif
|
||||||
|
--rotencValue;
|
||||||
} else {
|
} else {
|
||||||
#if defined(ROTARY_ENCODER_INVERT)
|
|
||||||
--rotencValue;
|
|
||||||
#else
|
|
||||||
++rotencValue;
|
++rotencValue;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
rotencPosition = newPosition;
|
rotencPosition = newPosition;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user