Revert "Modbus: handle NaN values" (#31968)
This commit is contained in:
parent
a1e8854df1
commit
7a95266a6b
4 changed files with 9 additions and 26 deletions
|
|
@ -9,7 +9,6 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/evcc-io/evcc/api"
|
||||
"github.com/evcc-io/evcc/util"
|
||||
"github.com/evcc-io/evcc/util/modbus"
|
||||
gridx "github.com/grid-x/modbus"
|
||||
|
|
@ -157,12 +156,7 @@ func (m *Modbus) FloatGetter() (func() (f float64, err error), error) {
|
|||
return 0, fmt.Errorf("read failed: %w", err)
|
||||
}
|
||||
|
||||
// a "*nan" sentinel decodes to NaN - the device reports no valid value
|
||||
if res := m.scale * decode(bytes); !math.IsNaN(res) {
|
||||
return res, nil
|
||||
}
|
||||
|
||||
return 0, api.ErrNotAvailable
|
||||
return m.scale * decode(bytes), nil
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue