parent
d0cdabb231
commit
02f33edf3e
1 changed files with 6 additions and 5 deletions
|
|
@ -2,7 +2,7 @@ package charger
|
|||
|
||||
// LICENSE
|
||||
|
||||
// Copyright (c) 2024-2025 premultiply
|
||||
// Copyright (c) 2024 premultiply
|
||||
|
||||
// This module is NOT covered by the MIT license. All rights reserved.
|
||||
|
||||
|
|
@ -19,6 +19,7 @@ package charger
|
|||
|
||||
import (
|
||||
"context"
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
|
||||
"github.com/evcc-io/evcc/api"
|
||||
|
|
@ -104,7 +105,7 @@ func (wb *Solax) getPhaseValues(reg uint16) (float64, float64, float64, error) {
|
|||
|
||||
var res [3]float64
|
||||
for i := range res {
|
||||
res[i] = float64(encoding.Uint16(b[2*i:])) / 100
|
||||
res[i] = float64(binary.BigEndian.Uint16(b[2*i:])) / 100
|
||||
}
|
||||
|
||||
return res[0], res[1], res[2], nil
|
||||
|
|
@ -142,7 +143,7 @@ func (wb *Solax) Enabled() (bool, error) {
|
|||
return false, err
|
||||
}
|
||||
|
||||
return encoding.Uint16(b) != solaxModeStop, nil
|
||||
return binary.BigEndian.Uint16(b) != solaxModeStop, nil
|
||||
}
|
||||
|
||||
// Enable implements the api.Charger interface
|
||||
|
|
@ -183,7 +184,7 @@ func (wb *Solax) CurrentPower() (float64, error) {
|
|||
return 0, err
|
||||
}
|
||||
|
||||
return float64(encoding.Uint16(b)), err
|
||||
return float64(binary.BigEndian.Uint16(b)), err
|
||||
}
|
||||
|
||||
var _ api.MeterEnergy = (*Solax)(nil)
|
||||
|
|
@ -195,7 +196,7 @@ func (wb *Solax) TotalEnergy() (float64, error) {
|
|||
return 0, err
|
||||
}
|
||||
|
||||
return float64(encoding.Uint32LswFirst(b)) / 10, err
|
||||
return float64(binary.BigEndian.Uint32(b)) / 10, err
|
||||
}
|
||||
|
||||
var _ api.PhaseCurrents = (*Solax)(nil)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue