Interfacing GSM module code optimization

Your code was easy to understand, adapt and implement. I have saved it and will use it more in the future to get rid of delay(), for example.

But you are right, switch cases can be very powerful and they have helped me in the past with momentary switches:

https://github.com/marianopw/multiple-buttons-with-multiple-actions/blob/master/Multiple-buttons-singlepress-dobleclick-hold-longhold.ino

I was lucky to find this code in the forum and nowadays I use it to handle my buttons in most projects. The remote controller I use with my radio control gliders only has 3 buttons but each button has 4 functions thanks to this code.