Vestel: fix phase switching
This commit is contained in:
parent
8f7a671983
commit
63d152c90e
1 changed files with 3 additions and 3 deletions
|
|
@ -105,7 +105,7 @@ func NewVestel(ctx context.Context, uri string, id uint8) (api.Charger, error) {
|
|||
phasesS func(int) error
|
||||
phasesG func() (int, error)
|
||||
)
|
||||
if b, err := wb.conn.ReadHoldingRegisters(vestelRegNumberPhases, 1); err == nil && binary.BigEndian.Uint16(b) == 3 {
|
||||
if b, err := wb.conn.ReadHoldingRegisters(vestelRegNumberPhases, 1); err == nil && binary.BigEndian.Uint16(b) == 1 {
|
||||
phasesS = wb.phases1p3p
|
||||
phasesG = wb.getPhases
|
||||
}
|
||||
|
|
@ -284,7 +284,7 @@ func (wb *Vestel) Voltages() (float64, float64, float64, error) {
|
|||
|
||||
// phases1p3p implements the api.PhaseSwitcher interface
|
||||
func (wb *Vestel) phases1p3p(phases int) error {
|
||||
_, err := wb.conn.WriteSingleRegister(vestelRegNumberPhases, uint16(phases))
|
||||
_, err := wb.conn.WriteSingleRegister(vestelRegNumberPhases, uint16((phases-1)>>1))
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
@ -294,7 +294,7 @@ func (wb *Vestel) getPhases() (int, error) {
|
|||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return int(binary.BigEndian.Uint16(b)), nil
|
||||
return 1 + int(binary.BigEndian.Uint16(b))<<1, nil
|
||||
}
|
||||
|
||||
var _ api.Diagnosis = (*Vestel)(nil)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue