Adds support for correct Alps EC10E roller hookup (#261)
Enhanced roller update (thx to Mike Blandford https://www.rcgroups.com/forums/showpost.php?p=46929617&postcount=9974 ) * TX12 should also have ROTARY_ENCODER_GRANULARITY 2
This commit is contained in:
@@ -580,10 +580,6 @@ bool setTrimValue(uint8_t phase, uint8_t idx, int trim);
|
|||||||
|
|
||||||
#if defined(PCBSKY9X)
|
#if defined(PCBSKY9X)
|
||||||
#define ROTARY_ENCODER_GRANULARITY (2 << g_eeGeneral.rotarySteps)
|
#define ROTARY_ENCODER_GRANULARITY (2 << g_eeGeneral.rotarySteps)
|
||||||
#elif defined(RADIO_FAMILY_T16) && !defined(RADIO_T18)
|
|
||||||
#define ROTARY_ENCODER_GRANULARITY (1)
|
|
||||||
#elif defined(RADIO_TX12)
|
|
||||||
#define ROTARY_ENCODER_GRANULARITY (1)
|
|
||||||
#else
|
#else
|
||||||
#define ROTARY_ENCODER_GRANULARITY (2)
|
#define ROTARY_ENCODER_GRANULARITY (2)
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -72,25 +72,34 @@ void rotaryEncoderInit()
|
|||||||
void rotaryEncoderCheck()
|
void rotaryEncoderCheck()
|
||||||
{
|
{
|
||||||
#if (defined(RADIO_FAMILY_T16) && !defined(RADIO_T18)) || defined(RADIO_TX12)
|
#if (defined(RADIO_FAMILY_T16) && !defined(RADIO_T18)) || defined(RADIO_TX12)
|
||||||
static uint8_t state = 0;
|
static uint8_t state = 0;
|
||||||
uint8_t pins = ROTARY_ENCODER_POSITION();
|
uint8_t pins = ROTARY_ENCODER_POSITION();
|
||||||
|
|
||||||
if (pins != (state & 0x03) && !(readKeys() & (1 << KEY_ENTER))) {
|
if (pins != (state & 0x03) && !(readKeys() & (1 << KEY_ENTER))) {
|
||||||
if ((pins & 0x01) ^ ((pins & 0x02) >> 1)) {
|
if ((pins ^ (state & 0x03)) == 0x03)
|
||||||
if ((state & 0x03) == 3)
|
{
|
||||||
++rotencValue;
|
if (pins == 3)
|
||||||
else
|
{
|
||||||
--rotencValue;
|
rotencValue += 2;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ((state & 0x03) == 3)
|
rotencValue -= 2;
|
||||||
--rotencValue;
|
}
|
||||||
else if ((state & 0x03) == 0)
|
}
|
||||||
++rotencValue;
|
else
|
||||||
}
|
{
|
||||||
state &= ~0x03 ;
|
if ((state & 0x01) ^ ((pins & 0x02) >> 1))
|
||||||
state |= pins ;
|
{
|
||||||
|
rotencValue -= 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rotencValue += 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
state &= ~0x03;
|
||||||
|
state |= pins;
|
||||||
#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))) {
|
||||||
|
|||||||
Reference in New Issue
Block a user