Well, it seems I was a little premature.
Yes, it was a typo.
Here’s the story: After the 1st compilation I quickly checked the functions and realized I can not enter to Calibration. No matter how long I pressed KEY2 button, there was no 3rd beep and releasing the button always went to Manual trigger (which is after the 2nd beep).
Then I looked the source and found that the loop which checks Delay_Cnt probably never ends.
Main.c:602
<------> while ((Delay_Cnt >0)&&(Delay_Cnt <=2500)){<-><------><------><------><------>// long press^M
Then I found the Delay_Cnt variable and its dangerous usage.
Yes, but it’s still dangerous, a potential trap. “As used here”, this is the keyword. You have to look after from now on. The best avoid is never give the chance to malfunction.
Anyway, I had a problem, I was in hurry and it was faster to recompile the program than doing a deeper analysis. So I did it and voila! It worked.
I thought I solved the problem.
Now I’m not sure anything.
I’ve recompiled your code with unsigned counter, again. Yes, it works properly.
Now I’m not sure anything.
Sorry to suspect you.