diff --git a/ds18b20/ds18b20.go b/ds18b20/ds18b20.go index 7a8b86c..0934e2f 100644 --- a/ds18b20/ds18b20.go +++ b/ds18b20/ds18b20.go @@ -75,6 +75,13 @@ func New(o onewire.Bus, addr onewire.Address, resolutionBits int) (*Dev, error) d := &Dev{onewire: onewire.Dev{Bus: o, Addr: addr}, resolution: resolutionBits} + if d.Family() == DS18S20 { + if resolutionBits != 12 { + return nil, errors.New("ds18b20: DS18S20 only supports 12 resolutionBits") + } + return d, nil + } + // Start by reading the scratchpad memory, this will tell us whether we can // talk to the device correctly and also how it's configured. spad, err := d.readScratchpad()