     }
   }
   else { //button is depressed. cheer up, button!
-     if (newPos != position) {
+     if (newPos != positionKey) {
       positionKey = newPos;
       DEBUG_PRINT_NUM("encoder key: ", positionKey);
       

  int buttonMode = digitalRead(ENCODER_MODE_SWITCH_PIN);
  if (lastButtonMode != buttonMode) {
     if (buttonMode == HIGH)
       myEnc->write(position * 4);
     else
       myEnc->write(positionKey * 4); 
  }
  
  
  long newPos = myEnc->read() / 4;
  
  if (buttonMode == HIGH) {
    if (newPos != position) {




Encoder myEnc;

void setupKnobs() {
 myEnc.init(ENCODER_PIN_1, ENCODER_PIN_2);
  
 pinMode(ENCODER_MODE_SWITCH_PIN, INPUT);
 digitalWrite(ENCODER_MODE_SWITCH_PIN, HIGH); //enable pullup 
}

int32_t position  = 32;
int32_t positionKey  = 36;

bool lastButtonMode = HIGH;

