Skip to content

Commit

Permalink
update: 完善fota库的描述
Browse files Browse the repository at this point in the history
  • Loading branch information
wendal committed Oct 25, 2023
1 parent 8cb6740 commit 1a70811
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions luat/modules/luat_lib_fota.c
Expand Up @@ -6,6 +6,46 @@
@date 2022.05.26
@demo fota
@tag LUAT_USE_FOTA
@usage
-- 如果是从http获取升级包, 那么看demo/fota就可以了
-- 以下是从其他途径获取更新包后, 调用本fota库的基本逻辑
-- 逐段传入
sys.taskInit(function()
fota.init()
while 1 do
local buf = xxx -- 这里是从其他途径获取的升级包片段
-- buf 可以是zbuff 也可以是string
-- 每次写入的数据长度最大不应超过4k
local result, isDone, cache = fota.run(buf)
if not result then
log.info("fota", "出错了")
break
end
if isDone then
while true do
local succ,fotaDone = fota.isDone()
if not succ then
log.info("fota", "出错了")
break
end
if fotaDone then
log.info("fota", "已完成")
break
end
sys.wait(100)
end
break
end
sys.wait(100)
end
end)
-- 使用文件一次性传入
sys.taskInit(function()
fota.init()
fota.file("/xxx") -- 传入具体的路径
end)
*/
#include "luat_base.h"
#include "luat_fota.h"
Expand Down

0 comments on commit 1a70811

Please sign in to comment.