Optimiziing TravelStraight function using gyroscope

Hi, I am looking to optimize my TravelStraightForward18cm() function by making its logic simpler and faster to process. Currently, the function i have does work without any problems as i have tested it on my robot. But, I have noticed that when i upload the whole program, my program crashes sometimes. I suspect it could be due to complicated or long logic statements. If you guys can let me know how to write it simpler, i'd be happy to know.

myCode.ino (1.72 KB)

Note that the mpu 6050 gyroscope outputs angles in the range of -180..180 so after 180, its -180,-179, -178,.... so compound statements in while loop are to correct for this range so maximum DeltAngle is +-360 degrees.

Your code is well under the 9500 character limit for a post. Post your code here, rather than requiring people to download it.