tft as a user interface keeps crashing

Greetings all!

I have a project that involves a tft screen. I have set the code up to mimic a multi page interface. It works GREAT!!!.. until it doesn’t. I have confirmed that the arduino is still breathing because the screen backlight time out functions as it should.

Please help!

  1. won’t recognize button 5 that I haphazardly added just before uploading.
  2. can’t figure out why program stops updating button presses after a few minutes (haven’t figured out exactly how long yet).

I know enough to put parts together but have shaky understanding of the components, syntax, and limitations of certain data types.

Thanks in advance for taking the time to look at my code!
::EDIT::
Code was too big to post and is attached

adruino mega 2560
seeed 2.8" tft

gravesmegamaster.ino (28.4 KB)

Is there a reason that you don’t post your code as described in the "how to use this forum-please read" stickies? More people will see your code if you post it properly.

I posted the code as an attachment because it exceeds the 9000 character limit. I also posted a link to the project that has copies of the drafts along the way so I could be more thorough. I originally tried to post the code, but the forum wouldn’t let me. I read the “how to use this forum” prior to posting here and after an extensive search for my answer with no results. I look forward to hearing back from you soon! Thanks for your help!

Make all variable types associated with millis() and any calculations with millis() “unsigned long”. Read more here.

Brilliant! Bodmer for the win! Now that you mention it, I remember reading that while using the reference section on the arduino.cc site. It didn't seem important at the time. I knew some value was overflowing and needed you to reconnect the dots. Brain fart on my part. Thank you for your time, Bodmer. I'd have wasted days trying to find the mitsake. What do you think of the rest of the code? Did all the ASCII art help? I sincerely covet any critique or feedback. I have thick skin so pull no punches! Again, thanks taking the time to answer my post!

millis() overflows the int data type after on a few minutes = confirmed!

All I did was go back and change the data types from int to unsigned long. No other data was harmed in the fixing of this mitsake.

That was less painful than the spinal tap that awaits!

|375x500