esp8266: default to boardtype ESP8266 whe using tcpfirmata

Signed-off-by: deadprogram <ron@hybridgroup.com>
This commit is contained in:
deadprogram 2017-07-02 18:45:46 +02:00
parent 206f8aadfe
commit 50a252a1b3
1 changed files with 3 additions and 1 deletions

View File

@ -18,12 +18,14 @@ func connect(address string) (io.ReadWriteCloser, error) {
}
// NewTCPAdaptor opens and uses a TCP connection to a microcontroller running
// WiFiFirmata
// WiFiFirmata. NewTCPAdaptor defaults to a BoardType of esp8266. Set to a
// different boardtype if your application requires it.
func NewTCPAdaptor(args ...interface{}) *TCPAdaptor {
address := args[0].(string)
a := NewAdaptor(address)
a.SetName(gobot.DefaultName("TCPFirmata"))
a.BoardType = "esp8266"
a.PortOpener = func(port string) (io.ReadWriteCloser, error) {
return connect(port)
}