more ram..
1st attempt was to put my c:send Buttons as a module
local xxx = {}
function xxx.F1()
cbuf ="~~~~~~~~~~~~~~"
c:send
end
return xxx
then main xxx = require("xxx")
xxx.F1()
This didn't work because of c:send
then removed csend from module and put in main
then main xxx = require("xxx")
xxx()
c:send
return -- to exit function since not last page
- -had to enclose in If stmt else got error
This didn't work because of cbuf was local
made cbuf global - now displays but apparently closes the connection
since the last c:send does not goto to webpage
I have no clue why....
next tried my function uartRX(sdin)
? so how to I get the module to use sdin ?
I'm using more ram than I'm saving.......
Any suggestions appreciated.......
EDIT........................... The following worked for serial input
--saved as serdat.lua/lc
--[[ local serdat = {}
function serdat.S1(sdin)
if #sdin <= 2 then return end -- suspect just crlf ??
xdin=string.sub(sdin,1,4)
ydin=string.sub(sdin,1,5) -- 000>cr
vt.ESP = #sdin..","..ydin
cx = string.find(sdin,"]")
if string.sub(sdin,1,2)=="[c" and cx ~= nil then
cx = string.find(sdin,"/")
vt.cdeg0 = string.sub(sdin,3,cx-1)
sdin = string.sub(sdin,cx+1,#sdin)
cx = string.find(sdin,"/")
vt.ppm0 = string.sub(sdin,1,cx-1)
sdin = string.sub(sdin,cx+1,#sdin)
cx = string.find(sdin,"/")
vt.apc0 = string.sub(sdin,1,cx-1)
sdin = string.sub(sdin,cx+1,#sdin)
cx = string.find(sdin,"/")
vt.ph = string.sub(sdin,1,cx-1)
sdin = string.sub(sdin,cx+1,#sdin)
cx = string.find(sdin,"]")
vt.prb = string.sub(sdin,1,cx-1)
--uart.write(0,"HB\r\n") -
else
vt.sbuf=vt.sbuf..sdin
end
local strt,endx,sz
sz = #vt.sbuf
if sz >= 730 then
strt,endx=string.find(vt.sbuf,"\r\n")
vt.sbuf = string.sub(vt.sbuf,endx+1,sz)
end
end
return serdat
--]]
function uartRX(sdin)
serdat = require("serdat")
serdat.S1(sdin)
end