添加串口打开数据开关,tcp接收数据暂时打印不发送给云端

This commit is contained in:
fish 2019-03-19 11:59:49 +08:00
parent 433d480754
commit 8f2d2bac19
5 changed files with 26 additions and 20 deletions

Binary file not shown.

View File

@ -25,6 +25,7 @@ type Conf struct {
WEBSOCKETURL []string `json:"websocketurl"`
POST_TO_SERVER string `json:"post_to_server"`
DEBUG bool `json:"debug"`
OPENSERIAL bool `json:"openserial"`
}
type Gateway_info struct {

View File

@ -21,6 +21,7 @@ func serial_run() {
port_arr = append(port_arr, ports_arr[i])
}
// 解析串口配置
if conf.OPENSERIAL{
for _, i := range port_arr {
var PARITY serial.Parity
switch conf.SERIALPORTS_LIST[i].PARITY {
@ -35,11 +36,15 @@ func serial_run() {
Baud: conf.SERIALPORTS_LIST[i].BAUDS,
Parity: PARITY,
ReadTimeout: time.Millisecond * time.Duration(conf.SERIALPORTS_LIST[i].READTIMEOUT),
// ReadTimeout: time.Second * time.Duration(conf.SERIALPORTS_LIST[i].READTIMEOUT),
})
check(err)
defer SERIAL_PORT[i].Close()
}
}
if conf.DEBUG {
log.Println(SERIAL_PORT)
}

View File

@ -35,7 +35,7 @@ func yunhorn_ys_l_v1(data_buf []byte){
log.Println(device)
}
send_data(1005, device)
// send_data(1005, device)
}