Merge pull request #80 from hybridgroup/enable-stop-on-disconnect

Enable stop on disconnect
This commit is contained in:
Adrian Zankich 2014-07-15 06:57:29 -10:00
commit 31e28f9700
1 changed files with 5 additions and 0 deletions

View File

@ -130,6 +130,7 @@ func (s *SpheroDriver) Start() bool {
}()
s.configureCollisionDetection()
s.enableStopOnDisconnect()
return true
}
@ -178,6 +179,10 @@ func (s *SpheroDriver) configureCollisionDetection() {
s.packetChannel <- s.craftPacket([]uint8{0x01, 0x40, 0x40, 0x50, 0x50, 0x60}, 0x12)
}
func (s *SpheroDriver) enableStopOnDisconnect() {
s.packetChannel <- s.craftPacket([]uint8{0x00, 0x00, 0x00, 0x01}, 0x37)
}
func (s *SpheroDriver) handleCollisionDetected(data []uint8) {
gobot.Publish(s.Event("collision"), data)
}