chore: simplify
This commit is contained in:
parent
b812c2b6f9
commit
76dc949661
1 changed files with 2 additions and 3 deletions
|
|
@ -132,13 +132,12 @@ func (wb *MyPv) heartbeat(ctx context.Context, timeout time.Duration) {
|
|||
|
||||
// Status implements the api.Charger interface
|
||||
func (wb *MyPv) Status() (api.ChargeStatus, error) {
|
||||
res := api.StatusA
|
||||
b, err := wb.conn.ReadHoldingRegisters(elwaRegStatus, 1)
|
||||
if err != nil {
|
||||
return res, err
|
||||
return api.StatusNone, err
|
||||
}
|
||||
|
||||
res = api.StatusB
|
||||
res := api.StatusB
|
||||
if binary.BigEndian.Uint16(b) == 2 {
|
||||
res = api.StatusC
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue