-- -- 清虫任务: -- sys.taskInit(function() -- sys.wait(20 * 1000) -- if VERSION:find("ZQC") then -- if result.ver:find("SCD-") and zqcflag == 0 then -- local cle_cnt = 0 -- local dat_freq = string.char(0xAA,0x05,0x01,cleartim) -- while cleartim~=result.cleartim do -- cle_cnt = cle_cnt + 1 -- log.info("设置清虫时间间隔:",cle_cnt) -- uart.write(1,dat_freq) -- sys.wait(500) -- --uart.write(1,data) -- if cle_cnt == 2 then -- break end -- end -- log.info("下位机清虫,清虫时间间隔:", cleartim) -- else -- mou = pins.setup(pio.P0_9, 0) -- 上限位口 -- mod = pins.setup(pio.P0_12, 0) -- 下限位口 -- sys.wait(1000) --UI 的LOD 这里必须延时 -- while true do -- if result.ds == 4 then -- setsw(1) -- end -- if result.ws == 1 then -- 若工作,执行清虫动作 -- mou(1) -- mod(0) -- sys.wait(20 * 1000) -- mou(0) -- mod(1) -- sys.wait(20 * 1000) -- mou(1) -- mod(0) -- sys.wait(20 * 1000) -- mou(0) -- mod(0) -- log.warn("清扫完成----------Wait Time:", cleartim, "s") -- sys.wait(cleartim * 60 * 1000) -- end -- log.warn("Equipment not working,can't start clear") -- sys.wait(1000) -- end -- end -- else -- log.error("not zqc devices!!!") -- return -- end -- end)