Skip to content

Commit

Permalink
增加指定本地IP,一些多网卡。会造成没有指定网卡,而无法正常发送数据。
Browse files Browse the repository at this point in the history
  • Loading branch information
456vv committed Jan 7, 2021
1 parent c4a5e8b commit 225d96a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
6 changes: 1 addition & 5 deletions demo/cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,12 @@ func main() {
if err != nil {
panic(err)
}
task, err := esptouch.NewEsptouchTask([]byte(apSsid), []byte(apPassword), bssidBytes)
task, err := esptouch.NewEsptouchTask([]byte(apSsid), []byte(apPassword), bssidBytes, net.ParseIP(sip))
if err != nil {
panic(err)
}
defer task.Close()
task.SetBroadcast(mode)
if sip != "" {
ip := net.ParseIP(sip)
task.SetLocalIP(ip)
}

log.Println("SmartConfig run.")

Expand Down
2 changes: 1 addition & 1 deletion demo/esptouch.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
)

func main() {
task, err := esptouch.NewEsptouchTask([]byte("jiajiajia"), []byte("400302100"), []byte{0x4c, 0x50, 0x77, 0x73, 0x37, 0xb0})
task, err := esptouch.NewEsptouchTask([]byte("jiajiajia"), []byte("400302100"), []byte{0x4c, 0x50, 0x77, 0x73, 0x37, 0xb0}, nil)
if err != nil {
panic(err)
}
Expand Down

0 comments on commit 225d96a

Please sign in to comment.