Kaynağa Gözat

限制输出格式

xuxinyi 3 ay önce
ebeveyn
işleme
0e1ffc60f8
1 değiştirilmiş dosya ile 7 ekleme ve 1 silme
  1. 7 1
      gps_periph/Air530zGPS.lua

+ 7 - 1
gps_periph/Air530zGPS.lua

@@ -10,6 +10,7 @@ module(...,package.seeall)
 require"utils"
 require"pm"
 
+local EnableRMC = "$PCAS03,0,0,0,0,1,0,0,0,0,0,,,0,0*03\r\n"
 --[[
 功能定义:
 uart按照帧结构接收外围设备的输入,收到正确的指令后,回复ASCII字符串
@@ -107,7 +108,7 @@ local function read()
         if not data or string.len(data) == 0 then break end
         --打开下面的打印会耗时
         log.info("testUart.read bin",data)
-        log.info("testUart.read hex",data:toHex())
+        -- log.info("testUart.read hex",data:toHex())
         proc(data)
     end
 end
@@ -141,3 +142,8 @@ uart.on(UART_ID,"sent",writeOk)
 uart.setup(UART_ID,9600,8,uart.PAR_NONE,uart.STOP_1)
 --如果需要打开“串口发送数据完成后,通过异步消息通知”的功能,则使用下面的这行setup,注释掉上面的一行setup
 --uart.setup(UART_ID,115200,8,uart.PAR_NONE,uart.STOP_1,nil,1)
+
+sys.timerStart(function ()
+    log.info("像GPS发生命令")
+    write(EnableRMC)
+end, 5000)