sunspec: add bool getter (#31482)
This commit is contained in:
parent
6cce4b789f
commit
c3692046b9
4 changed files with 195 additions and 23 deletions
|
|
@ -17,8 +17,8 @@ func Backoff() *backoff.ExponentialBackOff {
|
|||
return backoff.NewExponentialBackOff(backoff.WithInitialInterval(20*time.Millisecond), backoff.WithMaxElapsedTime(10*time.Second))
|
||||
}
|
||||
|
||||
// decodeMask converts a bit mask in decimal or hex format to uint64
|
||||
func decodeMask(mask string) (uint64, error) {
|
||||
// DecodeMask converts a bit mask in decimal or hex format to uint64
|
||||
func DecodeMask(mask string) (uint64, error) {
|
||||
mask = strings.ToLower(mask)
|
||||
|
||||
if mask == "" {
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ func (r Register) DecodeFunc() (func([]byte) float64, error) {
|
|||
case "uint16nan":
|
||||
return decodeNaN16(asFloat64(encoding.Uint16), 1<<16-1), nil
|
||||
case "bool16":
|
||||
mask, err := decodeMask(r.BitMask)
|
||||
mask, err := DecodeMask(r.BitMask)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue