       Serial.write('=');
       Serial.println(state);
       m_lastPinState = state;
-      updateJoystick();
-    }
-  }
-}
-
-// map to joystick events
-void digitalPin::updateJoystick() const {
-  uint8_t buttonId = 0x80;
-  switch (m_id) {
-    case 10:
-      buttonId = 6;
-      break;
-    case 11:
-      buttonId = 7;
-      break;
-  }
-  if (buttonId < 0x80) {
-    Joystick.setButton(buttonId,m_lastPinState);
+      // map to joystick events
+      handleSlaveButton(m_id,m_lastPinState);
+    }
   }
 }
 

		case 9:
			stageabort = state;	// on=abort, off=stage
			break;
	}
//Serial.print("id,state,buttonid,stageabort="); Serial.print(id); Serial.write(' '); Serial.print(state); Serial.write(' '); Serial.print(buttonId); Serial.write(' '); Serial.println(stageabort);
	if (buttonId < 0x80) {
		Joystick.setButton(buttonId,state);

uint8_t joy2switch = 0;

// almost copy from ksp-gegi-mini!

// used from within digitalPin class (not nice, I know!)
void handleSlaveButton(const uint8_t id, const uint8_t state);

class digitalPin {
  public:
