What exactly do you mean when you say the program "spams".
As originally written, the code should lock up in the while loop and never do anything else, since the value of crsx and oldval never change within the while loop. Also, the while loop condition is basically
while (crsx != oldval)
which would require a lot less code to execute.
< edit >
The code you posted will continuously print "hello" and re-write the tft display, until the trimmer pot changes, at which time the condition for the while loop becomes true, and the code goes into the endless while loop.
You may want a dead spot where any change less than 2 or more depending on your pot (know from joysticks and flight sims) ... don't set oldval to the little changes, only change past the dead zone.