Pulling my hair out again! I am trying to create a menu on a TFT display. I just want to move a cursor to four selections, but it freezes on the third line. It is certainly possible I am using the wrong approach. Can anyone see a obvious f___up? Annex32 1.43
Thanks
Zim
Code: [Local Link Removed for Guests]
CODE: xxxx.bas
--------------------------------------------------------------------------------
'Encoder esp32
tft.init 1
gui.init 20, black
Gui.AutoRefresh 30
txt0 = GUI.Textline(150,0,0,0, "Fuel Injectors", 5) 'x,y,w,h,text,fontsize
txt1 = GUI.Textline(150,70,0,0, "2 Minute Clean", 3) 'x,y,w,h,text,fontsize
txt2 = GUI.Textline(150,100,0,0, "4 Minute Clean", 3) 'x,y,w,h,text,fontsize
txt3 = GUI.Textline(150,130,0,0, "Idle Flow Test", 3) 'x,y,w,h,text,fontsize
txt4 = GUI.Textline(150,160,0,0, "WOT Flow Test", 3) 'x,y,w,h,text,fontsize
count = 3
S1 = 34
S2 = 35
PB = 25
pin.mode S1, input
pin.mode S2, input
pin.mode PB, input
interrupt S2, injector
wait
injector:
if pin(S1) = 0 then return ' if the pin is high, returns back
if pin(S2) = pin(S1) then count = count - 1 else count = count + 1
if count < 4 then let count = 4 'gives a range of 4 - 7
if count > 7 then let count = 7
cursor4 = GUI.Textline(45,70,0,0, ">>",3,0) 'x,y,w,h,text,fontsize 'erases previous cursors
cursor5 = GUI.Textline(45,100,0,0, ">>",3,0) 'x,y,w,h,text,fontsize
cursor6 = GUI.Textline(45,130,0,0, ">>",3,0) 'x,y,w,h,text,fontsize
cursor7 = GUI.Textline(45,160,0,0, ">>",3,0) 'x,y,w,h,text,fontsize
if count = 4 then let cursor4 = GUI.Textline(45,70,0,0, ">>",3) 'x,y,w,h,text,fontsize 'invokes cursor as per count
if count = 5 then let cursor5 = GUI.Textline(45,100,0,0, ">>",3) 'x,y,w,h,text,fontsize
if count = 6 then let cursor6 = GUI.Textline(45,130,0,0, ">>",3) 'x,y,w,h,text,fontsize
if count = 7 then let cursor7 = GUI.Textline(45,160,0,0, ">>",3) 'x,y,w,h,text,fontsize
wlog count
return