Can we use enroll and finger print function in same code?

I have tried to make a program where if i press button ‘A’ in keypad , it will ask password and after putting correct password finger print function will start. But if we press ‘C’ button then enroll function will run please see below code. But enroll function is not working in enrolling process i have to submit ID to add new finger print but i am not able to do that every time code stuck at this “ID GETTING” process. Please help.

fingerprintlcdservocombo.ino (19 KB)

readKeypad() leaves a lot to be desired. Every numeric case in the switch(key) statement does exactly the same thing, using hardcoded values that are exactly the same as key+'0'.

The 'C' case is also a mess. The while(true) loop will be entered, where you wait for a key to be pressed. When a key is pressed, you determine if it is a digit. If not, you break out of the while(true) loop. If it IS a digit, you manipulate id, and then wait forever for a fingerprint to be enrolled for id. There is just no way for someone to enter an ID value greater than 10.

What does the code actually do? Why are there no Serial.print() statements to help you debug the code?