chore: refactor battery controller
This commit is contained in:
parent
4a92b8c81e
commit
5b62e78311
2 changed files with 3 additions and 8 deletions
|
|
@ -30,10 +30,3 @@ func (m *battery) LimitController(socG func() (float64, error), limitSocS func(f
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ModeController returns an api.BatteryController decorator
|
||||
func (m *battery) ModeController(modeS func(int64) error) func(api.BatteryMode) error {
|
||||
return func(mode api.BatteryMode) error {
|
||||
return modeS(int64(mode))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -77,7 +77,9 @@ func NewConfigurableFromConfig(ctx context.Context, other map[string]interface{}
|
|||
return nil, fmt.Errorf("battery mode: %w", err)
|
||||
}
|
||||
|
||||
batModeS = cc.battery.ModeController(modeS)
|
||||
batModeS = func(mode api.BatteryMode) error {
|
||||
return modeS(int64(mode))
|
||||
}
|
||||
}
|
||||
|
||||
res := m.Decorate(energyG, currentsG, voltagesG, powersG, socG, cc.capacity.Decorator(), cc.maxpower.Decorator(), batModeS)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue