Skip to content

Commit

Permalink
fix: demo/socket/client里uart的回调名称不对,ymodem的API文档里也有类似问题
Browse files Browse the repository at this point in the history
  • Loading branch information
wendal committed Sep 21, 2023
1 parent d024882 commit 6739e6e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
3 changes: 2 additions & 1 deletion components/ymodem/luat_lib_ymodem.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
@usage
-- 本库的用途是接收数据, 若需要发送文件, 建议用xmodem库
local handler = ymodem.create("/")
uart.on(1, "recvice", function(id, len)
uart.setup(1, 115200)
uart.on(1, "receive", function(id, len)
while 1 do
local data = uart.read(id, 512)
if not data or #data == 0 then
Expand Down
11 changes: 10 additions & 1 deletion demo/socket/client/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ if rtos.bsp() == "EC618" and pm and pm.PWK_MODE then
pm.power(pm.PWK_MODE, false)
end

if wdt then
--添加硬狗防止程序卡死,在支持的设备上启用这个功能
wdt.init(9000)--初始化watchdog设置为9s
sys.timerLoopStart(wdt.feed, 3000)--3s喂一次狗
end


--=============================================================
-- 测试网站 https://netlab.luatos.com/ 点击 打开TCP 获取测试端口号
Expand Down Expand Up @@ -208,13 +214,16 @@ end)
-- 演示uart数据上报, 不需要就注释掉
if rtos.bsp() == "EC618" then
uart.setup(1, 115200) -- 注意, 是UART1, 不是虚拟串口, 演示目的
uart.on(1, "recvice", function(id, len)
uart.on(1, "receive", function(id, len)
while 1 do
local s = uart.read(1, 1024)
if #s == 0 then
break
end
sys.publish("sc_txrx", "uplink", s)
if #s == len then
break
end
end
end)
end
Expand Down

0 comments on commit 6739e6e

Please sign in to comment.