|
|
@@ -29,7 +29,12 @@ local result = uart.setup(
|
|
|
--循环发数据
|
|
|
sys.timerLoopStart(uart.write,1000,uartid,"test")
|
|
|
uart.on(uartid, "receive", function(id, len)
|
|
|
- log.info("uart", "receive", id, len, uart.read(uartid, len))
|
|
|
+ local s
|
|
|
+ while true do--保证读完不然可能丢包
|
|
|
+ s = uart.read(uid, length)
|
|
|
+ if #s == 0 then break end
|
|
|
+ log.info("uart", "receive", id, len, s)
|
|
|
+ end
|
|
|
end)
|
|
|
uart.on(uartid, "sent", function(id)
|
|
|
log.info("uart", "sent", id)
|