 
   
   rec_button.Update();
-  button_state = rec_button.clicks;
-
-  if(button_state == 1){ // single click
+  rec_button_state = rec_button.clicks;
+  if(rec_button_state == 1){ // single click
     Keyboard.press('r');
     Keyboard.release('r');
-  }else if(button_state == 2){ // double click
-    Keyboard.press('p');
-    Keyboard.release('p');
-  }else if(button_state == -1){ // long press
-    Keyboard.press(KEY_ESC);
-    Keyboard.release(KEY_ESC);
+  }
+
+  abort_button.Update();
+  abort_button_state = abort_button.clicks;
+  if(abort_button_state == 1){ // single click
+    Keyboard.press('e');
+    Keyboard.release('e');
   }
 }

  rec_button.debounceTime   = 20;   // Debounce timer in ms
  rec_button.multiclickTime = 250;  // Time limit for multi clicks
  rec_button.longClickTime  = 2500; // time until "held-down clicks" register
}

long pos  = -999;


Encoder encoder(2, 3);
ClickButton rec_button(4, LOW, CLICKBTN_PULLUP);
ClickButton abort_button(7, LOW, CLICKBTN_PULLUP);
int rec_button_state = 0;
int abort_button_state = 0;

void setup() {
  Serial.begin(9600);
