Report Bugs Here

Moderator: Mmiscool

User avatar
By tcpipchip
#57920 Just now i am rewriting the code and making some changes about udp e tcp sockets, transforming some local to global variables, upgrading their size and transforming strings to array of bytes...
Looks that is a bit stable, i can open many instances of the same webserver without crash.
maybe i am dreaming :(
User avatar
By tcpipchip
#57927
tcpipchip wrote:Just now i am rewriting the code and making some changes about udp e tcp sockets, transforming some local to global variables, upgrading their size and transforming strings to array of bytes...
Looks that is a bit stable, i can open many instances of the same webserver without crash.
maybe i am dreaming :(


https://dl.dropboxusercontent.com/u/83554849/ESP8266Basic.cpp.bin
User avatar
By Mmiscool
#57932 What kind of changes are being made here?
Are there any new limitations (string lengths, ect).

Source code?

Example of problem that worked poorly prior to changes?

I am happy to intergrate any thing that has a signifigant benifit.
User avatar
By tcpipchip
#57938
Mmiscool wrote:What kind of changes are being made here?
Are there any new limitations (string lengths, ect).

Source code?

Example of problem that worked poorly prior to changes?

I am happy to intergrate any thing that has a signifigant benifit.


Well, i did UdpBuffer from String to Array of Bytes

char UdpBuffer[2048];

And i did

char Buffer[2048] global;

Both with 2048 bytes

And transfer of data i use

strcpy(UdpBuffer,Buffer);

https://dl.dropboxusercontent.com/u/835 ... 6Basic.ino

Looks that is working better! I can instance many tabs on browser for the same page!

Well...please, test there before this code

Code: Select allIR  = "IR"
PID = 0
VLU = 0

wprint |<HTML>| & chr(13)
wprint |<HEAD>| & chr(13)
wprint |<meta name="apple-mobile-web-app-capable" content="yes" />|
wprint |<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />|
wprint |<link rel="stylesheet" type="text/css" href="http://randomnerdtutorials.com/ethernetcss.css" />|
wprint |<TITLE>Random Nerd Tutorials Project</TITLE>| & chr(13)
'wprint |<meta http-equiv="refresh" content="5" />| & chr(13)
wprint |</HEAD>| & chr(13)
wprint |<BODY>| & chr(13)
wprint |<H1>Random Nerd Tutorials Project</H1>| & chr(13)
wprint |<hr />| & chr(13)
wprint |<br />| & chr(13)
wprint |<H2>Arduino with Ethernet Shield</H2>| & chr(13)
wprint |<br />| & chr(13)
wprint |<a href="/msg?button=1on"">Turn On LED</a>| & chr(13)
wprint |<a href="/msg?button=1off"">Turn Off LED</a><br />| & chr(13)
wprint |<br />| & chr(13)
wprint htmlvar(PID)
wprint |<br />| & chr(13)
wprint htmlvar(VLU)
wprint |<br />| & chr(13)
wprint htmlvar(IR)
wprint |<br />| & chr(13)
wprint |<br />| & chr(13)
wprint |<a href="/msg?button=2on"">Rotate Left</a>| & chr(13)
wprint |<a href="/msg?button=2off"">Rotate Right</a><br />| & chr(13)
wprint |<p>Created by Rui Santos. Visit http://randomnerdtutorials.com for more projects!</p>| & chr(13)
wprint |<br />| & chr(13)
wprint |</BODY>| & chr(13)
wprint |</HTML>| & chr(13)                  
'---------------------------------

tft.setup(16, 4, 3)
tft.touch.setup(15)

tft.cls
tft.fill(tft.rgb(0,255,0))

tft.line(10,10,20,20,tft.rgb(255,0,0))

tft.text.color(tft.rgb(202,172,209))
tft.text.cursor(160,5)
tft.print("RPM")
tft.text.color(tft.rgb(50,34,11))
tft.text.cursor(160,55)
tft.print("TMP")
tft.text.color(tft.rgb(144,137,126))
tft.text.cursor(160,105)
tft.print("VEL")
tft.text.color(tft.rgb(235,78,56))
tft.text.cursor(160,155)
tft.print("MAF")
tft.text.color(tft.rgb(25,89,215))
tft.text.cursor(160,205)
tft.print("POS")

'tft.bmp("/uploads/cat.bmp")

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))

for l=1 to 100 step 10
tft.obj.setvalue(bar1, l)
tft.obj.setvalue(bar2, l)
tft.obj.setvalue(bar3, l)
tft.obj.setvalue(bar4, l)
tft.obj.setvalue(bar5, l)
next l

lab2 = tft.obj.label("19:41:16",90,120,100,18, 2, tft.rgb(0,255,0))

tft.circle.fill(160,200,50,65535)

tft.rect.round(10,10,100,100,5,tft.rgb(0,0,255))

tft.rect.fill(10,10,20,20,tft.rgb(0,0,255))

tft.circle(160,90,50,65535)

but1 = tft.obj.button("SEL", 5,0,150,70,4)
but2 = tft.obj.button("SEL", 5,175,150,70,4)

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

chk1 = tft.obj.checkbox("Check Me", 5,80,40,1, 3, 65535, 0)

rad1 = tft.obj.radio("Radio", 5,130,50,1, 3)

Telnetbranch [answer]
aaa = telnet.client.connect("192.168.1.111", 1024)

CNT = 0
RCV = 0
OPTION = 1

udpbegin 1025
UdpBranch [received]
Timer 1000, [rpm]
touchbranch [touchme]
msgbranch [mybranch]

ir.recv.setup(2)
irbranch [infrared]

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

if touch_obj = but2 then
  tft.obj.invert(but2)
end if

if touch_obj = chk1 then
  tft.obj.setlabel(lab1, "checkbox")
  tft.obj.invert(chk1)
end if

if touch_obj = rad1 then
  tft.obj.invert(rad1)
end if

return

[answer]
CNT = CNT + 1
tft.obj.setlabel(but2,str(CNT))
tcp = telnet.client.read.str()
tft.obj.setlabel(lab2, tcp)
wait

[rpm]
PID = PID + 1
udpwrite "192.168.1.111", 1025, "VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV"
ccc = telnet.client.write(      "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" & chr(13))
tft.obj.setlabel(but1,str(PID))
tft.obj.setlabel(bar3,mens4)
tft.obj.setlabel(bar4,mens5)
tft.obj.setvalue(bar1, mens3)
mens1 = str(PID)
x = mens3
tft.obj.invert(but1)
wait

[received]
rec = udpread()
RCV = RCV + 1
tft.obj.setlabel(bar1,str(RCV))
tft.obj.setlabel(lab2, rec)
'serialprintln rec
return

[Pressed]
wprint "pressed"
wait

[mybranch]
VLU = VLU + 1
butt = msgget("button")
serialprintln butt
'msgreturn butt
RETURNGUI
wait

[load]
'wprint "Very cool"
wait

[infrared]
let r = ir.recv.full()
'serialprintln r
s = instr(r,"e17a807f:NEC:32")
if s>0 then
   serialprintln "Pressed 1"
   IR = r
   RETURNGUI
   return
end if
s = instr(r,"e17a40bf:NEC:32")
if s>0 then
   serialprintln "Pressed 2"
   IR = r
   RETURNGUI
   return
end if
return













Config Hercules

Image
Image

Here is Hercules software

http://www.hw-group.com/products/hercules/index_en.html

I am send udp and tcp packages to hercules and then it do a echo!

Please, see if you find differences in your tests!!!!