diff --git a/src/board_gruvin9x.cpp b/src/board_gruvin9x.cpp index 25c0aa935..4bcf3da17 100644 --- a/src/board_gruvin9x.cpp +++ b/src/board_gruvin9x.cpp @@ -145,18 +145,18 @@ ISR(USART1_RX_vect) /* Filter the 9th bit, then return */ resh = (resh >> 1) & 0x01; res = ((resh << 8) | resl); - if((res == 0x181) | (res == 0x1C1)){ //button REb filter - keys[BTN_REb].input((res & 0x1C1) == 0x1C1, BTN_REb); + if((res == 0x180) | (res == 0x1C0)){ //button REb filter + keys[BTN_REa].input((res & 0x1C0) == 0x1C0, BTN_REa); } else if((res & 0x100) == 0x100){ //rotary filter vpotToChange = res & 0xEF; vpot_mod_state = 1; } else { - if(vpot_mod_state & (vpotToChange>0) & (vpotToChange<=NUM_UART_ROTARY_ENCODERS)) + if(vpot_mod_state & (vpotToChange < NUM_ROTARY_ENCODERS)) { int8_t vpot_inc = res & 0xFF; if(vpot_inc){ - incRotaryEncoder((NUM_ROTARY_ENCODERS - NUM_UART_ROTARY_ENCODERS) + (vpotToChange - 1), vpot_inc); + incRotaryEncoder(vpotToChange, vpot_inc); } vpot_mod_state = 0; } @@ -266,10 +266,8 @@ void readKeysAndTrims() #if !defined(EXTRA_ROTARY_ENCODERS) keys[BTN_REa].input(~PIND & 0x20, BTN_REa); +#endif //!EXTRA_ROTARY_ENCODERS keys[BTN_REb].input(~PIND & 0x10, BTN_REb); -#else //EXTRA_ROTARY_ENCODERS - keys[BTN_REa].input(~PIND & 0x10, BTN_REa); -#endif //EXTRA_ROTARY_ENCODERS uint8_t tin = ~PINL; uint8_t in; diff --git a/src/open9x.cpp b/src/open9x.cpp index ed3cd6ec5..6c5994a64 100644 --- a/src/open9x.cpp +++ b/src/open9x.cpp @@ -2503,24 +2503,17 @@ ISR(INT3_vect) } #endif //EXTRA_ROTARY_ENCODERS -#if !defined(EXTRA_ROTARY_ENCODERS) -#define ENC_B_ID 1 -#else -#define ENC_B_ID 0 -#endif - - ISR(INT5_vect) { uint8_t input = PINE & 0b01100000; - if (input == 0 || input == 0b01100000) incRotaryEncoder(ENC_B_ID, +1); + if (input == 0 || input == 0b01100000) incRotaryEncoder(1, +1); } ISR(INT6_vect) { uint8_t input = PINE & 0b01100000; - if (input == 0 || input == 0b01100000) incRotaryEncoder(ENC_B_ID, -1); + if (input == 0 || input == 0b01100000) incRotaryEncoder(1, -1); } -#endif +#endif //PCBV4 #if !defined(PCBARM) extern unsigned char __bss_end ;