diff --git a/platforms/megapi/megapi_adaptor.go b/platforms/megapi/megapi_adaptor.go index 6765c020..31c12ef2 100644 --- a/platforms/megapi/megapi_adaptor.go +++ b/platforms/megapi/megapi_adaptor.go @@ -42,11 +42,11 @@ func (megaPi *Adaptor) SetName(n string) { } // Connect starts a connection to the board -func (megaPi *Adaptor) Connect() (errs []error) { +func (megaPi *Adaptor) Connect() error { if megaPi.connection == nil { sp, err := serial.OpenPort(megaPi.serialConfig) if err != nil { - return []error{err} + return err } // sleeping is required to give the board a chance to reset @@ -69,15 +69,15 @@ func (megaPi *Adaptor) Connect() (errs []error) { } } }() - return + return nil } // Finalize terminates the connection to the board -func (megaPi *Adaptor) Finalize() (errs []error) { +func (megaPi *Adaptor) Finalize() error { megaPi.finalizeChannel <- struct{}{} <-megaPi.finalizeChannel if err := megaPi.connection.Close(); err != nil { - return []error{err} + return err } - return + return nil } diff --git a/platforms/megapi/motor_driver.go b/platforms/megapi/motor_driver.go index 56473717..b28c32c9 100644 --- a/platforms/megapi/motor_driver.go +++ b/platforms/megapi/motor_driver.go @@ -41,21 +41,21 @@ func (m *MotorDriver) SetName(n string) { } // Start implements the Driver interface -func (m *MotorDriver) Start() []error { +func (m *MotorDriver) Start() error { m.syncRoot.Lock() defer m.syncRoot.Unlock() m.halted = false m.speedHelper(0) - return []error{} + return nil } // Halt terminates the Driver interface -func (m *MotorDriver) Halt() []error { +func (m *MotorDriver) Halt() error { m.syncRoot.Lock() defer m.syncRoot.Unlock() m.halted = true m.speedHelper(0) - return []error{} + return nil } // Connection returns the Connection associated with the Driver