123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778 |
- -- pm.wake("sdcard")
- local comSize = 4 --每个公共目录下文件大小 单位 kb
- -- 挂载SD卡,返回值0表示失败,1表示成功
- -- local sdcard = io.mount(io.SDCARD)
- -- log.info('mount sd card', sdcard)
- local sdCardTotalSize = rtos.get_fs_total_size(1, 1)
- log.info("sd card total size " .. sdCardTotalSize .. " KB")
- local delimiter = '\0'
- if io.opendir("/sdcard0/common") then
- for i=1,100 do
- local fType,fName,fSize = io.readdir()
- log.info("fname",fName)
- if fType==32 then
- -- log.info("sd card file",fName,fSize)
- elseif fType == nil then
- break
- end
- end
- io.closedir("/sdcard0/commmon")
- end
- -- 删除目录
- -- local rmfile = rtos.remove_dir('/sdcard0/common')
- -- log.info('delete', rmfile)
- -- rtos.make_dir('/sdcard0/log')
- -- debug_log('写入测试日志')
- -- local del = os.remove(comDir .. '/user')
- -- log.info('del user file', del)
- -- local readval = readfile() -- 参数:完整路径文件名 不传或者传'/sdcard0/log/0'都是获取最新日志文件
- -- print(readval)
- --获取table长度
- function table_leng(t)
- local leng=0
- for k, v in pairs(t) do
- leng=leng+1
- end
- return leng;
- end
- -- 分割字符串
- ---@param str string 元字符串
- ---@param seq string 分割字符
- ---@return table
- function split(str, seq)
- local nFindStartIndex = 1
- local nSplitIndex = 1
- local nSplitArray = {}
- while true do
- local nFindLastIndex = string.find(str, seq, nFindStartIndex)
- if not nFindLastIndex then
- nSplitArray[nSplitIndex] = string.sub(str, nFindStartIndex, string.len(str))
- break
- end
- nSplitArray[nSplitIndex] = string.sub(str, nFindStartIndex, nFindLastIndex - 1)
- nFindStartIndex = nFindLastIndex + string.len(seq)
- nSplitIndex = nSplitIndex + 1
- end
- return nSplitArray
- end
- --数组去重
- function table.unique(t, bArray, mainKey)
- local check = {}
- local n = {}
- local idx = 1
- for k, v in pairs(t) do
- local judgeKey = v
- if mainKey then
- judgeKey = v[mainKey] or v
- end
- if not check[judgeKey] then
- if bArray then
- n[idx] = v
- idx = idx + 1
- else
- n[k] = v
- end
- check[judgeKey] = true
- end
- end
- return n
- end
- --循环创建文件夹
- function createAllFolder(path)
- -- print(path)
- local path_tb={}
- local new_path=""
- -- 分割路径保存到table
- for i,s in pairs(split(path,'/')) do
- if s~=nil then
- table.insert(path_tb,s)
- end
- end
- -- print(json.encode(path_tb))
- local cdir = false --创建结果
- -- 遍历并拼接路径检测是否存在,不存在则新建
- for k,v in ipairs(path_tb) do
-
- if v ~= '' then
- if k==1 then
- new_path=v
- else
- new_path=new_path.."/"..v
- end
- -- print(new_path,io.opendir(new_path))
- local opflag = io.opendir(new_path)
- if opflag ~= 1 then
- cdir = rtos.make_dir(new_path)
- log.info("path:", new_path, "flag:",cdir)
- end
-
- end
- end
- io.closedir()
- return cdir
- end
- -- 打开sd卡公共目录,不存在则创建 获取最新文件,
- function getComLastFile(dirPath,filename)
- local lastfile = filename --返回最新文件
- -- log.info('func:getComLastFile open dir', io.opendir(dirPath))
- if io.opendir(dirPath) ~= 0 then
- local file = {} -- 该目录所有文件名
- for i = 1, 999 do
- local fType, fName, fSize = io.readdir()
- -- log.info("file or dir",fType, fName, fSize)
- if fType == 32 then
- -- log.info("func getComLastFile common file", fName, fSize)
- local tname = split(fName,'-')
- -- log.debug('func:getComLastFile tname',tname,tname[1],tname[2])
- if tname[1] == filename then
- if tname[2] then
- table.insert(file,tname[2])
- end
- end
- -- local c = io.readFile(dirPath..'/'..fName)
- -- log.info('文件内容',c)
- elseif fType == nil then
- break
- end
- end
- -- log.error('files',json.encode(file))
- --获取文件名后缀最大值
- local max = nil -- 最新的文件 即数字名称值最大的文件
- for i, v in pairs(file) do
- v = tonumber(v) --数组中是string类型 比较会有问题
- if max == nil then max = v end
- if max < v then max = v end
- end
- -- print(max)
- if max then
- -- 判断该最新文件大小
- local cnt = io.fileSize(dirPath .. '/' .. filename..'-'..max)
- if cnt then
- if cnt >= (comSize * 1024) then -- 文件大于设置的文件大小 新建新文件
- max = max + 1
- end
- lastfile = filename..'-'..max
- end
- else
- -- 判断该最新文件大小
- local cnt = io.fileSize(dirPath .. '/' .. filename)
- if cnt then
- if cnt >= (comSize * 1024) then -- 文件大于设置的文件大小 新建新文件
- lastfile = filename..'-1'
- end
- end
- end
- -- print(lastfile)
- log.debug('func:getComLastFile lastfile',lastfile)
- io.closedir()
- return lastfile
- else
- local cdir = createAllFolder(dirPath)
- if cdir then
- log.info('创建公共目录成功', dirPath)
- else
- log.error('创建公共目录失败',dirPath)
- end
- return lastfile
- end
- end
- --根据某个目录下文件名获取该类型所有文件 返回table
- function getAllFiles( dir, file )
- local fs = {}
- if not file then
- return false,'fun:getAllFiles,desc:file not found'
- end
- log.error('open dir',io.opendir(dir))
- if io.opendir(dir) ~= 0 then
- for i = 1, 999 do
- local fType, fName, fSize = io.readdir()
- -- log.info("file or dir",fType, fName, fSize)
- if fType == 32 then
- local tname = split(fName,'-')
- -- log.debug('func:getAllFiles tname',tname,tname[1],tname[2])
- if tname[1] == file then
- table.insert(fs,fName)
- end
- elseif fType == nil then
- break
- end
- end
- else
- io.closedir()
- return false,'fun:getAllFiles,desc:dir not found'
- end
- io.closedir()
- return fs,'fun:getAllFiles,desc:get all files is ok'
- end
- -- 保存基础信息所有扳手信息
- -- 文件 所有扳手信息 查询条件扳手编号 wrench
- -- 文件 所有风场信息 wind
- -- 文件 部件列表 unit
- -- 文件 用户信息 user 查询条件用户名+密码
- -- 文件 任务计划 task 查询条件任务编号
- -- 文件 工作位置列表 workspace 查询条件风机型号+部件号
- -- 文件 待上传信息
- -- 文件 配置信息 比如最后一次使用时间 用于存储空间不够时删除
- --参数[filename] 文件名称 如wrench、wind、unit。。。[data] 保存数据 table类型
- function saveBaseInfo( filename,data,dirPath)
- -- print(filename)
- if not filename then
- log.error('savebaseinfo','filename not fount')
- return false,'filename not fount'
- end
- if not data then
- log.error('savebaseinfo','data not fount')
- return false,'data not fount'
- end
- if not dirPath then
- log.error('savebaseinfo','dirPath not fount')
- return false,'dirPath not fount'
- end
- --最新文件名称
- local filename = getComLastFile(dirPath,filename)
- log.debug('func:saveBaseInfo last file',filename)
- local path = dirPath..'/'..filename
- log.info('save path',path)
- data = json.encode(data)..delimiter
- local c = io.writeFile(path,data, "a+b")
- if c then
- log.info('write result', c)
- return true
- else
- log.error('error', '基础信息写入失败')
- return false,'基础信息写入失败'
- end
- end
- -- 保存基础信息
- -- local wrench = {id=1,name='测试设备'}
- -- local res,desc= saveBaseInfo('wrench',wrench)
- -- log.debug('save result',res,desc)
- -- 模拟数据
- -- for i=113,150 do
- -- local user = {id=i,name='小亮'..i,pwd='49BA59ABBE56E057',time=os.time()} --password md5加密 16位大写 123456
- -- local res,desc= saveBaseInfo('user',user,'/sdcard0/wind/12345')
- -- log.debug('save result',res,desc)
- -- break
- -- end
- --查询设备信息
- --参数[filename] 文件名称 如wrench、wind、unit。。。[param] 保存数据 table类型 nil查询所有数据
- --返回结果 result 结果 值true/false count--查询文件数量 desc --结果描述
- function getBaseInfo( filename,param,dirPath)
- local selectRes = {} --查询结果
- local count = 0 --查询文件个数
- if not filename then
- log.error('func:getBaseInfo','filename not fount')
- return false,count,'filename not fount'
- end
- if not dirPath then
- log.error('func:getBaseInfo','dirPath not fount')
- return false,count,'dirPath not fount'
- end
- --获取所有该文件及副本文件
- local files,desc = getAllFiles(dirPath,filename)
- local filevals = nil --文件内容
- if not files then
- return false,count,desc
- end
- local succ_cnt = 0; --比较成功个数
- for i,file in pairs(files) do
- local isbreak = false
- local path = dirPath..'/'..file
- local filehandle = io.open(path, "r") -- 第一个参数是文件名,第二个是打开方式,'r'读模式,'w'写模式,对数据进行覆盖,'a'附加模式,'b'加在模式后面表示以二进制形式打开
- if not filehandle then -- 判断文件是否存在
- isbreak = true
- end
- fileval = filehandle:read("*all") -- 读出文件内容
- -- print(fileval)
- if not fileval then
- isbreak = true
- end
- local filevaltable = split(fileval,delimiter)
- local table_length = table_leng(filevaltable)
- if table_length <= 1 then
- isbreak = true
- end
-
- -- log.info("isbreak:", isbreak, table_length)
- if not isbreak then
- -- body
- for a = 1,table_length-1 do
- local val = json.decode(filevaltable[a])
-
- if param then --有查询参数
- local p_length = table_leng(param) --条件长度
- for p,s in pairs(param) do
- if filename == "Users" then
- if p == 'pwd' then
- s = string.sub(string.upper(crypto.md5(s,#s,16)),9,24) --密码加密 加密结果32位 取16位(第9-24)字符
- end
- end
- -- log.info("val[p] ", val[p] , "s", s, succ_cnt)
- if val[p] == s then
- succ_cnt = succ_cnt + 1
- else
- break
- end
- end
- if p_length == succ_cnt then --找到结果 停止继续查找下个文件
- selectRes[i] = val
- isbreak = true
- break
- end
- else --无查询参数 查询所有
- selectRes[i] = val
- end
- end
- end
- count = i
- -- if isbreak then --找到结果 停止继续查找下个文件
- -- break;
- -- end
- filehandle:close() -- 关闭文件
- end
- -- print(table_leng(selectRes),json.encode(selectRes))
- if table_leng(selectRes) > 0 then
- --去重
- local result = table.unique(selectRes,true,'id')
- return result,count,'select success'
- else
- return false,count,'this data is not found'
- end
- end
- -- 查询文件内容复数
- function getBaseInfo_ununique( filename,param,dirPath)
- local selectRes = {} --查询结果
- local count = 0 --查询文件个数
- if not filename then
- log.error('func:getBaseInfo','filename not fount')
- return false,count,'filename not fount'
- end
- if not dirPath then
- log.error('func:getBaseInfo','dirPath not fount')
- return false,count,'dirPath not fount'
- end
- --获取所有该文件及副本文件
- local files,desc = getAllFiles(dirPath,filename)
- local filevals = nil --文件内容
- if not files then
- return false,count,desc
- end
- local succ_cnt = 0; --比较成功个数
- for i,file in pairs(files) do
- local isbreak = false
- local path = dirPath..'/'..file
- local filehandle = io.open(path, "r") -- 第一个参数是文件名,第二个是打开方式,'r'读模式,'w'写模式,对数据进行覆盖,'a'附加模式,'b'加在模式后面表示以二进制形式打开
- if not filehandle then -- 判断文件是否存在
- isbreak = true
- end
- fileval = filehandle:read("*all") -- 读出文件内容
- -- print(fileval)
- if not fileval then
- isbreak = true
- end
- local filevaltable = split(fileval,delimiter)
- local table_length = table_leng(filevaltable)
- if table_length <= 1 then
- isbreak = true
- end
-
- if not isbreak then
- -- body
- for a = 1,table_length-1 do
- local val = json.decode(filevaltable[a])
- succ_cnt = 0
- if param then --有查询参数
- local p_length = table_leng(param) --条件长度
- for p,s in pairs(param) do
-
-
- if val[p] == s then
- -- log.info("val[p]:", val[p], "s:",s)
- succ_cnt = succ_cnt + 1
- else
- break
- end
- end
-
- if p_length == succ_cnt then --找到结果 停止继续查找下个文件
- table.insert(selectRes, val)
- end
-
- else --无查询参数 查询所有
- table.insert(selectRes, val)
- end
- end
- end
- count = i
- -- if isbreak then --找到结果 停止继续查找下个文件
- -- break;
- -- end
- filehandle:close() -- 关闭文件
- end
- -- print(table_leng(selectRes),json.encode(selectRes))
- if table_leng(selectRes) > 0 then
- --去重
- local result = table.unique(selectRes,true,'id')
- return result,count,'select success'
- else
- return false,count,'this data is not found'
- end
- end
- -- 查询文件内容复数_模糊查询
- function getBaseInfo_ununique_dim( filename,param,dirPath)
- local selectRes = {} --查询结果
- local count = 0 --查询文件个数
- if not filename then
- log.error('func:getBaseInfo','filename not fount')
- return false,count,'filename not fount'
- end
- if not dirPath then
- log.error('func:getBaseInfo','dirPath not fount')
- return false,count,'dirPath not fount'
- end
- --获取所有该文件及副本文件
- local files,desc = getAllFiles(dirPath,filename)
- local filevals = nil --文件内容
- if not files then
- return false,count,desc
- end
- local succ_cnt = 0; --比较成功个数
- for i,file in pairs(files) do
- local isbreak = false
- local path = dirPath..'/'..file
- local filehandle = io.open(path, "r") -- 第一个参数是文件名,第二个是打开方式,'r'读模式,'w'写模式,对数据进行覆盖,'a'附加模式,'b'加在模式后面表示以二进制形式打开
- if not filehandle then -- 判断文件是否存在
- isbreak = true
- -- isbreak = true
- end
- fileval = filehandle:read("*all") -- 读出文件内容
- -- print(fileval)
- if not fileval then
- isbreak = true
- -- isbreak = true
- end
- local filevaltable = split(fileval,delimiter)
- local table_length = table_leng(filevaltable)
- if table_length <= 1 then
- isbreak = true
- -- isbreak = true
- end
-
- if not isbreak then
- -- body
- for a = 1,table_length-1 do
- local val = json.decode(filevaltable[a])
-
- if param then --有查询参数
- local p_length = table_leng(param) --条件长度
- local pattern = ""
- for p,s in pairs(param) do
-
- if succ_cnt > 49 then
- -- body
- break
- end
-
- -- log.info("val[p]:", val[p], "s:",s)
-
- local wholeStr = val[p]
- if type(val[p]) ~= "userdata" then
- -- body
- pattern = string.gsub(s, "[%[%]&=+%%%c%(%)%-%/%+]", function(c)
- return "%"..c
- end)
- local a,b = string.find(wholeStr,pattern)
- local transMatchres = string.match(wholeStr,pattern)
-
-
- if a and (b-a+1) == #transMatchres then
- succ_cnt = succ_cnt + 1
- table.insert(selectRes, val)
- end
- end
-
- end
-
- -- if p_length == succ_cnt then --找到结果 停止继续查找下个文件
- -- table.insert(selectRes, val)
- -- end
-
- else --无查询参数 查询所有
- if succ_cnt > 49 then
- -- body
- else
- if filename == "Wind" then
- -- body
- local fieldDisplayRadius = nvm.get("fieldDisplayRadius") or 200
- local gpsLng, gpsLat = nvm.get("gpsLng"), nvm.get("gpsLat")
- local dist = devTool.getDistance( val.lat, val.lon, gpsLat, gpsLng)
- -- log.info("dist:",dist, json.encode(v))
- if dist < fieldDisplayRadius then
- -- body
- -- log.info("cicle",v.lat)
- val.dist = dist
- table.insert(selectRes, val)
- succ_cnt = succ_cnt+1
- end
- else
- table.insert(selectRes, val)
- succ_cnt = succ_cnt+1
- end
- end
-
- end
- end
- end
- count = i
- -- if isbreak then --找到结果 停止继续查找下个文件
- -- break;
- -- end
- filehandle:close() -- 关闭文件
- end
- -- print(table_leng(selectRes),json.encode(selectRes))
- if table_leng(selectRes) > 0 then
- --去重
- local result = table.unique(selectRes,true,'id')
- return result,count,'select success'
- else
- return false,count,'this data is not found'
- end
- end
- -- local res,cnt,desc = getBaseInfo('user',{pwd="123456",name="小亮113"},'/sdcard0/wind/12345')
- -- log.info('select result',res,cnt,desc)
- -- for i,j in ipairs(res) do
- -- for m,n in pairs(j) do
- -- print(m,n)
- -- end
- -- end
- --删除基本信息
- --参数[filename] 文件名称 如wrench、wind、unit。。。[id] 删除数据id
- function delBaseInfo(filename,id,dirPath)
- local res = false --删除结果
- local count = 0 --查询文件个数
- log.info("del process:",filename,id,dirPath)
- if not filename then
- log.error('func:delBaseInfo','filename not fount')
- return res,count,'filename not fount'
- end
- if not id then
- log.error('func:delBaseInfo','id not fount')
- return res,count,'id not fount'
- end
- if not dirPath then
- log.error('func:delBaseInfo','dirPath not fount')
- return res,count,'dirPath not fount'
- end
- --获取所有该文件及副本文件
- local files,desc = getAllFiles(dirPath,filename)
- local filevals = nil --文件内容
- if not files then
- return res,count,desc
- end
- local isCurFile = false --要删除文件是否找到
- for i,file in pairs(files) do
- local isbreak = false
- local path = dirPath..'/'..file
- local filehandle = io.open(path, "r") -- 第一个参数是文件名,第二个是打开方式,'r'读模式,'w'写模式,对数据进行覆盖,'a'附加模式,'b'加在模式后面表示以二进制形式打开
- if not filehandle then -- 判断文件是否存在
- isbreak = true
- end
- fileval = filehandle:read("*all") -- 读出文件内容
- if not fileval then
- isbreak = true
- end
- local filevaltable = split(fileval,delimiter)
- local table_lenght = table_leng(filevaltable)
- if table_lenght <= 1 then
- isbreak = true
- end
- local newfileval = "" --删除后文件内容
- if not isbreak then
- -- body
- for a = 1,table_lenght-1 do
- local val = json.decode(filevaltable[a])
-
- if val.id ~= id then
- data = json.encode(val)
- if newfileval ~= "" then
- newfileval = newfileval..data..delimiter
- else
- newfileval = data..delimiter
- end
- else
- isCurFile = true
- end
- end
- end
- filehandle:close() -- 关闭文件
- if isCurFile then
- --删除旧文件
- local del = os.remove(path)
- log.debug('func:delBaseInfo del file', del)
- --保存删除后的内容
- local c = io.writeFile(path,newfileval, "a+b")
- if c then
- count = i
- log.info('func:delBaseInfo save file', c)
- return true,count,'del success'
- else
- log.error('error', '基础信息写入失败')
- return false,count,'del ok,but save fail'
- end
- break
- else
- count = i
- end
- end
- if not isCurFile then
- return false,count,'this data not found where id='..id
- end
- end
- function delOfflineCacheTemp( dirPath )
- -- body
- return rtos.remove_dir(dirPath)
- end
- -- local res,cnt,desc = delBaseInfo('user',113,'/sdcard0/wind/12345')
- -- log.info('del result',res,cnt,desc)
- --修改基本信息
- --参数[filename] 文件名称 如wrench、wind、unit。。。[data] 要修改的数据 table类型 要包含数据id
- --返回结果 result 结果 值true/false count--查询文件数量 desc --结果描述
- function updateBaseInfo( filename,data,dirPath)
- local res = false --修改结果
- local count = 0 --查询文件个数
- if not filename then
- log.error('func:updateBaseInfo','filename not fount')
- return res,count,'filename not fount'
- end
- if not data.id then
- log.error('func:updateBaseInfo','data not fount')
- return res,count,'the id of data is not fount'
- end
- --获取所有该文件及副本文件
- local files,desc = getAllFiles(dirPath,filename)
- local filevals = nil --文件内容
- if not files then
- return res,count,desc
- end
- local isCurFile = false --要修改数据文件是否找到
- for i,file in pairs(files) do
- local isbreak = false
- local path = dirPath..'/'..file
- local filehandle = io.open(path, "r") -- 第一个参数是文件名,第二个是打开方式,'r'读模式,'w'写模式,对数据进行覆盖,'a'附加模式,'b'加在模式后面表示以二进制形式打开
- if not filehandle then -- 判断文件是否存在
- isbreak = true
- end
- fileval = filehandle:read("*all") -- 读出文件内容
- if not fileval then
- isbreak = true
- end
- local filevaltable = split(fileval,delimiter)
- local table_length = table_leng(filevaltable)
- if table_length <= 1 then
- isbreak = true
- end
- local newfileval = nil --删除后文件内容
- if not isbreak then
- -- body
- for a = 1,table_length-1 do
- local val = json.decode(filevaltable[a])
- if val.id ~= data.id then --过滤要修改的那条数据
- dataStr = json.encode(val)
- if newfileval then
- newfileval = newfileval..dataStr..delimiter
- else
- newfileval = dataStr..delimiter
- end
- else
- --将新数据放入新的文件内容中
- local newData = json.encode(data)
- if newfileval then
- newfileval = newfileval..newData..delimiter
- else
- newfileval = newData..delimiter
- end
- isCurFile = true
- end
- end
- end
- filehandle:close() -- 关闭文件
- if isCurFile then
- if newfileval then
- --删除旧文件
- local del = os.remove(path)
- if not del then
- return false,count,'func:updateBaseInfo del fail,please reoperate'
- end
- --保存删除后的内容
- local c = io.writeFile(path,newfileval, "a+b")
- if c then
- count = i
- return true,count,'func:updateBaseInfo update success'
- else
- return false,count,'func:updateBaseInfo del success,but save fail'
- end
- else
- return false,count,'the file content after del create fail'
- end
- break
- else
- count = i
- end
- end
- if not isCurFile then
- return false,count,'this data not found where id='..data.id
- end
- end
- sys.taskInit(function()
- -- while true do
- -- log.info("test00")
- -- led.blinkPwm(blueLed,2000,1000)
- -- led.blinkPwm(redLed,3000,1000)
-
- -- sys.wait(2000)
- -- end
- sys.wait(5000)
- local moutedFlag = io.mount(io.SDCARD)
- log.info('mount sd card', moutedFlag)
-
- local sdCardTotalSize = rtos.get_fs_total_size(1,1)
- log.info("sd card total size "..sdCardTotalSize.." KB")
-
- if moutedFlag == 1 then
- -- body
- sys.publish("IO_SDCARD_MOUTED")
- end
- end)
|