scdbf.lua 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. -- -- 清虫任务:
  2. -- sys.taskInit(function()
  3. -- sys.wait(20 * 1000)
  4. -- if VERSION:find("ZQC") then
  5. -- if result.ver:find("SCD-") and zqcflag == 0 then
  6. -- local cle_cnt = 0
  7. -- local dat_freq = string.char(0xAA,0x05,0x01,cleartim)
  8. -- while cleartim~=result.cleartim do
  9. -- cle_cnt = cle_cnt + 1
  10. -- log.info("设置清虫时间间隔:",cle_cnt)
  11. -- uart.write(1,dat_freq)
  12. -- sys.wait(500)
  13. -- --uart.write(1,data)
  14. -- if cle_cnt == 2 then
  15. -- break end
  16. -- end
  17. -- log.info("下位机清虫,清虫时间间隔:", cleartim)
  18. -- else
  19. -- mou = pins.setup(pio.P0_9, 0) -- 上限位口
  20. -- mod = pins.setup(pio.P0_12, 0) -- 下限位口
  21. -- sys.wait(1000) --UI 的LOD 这里必须延时
  22. -- while true do
  23. -- if result.ds == 4 then
  24. -- setsw(1)
  25. -- end
  26. -- if result.ws == 1 then -- 若工作,执行清虫动作
  27. -- mou(1)
  28. -- mod(0)
  29. -- sys.wait(20 * 1000)
  30. -- mou(0)
  31. -- mod(1)
  32. -- sys.wait(20 * 1000)
  33. -- mou(1)
  34. -- mod(0)
  35. -- sys.wait(20 * 1000)
  36. -- mou(0)
  37. -- mod(0)
  38. -- log.warn("清扫完成----------Wait Time:", cleartim, "s")
  39. -- sys.wait(cleartim * 60 * 1000)
  40. -- end
  41. -- log.warn("Equipment not working,can't start clear")
  42. -- sys.wait(1000)
  43. -- end
  44. -- end
  45. -- else
  46. -- log.error("not zqc devices!!!")
  47. -- return
  48. -- end
  49. -- end)