添加日志,完善继电器条件判断

This commit is contained in:
fish 2019-05-10 11:29:06 +08:00
parent a8e01c5de6
commit c1067acfc0
1 changed files with 4 additions and 2 deletions

View File

@ -162,13 +162,15 @@ func readConn(conn net.Conn, readChan chan<- []byte, stopChan chan<- bool) {
var close []byte = []byte{0x8E,0x3C,0x00,0x00,0x43,0x46}
var open []byte = []byte{0x8E,0x3C,0x00,0x00,0x4F,0x46}
var writedata []byte =[]byte{}
if pm25data>100 || data[i+7]>=3{
//i+7 氨气
//i+14 tvoc 甲醛
if pm25data>100 || data[i+7]>=3 || data[i+14]>=2 {
writedata = open
}else{
writedata = close
}
v, err := connTest.Write(writedata)
log.Println("send.msg.conn.RemoteAddr",connTest.RemoteAddr())
log.Println("send.msg.conn.RemoteAddr:",connTest.RemoteAddr(),writedata)
log.Println("send.msg.conn.v",v)
if err != nil {
log.Println("write msg error!", err)