chore: fix build tags

This commit is contained in:
andig 2026-04-12 15:16:32 +02:00
parent 4d53782b6c
commit 91f41f77b9
2 changed files with 24 additions and 32 deletions

View file

@ -2,34 +2,7 @@
package sponsor
import (
i2c "github.com/d2r2/go-i2c"
)
const hemspro = "hemspro"
// checkHemsPro checks if the hardware is a supported HEMS Pro device and returns sponsor subject
func checkHemsPro() string {
const (
ADDR = 0b1101000 // 0x68 DS1307
REG_TIMEDATE = 0x00
)
// Create new connection to I2C bus 1
i2c, err := i2c.NewI2C(ADDR, 1)
if err != nil {
return ""
}
defer i2c.Close()
if _, err := i2c.WriteBytes([]byte{REG_TIMEDATE}); err != nil {
return ""
}
buf := make([]byte, 7)
if n, err := i2c.ReadBytes(buf); err != nil || n != 7 {
return ""
}
return hemspro
return ""
}

View file

@ -2,15 +2,34 @@
package sponsor
import (
i2c "github.com/d2r2/go-i2c"
)
const hemspro = "hemspro"
// checkHemsPro checks if the hardware is a supported HEMS Pro device and returns sponsor subject
func checkHemsPro() string {
// TODO i2c validation
const (
ADDR = 0b1101000 // 0x68 DS1307
REG_TIMEDATE = 0x00
)
if false {
return hemspro
// Create new connection to I2C bus 1
i2c, err := i2c.NewI2C(ADDR, 1)
if err != nil {
return ""
}
defer i2c.Close()
if _, err := i2c.WriteBytes([]byte{REG_TIMEDATE}); err != nil {
return ""
}
return ""
buf := make([]byte, 7)
if n, err := i2c.ReadBytes(buf); err != nil || n != 7 {
return ""
}
return hemspro
}