You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
600 B

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

package m9z
import (
"github.com/towgo/towgo/errors/terror"
"log"
)
// 编程模式0~2默认为0模式。0x00~0x02
// 对应模式01~模式03
func ModeRead(deviceId string) (byte, error) {
readResp, err := ReadCmd(deviceId, mode, "读取模式")
if err != nil {
return 0, nil
}
log.Printf("readResp.Data % X", readResp.Data)
return readResp.Data[0], nil
}
func ModeWrite(deviceId string, m byte) error {
writeResp, err := WriteCmd(deviceId, mode, []byte{m}, "写入模式")
if err != nil {
return err
}
if !writeResp.Success {
return terror.New("设置失败")
}
return nil
}