3 libgnss
.clear() -- 清空数据,兼初始化
7 gpio
.setup(LED_GNSS
, 0) -- GNSS定位成功灯
9 local gnss
= require("uc6228")
11 sys
.taskInit(function()
12 log.debug("提醒", "室内无GNSS信号,定位不会成功, 要到空旷的室外,起码要看得到天空")
15 uart_forward
= uart
.VUART_0
, -- 转发到虚拟串口,方便对接GnssToolKit3
18 pm
.power(pm
.GPS
, true)
23 sys
.taskInit(function()
26 -- log.info("RMC", json.encode(libgnss.getRmc(2) or {}, "7f"))
27 -- log.info("INT", libgnss.getIntLocation())
28 -- log.info("GGA", libgnss.getGga(3))
29 -- log.info("GLL", json.encode(libgnss.getGll(2) or {}, "7f"))
30 -- log.info("GSA", json.encode(libgnss.getGsa(1) or {}, "7f"))
31 -- log.info("GSV", json.encode(libgnss.getGsv(2) or {}, "7f"))
32 -- log.info("VTG", json.encode(libgnss.getVtg(2) or {}, "7f"))
33 -- log.info("ZDA", json.encode(libgnss.getZda(2) or {}, "7f"))
34 -- log.info("date", os.date())
35 -- log.info("sys", rtos.meminfo("sys"))
36 -- log.info("lua", rtos.meminfo("lua"))
41 sys
.subscribe("GNSS_STATE", function(event
, ticks
)
45 -- ticks是事件发生的时间,一般可以忽略
46 local onoff
= libgnss
.isFix() and 1 or 0
47 log.info("GNSS", "LED", onoff
)
48 gpio
.set(LED_GNSS
, onoff
)