3 libgnss
.clear() -- 清空数据,兼初始化
7 gpio
.setup(LED_GNSS
, 0) -- GNSS定位成功灯
9 local hdgnss
= require("hdgnss")
11 sys
.taskInit(function()
12 log.debug("提醒", "室内无GNSS信号,定位不会成功, 要到空旷的室外,起码要看得到天空")
20 sys
.taskInit(function()
23 -- log.info("RMC", json.encode(libgnss.getRmc(2) or {}, "7f"))
24 -- log.info("INT", libgnss.getIntLocation())
25 -- log.info("GGA", libgnss.getGga(3))
26 -- log.info("GLL", json.encode(libgnss.getGll(2) or {}, "7f"))
27 -- log.info("GSA", json.encode(libgnss.getGsa(1) or {}, "7f"))
28 -- log.info("GSV", json.encode(libgnss.getGsv(2) or {}, "7f"))
29 -- log.info("VTG", json.encode(libgnss.getVtg(2) or {}, "7f"))
30 -- log.info("ZDA", json.encode(libgnss.getZda(2) or {}, "7f"))
31 -- log.info("date", os.date())
32 -- log.info("sys", rtos.meminfo("sys"))
33 -- log.info("lua", rtos.meminfo("lua"))
38 sys
.subscribe("GNSS_STATE", function(event
, ticks
)
42 -- ticks是事件发生的时间,一般可以忽略
43 local onoff
= libgnss
.isFix() and 1 or 0
44 log.info("GNSS", "LED", onoff
)
45 gpio
.set(LED_GNSS
, onoff
)