PROJECT = "ADC" VERSION = "2.0.0" --加载日志功能模块,并且设置日志输出等级 --如果关闭调用log模块接口输出的日志,等级设置为log.LOG_SILENT即可 require "log" LOG_LEVEL = log.LOGLEVEL_TRACE require "sys" require "gps" rtos.on(rtos.MSG_RTK_INFO, function(msg) log.info("rtk",msg.id,msg.status,msg.data) end) local function nmeaCb(nmeaItem) -- log.info("rtk nmeaCb",nmeaItem) rtk.write(nmeaItem) end local function test() sys.wait(5000) --1 02-15 RXM-RAWX 16 local cmd10 = string.char(0xB5, 0x62, 0x06, 0x01, 0x08, 0x00, 0x02, 0x15, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x28, 0x4E) --115200 local cmd13 = string.char(0xB5, 0x62, 0x06, 0x00, 0x14, 0x00, 0x01, 0x00, 0x00, 0x00, 0xD0, 0x08, 0x00, 0x00, 0x00, 0xC2, 0x01, 0x00, 0x07, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x7E) --GPS+BD+QZSS local cmd15 = string.char(0xB5, 0x62, 0x06, 0x3E, 0x3C, 0x00, 0x00, 0x00, 0x20, 0x07, 0x00, 0x08, 0x10, 0x00, 0x01, 0x00, 0x01, 0x01, 0x01, 0x01, 0x03, 0x00, 0x00, 0x00, 0x01, 0x01, 0x02, 0x04, 0x08, 0x00, 0x00, 0x00, 0x01, 0x01, 0x03, 0x08, 0x10, 0x00, 0x01, 0x00, 0x01, 0x01, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x01, 0x05, 0x00, 0x03, 0x00, 0x01, 0x00, 0x01, 0x01, 0x06, 0x08, 0x0E, 0x00, 0x00, 0x00, 0x01, 0x01, 0x2E, 0x75) --NAV_PVT local cmd21 = string.char(0xB5, 0x62, 0x06, 0x01, 0x03, 0x00, 0x01, 0x07, 0x01, 0x13, 0x51) --PPS local cmd23 = string.char(0xB5, 0x62, 0x06, 0x31, 0x20, 0x00, 0x00, 0x01, 0x00, 0x00, 0x32, 0x00, 0x00, 0x00, 0x40, 0x42, 0x0F, 0x00, 0x40, 0x42, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA0, 0x86, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF7, 0x00, 0x00, 0x00, 0xCA, 0xB6) --5HZ local cmd24 = string.char(0xB5, 0x62, 0x06, 0x08, 0x06, 0x00, 0xC8, 0x00, 0x01, 0x00, 0x01, 0x00, 0xDE, 0x6A) --sub-frame local cmd25 = string.char(0xb5, 0x62, 0x06, 0x01, 0x08, 0x00, 0x02, 0x13, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x25, 0x3d) uart.setup(1,9600,8,uart.PAR_NONE,uart.STOP_1) sys.wait(100) uart.write(1, cmd10) sys.wait(100) uart.write(1, cmd15) sys.wait(100) uart.write(1, cmd25) sys.wait(100) uart.write(1, cmd21) sys.wait(100) uart.write(1, cmd23) sys.wait(100) uart.write(1, cmd13) sys.wait(100) uart.close(1) gps.setUart(1,115200,8,uart.PAR_NONE,uart.STOP_1) gps.setNmeaMode(2,nmeaCb) gps.open(gps.DEFAULT,{tag="rtk"}) local para = { appKey = "A48k297jhqeo", appSecret = "956f15a90a318e34", solMode = rtk.SOLMODE_RTK, solSec = rtk.SEC_5S, reqSec = rtk.SEC_5S } rtk.open(para); -- sys.wait(20000); -- rtk.close() -- para.reqFre = rtk.FRE_1S -- sys.wait(1000); -- rtk.open(para); end sys.taskInit(test) --启动系统框架 sys.init(0, 0) sys.run()