完善日志打印

This commit is contained in:
fish 2019-03-21 18:20:33 +08:00
parent a0c041c122
commit 4f22cc2f4b
2 changed files with 11 additions and 8 deletions

View File

@ -5,7 +5,6 @@
"location": [113.960347, 22.54143],
"单位": "深圳市云兴科技",
"config": [
{
"id": "deb03e28-ddcb-4e5d-aa31-d870a1f0f09b",
"version": "yunhorn_kgl_c8_v1",

View File

@ -33,7 +33,7 @@ func yunhorn_lora_l_v1(data_buf []byte) {
// log.Println(binary.BigEndian.Uint16(append([]byte{0x00}, k))
// }
// log.Println("ys_l_v1_data:",data_buf)
log.Println("ys_l_v1_data:",data_buf)
data_int := Bytes2Bits(data_buf[3:4])
data_int0 := Bytes2Bits(data_buf[0:1])
data_int1 := Bytes2Bits(data_buf[1:2])
@ -68,14 +68,14 @@ func yunhorn_ys_l_v1(data_buf []byte) {
// log.Println(binary.BigEndian.Uint16(append([]byte{0x00}, k))
// }
// log.Println("ys_l_v1_data:",data_buf)
log.Println("ys_l_v1_data:",data_buf)
data_int := Bytes2Bits(data_buf[3:4])
data_int0 := Bytes2Bits(data_buf[0:1])
data_int1 := Bytes2Bits(data_buf[1:2])
data_int2 := Bytes2Bits(data_buf[2:3])
data_type := Bytes2Bits(data_buf[2:3])
log.Println("data_int:", data_int[0])
log.Printf("ADRH:%d,ADRL:%d,dataType:%d,", data_int0[0], data_int1[0], data_int2[0])
log.Println("data_int:", data_int)
log.Printf("ADRH:%d,ADRL:%d,dataType:%d,", data_int0[0], data_int1[0], data_type[0])
var device Device
device.ID = demoDevice.ID
device.VERSION = demoDevice.VERSION
@ -85,8 +85,12 @@ func yunhorn_ys_l_v1(data_buf []byte) {
demoDevice.DATA["data"+strconv.Itoa(2)] = rand.Intn(2)
demoDevice.DATA["data"+strconv.Itoa(3)] = rand.Intn(2)
demoDevice.DATA["data"+strconv.Itoa(7)] = data_int[0]
demoDevice.DATA["data"+strconv.Itoa(8)] = rand.Intn(2)
//485
if(data_type[0]==2){
demoDevice.DATA["data"+strconv.Itoa(8)] = rand.Intn(2)
}else{
demoDevice.DATA["data"+strconv.Itoa(7)] = data_int[0]
}
device.DATA = demoDevice.DATA
if conf.DEBUG {