适配继电器空的情况
This commit is contained in:
@@ -2,6 +2,7 @@ package relay
|
||||
|
||||
import (
|
||||
"github.com/grid-x/modbus"
|
||||
"go.uber.org/zap"
|
||||
"io"
|
||||
)
|
||||
|
||||
@@ -53,6 +54,8 @@ func (r *device) Off(num int) error {
|
||||
}
|
||||
|
||||
func New(address string) (Relay, error) {
|
||||
zap.S().Infoln("连接继电器: ", address)
|
||||
|
||||
h := modbus.NewRTUClientHandler(address)
|
||||
h.SlaveID = 1
|
||||
h.BaudRate = 9600
|
||||
|
||||
Reference in New Issue
Block a user