|
@@ -101,15 +101,7 @@ func (c *Client) decodeAndReport(buf []byte) error {
|
|
|
if buf[1] == 0x03 {
|
|
|
if buf[2] == 0x04 {
|
|
|
data := &protocol.Data{}
|
|
|
- var value float32
|
|
|
- value := gconv.Float32(gbinary.BeDecodeToUint16(buf[3:5])&0x7FFF) / 10
|
|
|
- if value < 1 {
|
|
|
- value = 0
|
|
|
- }
|
|
|
- if gbinary.BeDecodeToUint16(buf[3:5])&0x8000 == 0x8000 {
|
|
|
- value = -value
|
|
|
- }
|
|
|
- data.Temperature = value
|
|
|
+ data.Temperature = gconv.Float32(caleTemperature(buf[3:5])) / 10
|
|
|
data.Humidly = gconv.Float32(gbinary.BeDecodeToUint16(buf[5:7])) / 10
|
|
|
if err := c.srv.ReportStatus(c.Id, data, "status"); err != nil {
|
|
|
return err
|