Skip to content

Commit

Permalink
rollercode is otx PR opentx#8564
Browse files Browse the repository at this point in the history
  • Loading branch information
olliw42 committed Jun 24, 2021
1 parent 9c594a6 commit 8198355
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 31 deletions.
9 changes: 0 additions & 9 deletions radio/src/opentx.h
Expand Up @@ -811,15 +811,6 @@ bool setTrimValue(uint8_t phase, uint8_t idx, int trim);

#if defined(PCBSKY9X)
#define ROTARY_ENCODER_GRANULARITY (2 << g_eeGeneral.rotarySteps)
//OW that's the original code
//RistoRoller, just comment it out for it
/*
#elif defined(RADIO_FAMILY_T16) && !defined(RADIO_T18)
#define ROTARY_ENCODER_GRANULARITY (1)
#elif defined(RADIO_TX12)
#define ROTARY_ENCODER_GRANULARITY (1)
*/
//OWEND
#else
#define ROTARY_ENCODER_GRANULARITY (2)
#endif
Expand Down
28 changes: 6 additions & 22 deletions radio/src/targets/common/arm/stm32/rotary_encoder_driver.cpp
Expand Up @@ -73,26 +73,11 @@ void rotaryEncoderCheck()
{
#if (defined(RADIO_FAMILY_T16) && !defined(RADIO_T18)) || defined(RADIO_TX12)
static uint8_t state = 0;
uint8_t pins = ROTARY_ENCODER_POSITION();
uint8_t pins;

if (pins != (state & 0x03) && !(readKeys() & (1 << KEY_ENTER))) {
//OW that's the original code
/*
if ((pins & 0x01) ^ ((pins & 0x02) >> 1)) {
if ((state & 0x03) == 3)
++rotencValue;
else
--rotencValue;
}
else
{
if ((state & 0x03) == 3)
--rotencValue;
else if ((state & 0x03) == 0)
++rotencValue;
}
*/
//RistoRoller, based on MikeBlandford's code
pins = ROTARY_ENCODER_POSITION();

if (pins != (state & 0x03)) {
if ((pins ^ (state & 0x03)) == 0x03) {
if (pins == 3) {
rotencValue += 2;
Expand All @@ -109,9 +94,8 @@ void rotaryEncoderCheck()
rotencValue += 1;
}
}
//OWEND
state &= ~0x03 ;
state |= pins ;
state &= ~0x03;
state |= pins;
#else
uint8_t newPosition = ROTARY_ENCODER_POSITION();
if (newPosition != rotencPosition && !(readKeys() & (1 << KEY_ENTER))) {
Expand Down

0 comments on commit 8198355

Please sign in to comment.