chore: release v0.23.0
This commit is contained in:
@@ -13460,12 +13460,12 @@ func boolStr(b bool) string {
|
||||
// StationDevice is one configured relay board for the Station Control tab.
|
||||
type StationDevice struct {
|
||||
ID string `json:"id"`
|
||||
Type string `json:"type"` // "webswitch" | "kmtronic" | "denkovi" | "usbrelay"
|
||||
Type string `json:"type"` // "webswitch" | "kmtronic" | "dingtian" | "denkovi" | "usbrelay"
|
||||
Name string `json:"name"`
|
||||
Host string `json:"host"` // IP for network boards; FTDI serial for denkovi; COM port for usbrelay
|
||||
User string `json:"user,omitempty"` // KMTronic HTTP auth (blank = none)
|
||||
Pass string `json:"pass,omitempty"`
|
||||
Channels int `json:"channels,omitempty"` // usbrelay only: number of relays (1/2/4/8/16)
|
||||
User string `json:"user,omitempty"` // KMTronic HTTP auth; Dingtian HTTP session ID (blank = none)
|
||||
Pass string `json:"pass,omitempty"` // KMTronic HTTP auth; Dingtian relay password (0–9999)
|
||||
Channels int `json:"channels,omitempty"` // usbrelay/denkovi/dingtian: number of relays
|
||||
Labels []string `json:"labels"` // per-relay label (index 0 = relay 1)
|
||||
}
|
||||
|
||||
@@ -13473,10 +13473,13 @@ type StationDevice struct {
|
||||
// except the Denkovi (4 or 8) and the generic USB-serial board, whose channel
|
||||
// count the user picks.
|
||||
func deviceRelayCount(d StationDevice) int {
|
||||
if d.Type == "usbrelay" || d.Type == "denkovi" {
|
||||
if d.Type == "usbrelay" || d.Type == "denkovi" || d.Type == "dingtian" {
|
||||
if d.Channels >= 1 {
|
||||
return d.Channels
|
||||
}
|
||||
if d.Type == "dingtian" {
|
||||
return 2 // the smallest board; the real count comes from its status reply
|
||||
}
|
||||
return 8
|
||||
}
|
||||
return relayCountFor(d.Type)
|
||||
@@ -13504,6 +13507,9 @@ func buildDeviceDriver(d StationDevice) relaydev.Device {
|
||||
switch d.Type {
|
||||
case "kmtronic":
|
||||
return relaydev.NewKMTronic(d.Host, d.User, d.Pass)
|
||||
case "dingtian":
|
||||
// User carries the optional HTTP session ID, Pass the relay password.
|
||||
return relaydev.NewDingtian(d.Host, d.User, d.Pass, deviceRelayCount(d))
|
||||
case "denkovi":
|
||||
// Host carries the FTDI serial number (e.g. "DAE0006K"), not a hostname.
|
||||
return relaydev.NewDenkovi(d.Host, deviceRelayCount(d))
|
||||
@@ -13607,7 +13613,7 @@ func (a *App) SaveStationDevices(devs []StationDevice) error {
|
||||
}
|
||||
for i := range devs {
|
||||
switch devs[i].Type {
|
||||
case "kmtronic", "denkovi", "usbrelay", "webswitch":
|
||||
case "kmtronic", "dingtian", "denkovi", "usbrelay", "webswitch":
|
||||
// known type — keep
|
||||
default:
|
||||
devs[i].Type = "webswitch"
|
||||
|
||||
Reference in New Issue
Block a user