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 -4
View File
@@ -46,10 +46,14 @@ type denkovi struct {
opened bool
}
// NewDenkovi builds a driver for a Denkovi USB 8-relay board identified by its
// FTDI serial number (shown by the vendor tool / FT_PROG, e.g. "DAE0006K").
func NewDenkovi(serial string) Device {
return &denkovi{serial: strings.TrimSpace(serial), count: 8}
// NewDenkovi builds a driver for a Denkovi USB relay board (4 or 8 relays)
// identified by its FTDI serial number (shown by the vendor tool / FT_PROG,
// e.g. "DAE0006K"). count defaults to 8; a 4-relay board just uses the low 4 bits.
func NewDenkovi(serial string, count int) Device {
if count != 4 && count != 8 {
count = 8
}
return &denkovi{serial: strings.TrimSpace(serial), count: count}
}
func (d *denkovi) Count() int { return d.count }