chore: better error handling

This commit is contained in:
andig 2023-10-04 12:58:47 +02:00
parent ca0f9e9f18
commit 03da1f129f

View file

@ -203,9 +203,12 @@ func (wb *DaheimLadenMB) MaxCurrent(current int64) error {
return fmt.Errorf("invalid current %d", current)
}
wb.curr = uint16(current * 10)
err := wb.setCurrent(wb.curr)
if err == nil {
wb.curr = uint16(current * 10)
}
return wb.setCurrent(wb.curr)
return err
}
var _ api.Meter = (*DaheimLadenMB)(nil)