The station-control code rebuilt a fresh driver on every status poll and every relay set. Stateful boards (Denkovi FTDI D2XX, USB-serial) hold an OS handle only one opener can own, so the first poll opened the board and leaked the handle, and every poll after failed with 'device in use' — the relays greyed out a second after Save and auto-control never switched. Drivers are now cached per device and reused, closed on config change. Adds a Test-connection button + detect feedback in the device editor (reported by VK4MA).
36 lines
1.0 KiB
Go
36 lines
1.0 KiB
Go
//go:build !windows
|
|
|
|
// The Denkovi USB board is driven through FTDI's D2XX bit-bang API (ftd2xx.dll),
|
|
// which OpsLog only wires up on Windows. This stub keeps the package building on
|
|
// other platforms; every call reports the board is unavailable.
|
|
package relaydev
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
)
|
|
|
|
type denkoviStub struct{ count int }
|
|
|
|
// NewDenkovi returns a stub on non-Windows builds.
|
|
func NewDenkovi(serial string, count int) Device {
|
|
if count != 4 {
|
|
count = 8
|
|
}
|
|
return denkoviStub{count: count}
|
|
}
|
|
|
|
func (s denkoviStub) Count() int { return s.count }
|
|
func (denkoviStub) Close() error { return nil }
|
|
func (denkoviStub) Status(context.Context) ([]bool, error) {
|
|
return nil, fmt.Errorf("Denkovi USB relay board is only supported on Windows")
|
|
}
|
|
func (denkoviStub) Set(context.Context, int, bool) error {
|
|
return fmt.Errorf("Denkovi USB relay board is only supported on Windows")
|
|
}
|
|
|
|
// ListDenkovi has no devices to report off Windows.
|
|
func ListDenkovi() ([]string, error) {
|
|
return nil, fmt.Errorf("Denkovi USB relay board is only supported on Windows")
|
|
}
|