     key = kpd.getKey();
     if (key.state == KEY_DOWN || key.state == MULTI_KEY_DOWN)
       return key.character;
+  }
+}
+
+void waitUntilUnpressed() {
+  while(true) {
+    key = kpd.getKey();
+    if (key.state == KEY_UP)
+      return;
   }
 }
 

        digitalWrite(LED_BUILTIN, LOW);
        backlightTimeout = millis() + BACKLIGHT_PERIODS;
        autoOffBacklight = true;
    }
  }
}

  setCursorPos();
  chrCtr = 0;
  displayInputMode();
  boolean isCompleted = false;
  while (true) {
    key = kpd.getKey();
    switch (key.state) {
