completed readonly

This commit is contained in:
Javier Peletier
2020-12-14 00:40:35 +01:00
parent b99a58e79e
commit 119adb54db
4 changed files with 314 additions and 31 deletions
+9 -5
View File
@@ -93,7 +93,7 @@ func (z *Zone) IsOn() (bool, error) {
return false, err
}
return r1&uint16(0x1) != 0, nil
return r1&0x1 != 0, nil
}
func (z *Zone) IsPresent() (bool, error) {
@@ -102,7 +102,7 @@ func (z *Zone) IsPresent() (bool, error) {
return false, err
}
return r1&uint16(0x2) != 0, nil
return r1&0x2 != 0, nil
}
func (z *Zone) GetCurrentTemperature() (float32, error) {
@@ -111,7 +111,7 @@ func (z *Zone) GetCurrentTemperature() (float32, error) {
return 0.0, err
}
return float32(r4) / 2.0, nil
return reg2temp(r4), nil
}
func (z *Zone) GetTargetTemperature() (float32, error) {
@@ -119,7 +119,7 @@ func (z *Zone) GetTargetTemperature() (float32, error) {
if err != nil {
return 0.0, err
}
return float32(r3) / 2.0, nil
return reg2temp(r3), nil
}
func (z *Zone) GetFanMode() (FanMode, error) {
@@ -127,7 +127,7 @@ func (z *Zone) GetFanMode() (FanMode, error) {
if err != nil {
return 0, err
}
return (FanMode)(r2 & 0x00F0), nil
return (FanMode)(r2&0x00F0) >> 4, nil
}
func (z *Zone) GetHvacMode() (HvacMode, error) {
@@ -137,3 +137,7 @@ func (z *Zone) GetHvacMode() (HvacMode, error) {
}
return (HvacMode)(r2 & 0x000F), nil
}
func reg2temp(r uint16) float32 {
return float32(0x00FF&r) / 2.0
}