-->
Page 1 of 1

uart.on("data","\n") possible call back issue ???

PostPosted: Sat Nov 21, 2015 8:26 am
by xtal
attached code snip.....
I recieve packet [c25.5/1698/43654/74/12] every 8 seconds
uart setup and on are in section 1
The call back is in section 2
NOTE the print(S:) if I enable it I appear to recieve all call backs ...
If disabled I see the 1st call back, the serial buffer contains the others....
Tested @ 9600 and 38400 baud

USING SDK 1.4.0 any suggestions appreciated.....

Code: Select all--- SECTION 1 ---
function c_server() 
    do_next = nocode                   -- just in case timewaste
    uart.setup(0,38400,0,1,0)
    sv=net.createServer(net.TCP, 30)   --create server
    sv:listen(80,function(c)           --listen on port 80
       uart.on("data", "\n",uartRX,0)
       c:on("sent", Send80)
       c:on("receive", Rcv80)          --when rcv do function rcv99         
       end) 


   [c25.5/1698/43654/74/12]            -- this packet arrives every 8 seconds

--- SECTION 2 ---
 function uartRX(sdin)

      --print("S:")                    -- with this disabled it appears that only 1 call back occurs.
                                       -- with this ENABLED it appears that only ALL call backs occur.

        if string.sub(sdin,1,2)=="nh" then vt.heap = node.heap() end
        if #sdin <= 2 then return end            --was only crlf   
        if string.sub(sdin,1,2)=="[c" 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,"/")     

Re: uart.on("data","\n") possible call back issue ???

PostPosted: Sat Nov 21, 2015 4:50 pm
by xtal
Testing with a new generator [ie] no BT the code appears to work without print.
More investigation on my part needed...... :mrgreen:

uart.on working fine

have flaky issue with PIC -->serialBT bridge --> ESP