Need little help with this code

The code is to control a motor

it is supposed to do :

void loop :

when it starts just stay in standby mode (void loop) and checks if ther is a press in call button and in the same time checks safety inputs

void stop_car :
while the program is in ''Void loop'' function if there is a safety off (stop and limit switch) then calls the ''void stop_car()'' function where it stays in loop until the safeties are on again . if the stop safeties are On again then returns to ''void loop'' function

also as it is in ''void loop'' checks some other safeties like locks and contacts and if they are off then sends comand all the relay of the motor be low

void Run_Test :
after the press of the button and if are all the safeties are ON goes to '' void Run_Test() '' function and stars to move the motor

if the motor is running and one of the above safeties goes off then the loop stops and goes to ''void loop'' where it checks safeties and do the actions i described in the ''void loop''

void timeError :
Also if the motor is running for some time

if that time is reached then stops all action and goes to ''void timeError()'' that stays in loop until a reset button is pressed

all the above are tested and worked... the only problem is that after the ''timeError'' when i reset it goes to ''void loop'' as it was supposed to go but doesnt stay in stand by mode... it goes again to ''
void Run_Test'' like if i had pressed the button again (but i dont)

it is like it keeps in memory the first call of the button.

that why i decide to use flags for button press but i didnt achieve to solve the problem even with them... something i have done wrong for sure...

that is why i need a more experience eye to notice the mistake