minidrone: remove unneeded code, increase test coverage
Signed-off-by: deadprogram <ron@hybridgroup.com>
This commit is contained in:
parent
227be18be7
commit
870ea0fc99
|
@ -209,10 +209,6 @@ func (b *Driver) GenerateAllStates() (err error) {
|
|||
b.stepsfa0b++
|
||||
buf := []byte{0x04, byte(b.stepsfa0b), 0x00, 0x04, 0x01, 0x00, 0x32, 0x30, 0x31, 0x34, 0x2D, 0x31, 0x30, 0x2D, 0x32, 0x38, 0x00}
|
||||
err = b.adaptor().WriteCharacteristic(commandCharacteristic, buf)
|
||||
if err != nil {
|
||||
fmt.Println("GenerateAllStates error:", err)
|
||||
return err
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
@ -222,10 +218,6 @@ func (b *Driver) TakeOff() (err error) {
|
|||
b.stepsfa0b++
|
||||
buf := []byte{0x02, byte(b.stepsfa0b) & 0xff, 0x02, 0x00, 0x01, 0x00}
|
||||
err = b.adaptor().WriteCharacteristic(commandCharacteristic, buf)
|
||||
if err != nil {
|
||||
fmt.Println("takeoff error:", err)
|
||||
return err
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
|
|
@ -52,6 +52,13 @@ func TestMinidroneUp(t *testing.T) {
|
|||
gobottest.Assert(t, d.Up(25), nil)
|
||||
}
|
||||
|
||||
func TestMinidroneUpTooFar(t *testing.T) {
|
||||
d := initTestMinidroneDriver()
|
||||
gobottest.Assert(t, d.Start(), nil)
|
||||
gobottest.Assert(t, d.Up(125), nil)
|
||||
gobottest.Assert(t, d.Up(-50), nil)
|
||||
}
|
||||
|
||||
func TestMinidroneDown(t *testing.T) {
|
||||
d := initTestMinidroneDriver()
|
||||
gobottest.Assert(t, d.Start(), nil)
|
||||
|
@ -94,6 +101,12 @@ func TestMinidroneCounterClockwise(t *testing.T) {
|
|||
gobottest.Assert(t, d.CounterClockwise(25), nil)
|
||||
}
|
||||
|
||||
func TestMinidroneStop(t *testing.T) {
|
||||
d := initTestMinidroneDriver()
|
||||
gobottest.Assert(t, d.Start(), nil)
|
||||
gobottest.Assert(t, d.Stop(), nil)
|
||||
}
|
||||
|
||||
func TestMinidroneStartStopRecording(t *testing.T) {
|
||||
d := initTestMinidroneDriver()
|
||||
gobottest.Assert(t, d.Start(), nil)
|
||||
|
|
Loading…
Reference in New Issue