This looks like a lot of self-inflicted injury compounded with a strange unresponsiveness and a wandering focus reminiscent of those old drunkard walk programming problems.
Others have repeatedly asked for the TS to identify the rotary switch (even in a previous thread) but it does not happen. Yes, a link to a data sheet is provided that contains 4/10/16 position switches all of which are 6-pin in both SMT and through-hole packages.
If we assume that it is a 4-position variety, then what I see (and I could have made a mistake) from the schematic is the following (SP=switch position 0-3), SG (switch pin grounded for that position), L=line as named in the schematic and code, PB=connection to port bit:
SP SG L PB
0 3 Time2 RA3
1 1 Time1 RA2
2 6 Time4 RA5
3 4 Time3 RA4
Notice that the sequence that is followed in the schematic (RA2-RA5) and the code (Time1-Time4) is not followed by the switch position.
But, what is even more interesting is what happens when you consider the case if U1 is either the 10 or 16 position variety. Pin 6 of U1 is connected to the 10K pull up and the Time4 line will only go low when the switch is in positions 8-9 (or 8-15) and never when in position 4.
Of course, it is only a guessing game, but I am thinking it may be the case because he refers to positions 1-4 and not (0-3) suggesting he is using a 10 (or 16) position switch. If this is the case, then the problem is further compounded because position 3 will ground two pins on U1 (1, 4).
In these cases, the subroutine would never see Time4=0 and never set the delay interval. It would still not exit the subroutine, except if the master switch is low or the processor resets for some other reason. Then again, there could be many other problems and I could simply be wrong.