That is good news Francesco, cos the gizmo's are so good that I had already ordered another 2 (making 5 in total).
But my development script keeps rebooting randomly regardless of whether output is to TFT or html webpage... so it is not specifically a TFT problem or a 'webby' problem.
Occasionally it keeps running overnight (
either to TFT or web page), but more usually the device reboots after a few minutes or even a few seconds.
And sometimes the device disconnects from the browser, but the TFT display keeps going for several hours, then the device eventually reboots.
Is not memory leakage though, so perhaps is an unwanted interaction between ble and wifi.
Sometimes it is possible to reconnect the browser to the device, but often the device must be rebooted before it can reconnect.
Sometimes I've closed down the Editor window so their is no browser connection, but still the device randomly reboots after hours or even minutes.
And usually when I try to reconnect the browser with the device still running ok and updating the TFT every 10 secs, the browser will not reconnect until after a device reboot.
I've got my fingers crossed.
PS. It's a bit hacked around by now, but this is what I've been using:
Code: [Local Link Removed for Guests]
option.wdt 0
debuglevel=0 '0=don't wlog BLE devices (normal), 2,3,4 wlog various debug info
sensors$="ATC_9AFEA8.Data=Inside ATC_BEF7AB.Data=Outside abc=Freezer"
records=0
web=1 '0=disable webpage output, 1=enable webpage output
tft=1 '0=disable tft display output, 1=enable tft display output
ram=0
'---- User variables are above
sensors=word.count(sensors$," ")
wlog "Looking for "+str$(sensors)+" sensors"
dim info$(sensors): dim id$(sensors): dim name$(sensors): dim temp$(sensors): dim hum$(sensors): dim batt$(sensors): dim cnt$(sensors)
if records=1 then dim coldest$(sensors): dim whencoldest$(sensors): dim warmest$(sensors): dim whenwarmest$(sensors)
for sensor=1 to sensors
info$ = trim$(word$(sensors$,sensor," "))
if debuglevel=4 then wlog info$
id$(sensor) = word$(info$,1,"=")
name$(sensor) = word$(info$,2,"=")
temp$(sensor) = str$(sensor)
hum$(sensor) = "xx"
batt$(sensor) = "xx"
cnt$(sensor) = ""
if records=1 then
coldest$(sensor) = "xx.x": whencoldest$(sensor) = " at hh:mm:ss on dd/mm/yy"
warmest$(sensor) = "xx.x": whenwarmest$(sensor) = " at hh:mm:ss on dd/mm/yy"
coldest$(sensor) = "": whencoldest$(sensor) = ""
warmest$(sensor) = "": whenwarmest$(sensor) = ""
endif
next sensor
t$=time$
if web=1 then onhtmlreload webpage: onhtmlchange webpage: gosub webpage
if tft=1 then gosub tftpage
onbluetooth ble_receive
bluetooth.scan 10
timer0 1000,clock
wait
clock:
t$=time$
'if web=1 then refresh
if tft=1 then gui.settext clk, t$
return
webpage:
cls
autorefresh 1000
a$=|<br><br>|
a$=a$ + |<div style='display: table;margin-right:auto;margin-left:auto;text-align:center;'>|
a$=a$ + textbox$(t$,"tim") + "<br>"
a$=a$ + cssid$("tim","width:70;text-align:center;")
a$=a$ + |<table id='sensors' align='center' style="background:AliceBlue; border:.5px solid darkgrey; border-collapse: collapse; font-size: 90%;"|
s1$=info$(1): a$=a$ + "<tr><td>" + textbox$(s1$,"sen") + "</td></tr>"
if sensors >= 2 then s2$=info$(2): a$=a$ + "<tr><td>" + textbox$(s2$,"sen") + "</td></tr>"
if sensors >= 3 then s3$=info$(3): a$=a$ + "<tr><td>" + textbox$(s3$,"sen") + "</td></tr>"
a$=a$ + cssid$("sen","width:250;text-align:center;")
a$ = a$ + "</table></div>"
html a$
return
tftpage:
gui.init 6, 0
gui.autorefresh 100, 1
if ram=1 then gui.textline(0,2,320, 30, str$(ramfree),3,cyan,black,0,5,10)
clk=gui.textline(0,2,220, 30, time$,3,white,black,0,5,10)
s1=gui.textline(0,50,320, 30, name$(1),3,black,cyan,white,4,10)
if sensors >= 2 then s2=gui.textline(0,100,320, 30, name$(2),3,black,cyan,white,4,10)
if sensors >= 3 then s3=gui.textline(0,150,320, 30, name$(3),3,black,cyan,white,4,10)
if ram=1 then mem=gui.textline(0,200,320, 30, str$(ramfree),3,yellow,black,0,5,10)
return
showit:
if tft=1 then
if sensor=1 then gui.settext s1,info$(1)
if sensor=2 then gui.settext s2,info$(2)
if sensor=3 then gui.settext s3,info$(3)
if ram=1 then gui.settext mem,str$(ramfree)
endif
if web=1 then
t$=time$
s1$ = info$(1)
s2$ = info$(2)
s3$ = info$(3)
endif
if records=1 then
if (val(temp$(sensor)) < val(coldest$(sensor))) or (coldest$(sensor) = "") then
coldest$(sensor) = temp$(sensor): whencoldest$(sensor) = " at " + time$ + " on " + date$
endif
if (val(temp$(sensor)) > val(warmest$(sensor))) or (warmest$(sensor) = "") then
warmest$(sensor) = temp$(sensor): whenwarmest$(sensor) = " at " + time$ + " on " + date$
endif
endif
return
ble_receive:
select case bluetooth.status
case 1: wlog "BLE Device Connected"
case 2: wlog "BLE Device Disconnected"
case 3:
bluetooth.read_iobuff(0)
for z = 1 to iobuff.len(0)
print iobuff.read(0, z-1),
next z
case 4:
print "scan terminated"
a$ = bluetooth.scanresult$
if debuglevel = 3 then wlog a$: end select: bluetooth.scan 10: return
for sensor=1 to sensors
info$(sensor)=json$(a$, id$(sensor))
if debuglevel = 1 then wlog "Sensor="; str$(sensor), info$(sensor)
if info$(sensor) = "not found" then
info$(sensor)=name$(sensor)+" not found"
else
a = iobuff.fromhex(0, info$(sensor))
temp = iobuff.read(0, 6) * 256 + iobuff.read(0, 7)
if (temp > 32767) then temp = temp - 65536
temp$(sensor) = str$(temp/10)
hum$(sensor) = str$(iobuff.read(0, 8))
batt$(sensor) = str$(iobuff.read(0, 9))
cnt$(sensor) = str$(iobuff.read(0,12))
info$(sensor) = name$(sensor)+": t="+temp$(sensor)+" h="+hum$(sensor)+" b="+batt$(sensor)'+" "+time$
if records=1 then
if (val(temp$(sensor)) < val(coldest$(sensor))) or (coldest$(sensor) = "") then
coldest$(sensor) = temp$(sensor): whencoldest$(sensor) = " at " + time$ + " on " + date$
endif
if (val(temp$(sensor)) > val(warmest$(sensor))) or (warmest$(sensor) = "") then
warmest$(sensor) = temp$(sensor): whenwarmest$(sensor) = " at " + time$ + " on " + date$
endif
endif
endif
if debuglevel = 2 then wlog "sensor"+str$(sensor)+" "+info$(sensor)
gosub showit
next sensor
bluetooth.scan 10
end select
return