OpenWB native: release GPIOs when closing (#28532)
This commit is contained in:
parent
5822750fe8
commit
3059749ece
1 changed files with 7 additions and 1 deletions
|
|
@ -79,7 +79,6 @@ func NewOpenWbNativeFromConfig(ctx context.Context, other map[string]any) (api.C
|
|||
// NewOpenWbNative creates OpenWbNative charger
|
||||
func NewOpenWbNative(ctx context.Context, uri, device, comset string, baudrate int, proto modbus.Protocol, slaveID uint8, hasPhases1p3p bool, rfIdVidPid string, cpWait time.Duration, connector int, chip string) (api.Charger, error) {
|
||||
log := util.NewLogger("openwb-native")
|
||||
log.DEBUG.Printf("Creating OpenWB native with 3 phases %t, rfid %s, cpwait %s, connector %d", hasPhases1p3p, rfIdVidPid, cpWait.String(), connector)
|
||||
|
||||
evse, err := NewEvseDIN(ctx, uri, device, comset, baudrate, proto, slaveID)
|
||||
if err != nil {
|
||||
|
|
@ -135,6 +134,13 @@ func NewOpenWbNative(ctx context.Context, uri, device, comset string, baudrate i
|
|||
*gpioConfig.dst = line
|
||||
}
|
||||
|
||||
go func() {
|
||||
<-ctx.Done()
|
||||
wb.gpio.cp.Close()
|
||||
wb.gpio.ph1.Close()
|
||||
wb.gpio.ph3.Close()
|
||||
}()
|
||||
|
||||
return decorateOpenWbNative(wb, maxCurrentMillis, phases1p3p, identify), nil
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue