添加串口打开数据开关,tcp接收数据暂时打印不发送给云端
This commit is contained in:
parent
433d480754
commit
8f2d2bac19
BIN
db/gateway.db
BIN
db/gateway.db
Binary file not shown.
|
@ -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 {
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue