First, you need to bring wait(20, msec) inside while(1) loop of the user control function.
Then you may need to add explicit gyro initialization timeout to your pre auton function. See this example: Vex Coding Studio Gyro endless counting - #6 by technik3k
Also, you don’t need while(1) loop and long sleep in the autonomous function.
Finally, you need to avoid writing to controller screen very often, as it only updates every 50 msec.