Enter and exit a function with a PIN only.

Hello
As I said, someone can tell me if the use of millis is correct in the function, so I researched I think it's fine, but the code does not work will be the use of the wrong millis
Thanks