feat: Denkovi USB 4/8 (selectable) + generic USB-serial relay board (CH340/LCUS)

- Denkovi (FT245 D2XX) now selectable as 4 or 8 relays (a 4-relay board just uses
  the low nibble); NewDenkovi takes a count, driven by the device's Channels.
- New 'usbrelay' backend: cheap CH340/LCUS USB-serial boards over a COM port
  using the common A0 protocol ([0xA0][relay][state][checksum]); write-only, so
  Status is a shadow. Channel count configurable (1/2/4/8/16).
- StationDevice gains Channels; deviceRelayCount() drives label/relay counts for
  the variable-size types. Device editor: channel selector + COM-port picker
  (usbrelay) / FTDI-serial (denkovi).

Both untested on hardware; the A0 command set / Denkovi bit order may need a tweak
after a live test.
This commit is contained in:
2026-07-20 17:23:38 +02:00
parent c07a17dc47
commit fe69bc308c
8 changed files with 189 additions and 23 deletions
+8 -3
View File
@@ -10,12 +10,17 @@ import (
"fmt"
)
type denkoviStub struct{}
type denkoviStub struct{ count int }
// NewDenkovi returns a stub on non-Windows builds.
func NewDenkovi(serial string) Device { return denkoviStub{} }
func NewDenkovi(serial string, count int) Device {
if count != 4 {
count = 8
}
return denkoviStub{count: count}
}
func (denkoviStub) Count() int { return 8 }
func (s denkoviStub) Count() int { return s.count }
func (denkoviStub) Status(context.Context) ([]bool, error) {
return nil, fmt.Errorf("Denkovi USB relay board is only supported on Windows")
}