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}, "写入模式")
return err
if !writeResp.Success {
return terror.New("设置失败")
return nil