     consumedHeld = false;
   }
 
-  // Read headset level
-  int audioLevel = analogRead(HEADSET_LEVEL_PIN);
-  if (headset != headsetFirstMeasure && (audioLevel > HEADSET_THRESHOLD) != headsetFirstMeasure) {
+  // Read headphone level
+  int audioLevel = analogRead(HEADPHONE_LEVEL_PIN);
+  if (headphone != headphoneFirstMeasure && (audioLevel > HEADPHONE_THRESHOLD) != headphoneFirstMeasure) {
     // confirmed change
-    onHeadsetInserted(audioLevel < HEADSET_THRESHOLD);
-    Serial.print("Confirmed change, headset "); Serial.println(headsetFirstMeasure);
-  } else if ((audioLevel < HEADSET_THRESHOLD) != headsetFirstMeasure) {
+    onHeadphoneInserted(audioLevel < HEADPHONE_THRESHOLD);
+    Serial.print("Confirmed change, headphone "); Serial.println(headphoneFirstMeasure);
+  } else if ((audioLevel < HEADPHONE_THRESHOLD) != headphoneFirstMeasure) {
     // there seems to be a change
-    headsetFirstMeasure = (audioLevel < HEADSET_THRESHOLD);
-    Serial.print("Possible change, headset "); Serial.println(headsetFirstMeasure);
+    headphoneFirstMeasure = (audioLevel < HEADPHONE_THRESHOLD);
+    Serial.print("Possible change, headphone "); Serial.println(headphoneFirstMeasure);
   }
 
   return READ_DELAY;


void initializeAmplifier() {
  pinMode(AMPLIFIER_ENABLE_PIN, OUTPUT);
  pinMode(HEADSET_LEVEL_PIN, INPUT_PULLUP);
  enableAmplifier(false);
}


  } else {
    Serial.println("Resume");
    trellis.blinkRate(HT16K33_BLINK_1HZ);
    enableAmplifier(!headphone);
    player.pausePlaying(false);
    nextTimeoutTick = 0; // no timeout during playing
    state = PLAY_SELECTED;
