Report Bugs Here

Moderator: Mmiscool

User avatar
By tcpipchip
#55047 Are the esp8266 basic TFT routines calling the Watch-Dog ?

Can you run many times this code to see if runs or freeze sometimes on BAR ?

Code: Select alltft.setup(16, 4, 1)
tft.touch.setup(15)

bar1 = tft.obj.bar("RPM",200,0,120,30, 2, 65535, tft.rgb(0,25,255))
bar2 = tft.obj.bar("TEMPERA",200,50,120,30, 2, 65535, tft.rgb(0,25,255))
bar3 = tft.obj.bar("VELOCID",200,100,120,30, 2, 65535, tft.rgb(0,25,255))
bar4 = tft.obj.bar("AIRFLOW",200,150,120,30, 2, 65535, tft.rgb(0,25,255))
bar5 = tft.obj.bar("POSITION",200,200,120,30, 2, 65535, tft.rgb(0,25,255))

tft.text.cursor(160,5)
tft.print("RPM")
tft.text.cursor(160,55)
tft.print("TMP")
tft.text.cursor(160,105)
tft.print("VEL")
tft.text.cursor(160,155)
tft.print("MAF")
tft.text.cursor(160,205)
tft.print("POS")

but1 = tft.obj.button("SEL", 5,90,150,70,4)

tft.obj.setlabel(but1,"0000")

Telnetbranch [obdii]

aaa = telnet.client.connect("192.168.1.111", 35000)
bbb = telnet.client.write("ATE0" & chr(13))

PID = 0
OPTION = 1
tft.obj.setvalue(bar1, 100)

Timer 250, [rpm]

touchbranch [touchme]

wait

[touchme]
touch_obj = tft.checktouch()
if touch_obj = but1 then

  tft.obj.invert(but1)

  OPTION = OPTION + 1
  if OPTION = 6 then
     OPTION = 1
  end if

  if OPTION = 1 then
     tft.obj.setvalue(bar1, 100)
  else
     tft.obj.setvalue(bar1, 0)
  end if

  if OPTION = 2 then
     tft.obj.setvalue(bar2, 100)
  else
     tft.obj.setvalue(bar2, 0)
  end if

  if OPTION = 3 then
     tft.obj.setvalue(bar3, 100)
  else
     tft.obj.setvalue(bar3, 0)
  end if

  if OPTION = 4 then
     tft.obj.setvalue(bar4, 100)
  else
     tft.obj.setvalue(bar4, 0)
  end if

  if OPTION = 5 then
     tft.obj.setvalue(bar5, 100)
  else
     tft.obj.setvalue(bar5, 0)
  end if

end if
return

[obdii]
tcp = telnet.client.read.str()
tam = len(tcp)
if tam = 16 or tam = 13 then
   cmd = mid(tcp,6,2)
   if cmd = "0C" then
      tcp = hextoint(replace(mid(tcp,9,5)," ",""))
      tcp = str(int(tcp / 4))
      tft.obj.setlabel(bar1, tcp)
      if OPTION = 1 then
         tft.obj.setlabel(but1,tcp)
      end if
   end if
   if cmd = "05" then
      tcp = hextoint(replace(mid(tcp,9,5)," ",""))
      tcp = str(int(tcp) - 40)
      tft.obj.setlabel(bar2, tcp)
      if OPTION = 2 then
         tft.obj.setlabel(but1,tcp)
      end if
   end if
   if cmd = "0D" then
      tcp = hextoint(replace(mid(tcp,9,5)," ",""))
      tcp = str(int(tcp))
      tft.obj.setlabel(bar3, tcp)
      if OPTION = 3 then
         tft.obj.setlabel(but1,tcp)
      end if
   end if
   if cmd = "10" then
      tcp = hextoint(replace(mid(tcp,9,5)," ",""))
      tcp = str(int(tcp / 100))
      tft.obj.setlabel(bar4, tcp)
      if OPTION = 4 then
         tft.obj.setlabel(but1,tcp)
      end if
   end if
   if cmd = "11" then
      tcp = hextoint(replace(mid(tcp,9,5)," ",""))
      tcp = str(int(tcp * 0.392156))
      tft.obj.setlabel(bar5, tcp)
      if OPTION = 5 then
         tft.obj.setlabel(but1,tcp)
      end if
   end if
end if

wait

[rpm]
PID = PID + 1
if PID = 6 then
   PID = 0
end if
if PID = 1 then
   ccc = telnet.client.write("01 0C" & chr(13))
end if
if PID = 2 then
   ccc = telnet.client.write("01 05" & chr(13))
end if
if PID = 3 then
   ccc = telnet.client.write("01 0D" & chr(13))
end if
if PID = 4 then
   ccc = telnet.client.write("01 10" & chr(13))
end if
if PID = 5 then
   ccc = telnet.client.write("01 11" & chr(13))
end if
wait
User avatar
By Mmiscool
#55062 Each time. A command in espbasic is run the wofi stack is given the opertunity do what it needs to do.