core: update Megapi platform to simply return error
Signed-off-by: deadprogram <ron@hybridgroup.com>
This commit is contained in:
parent
f2917e71bf
commit
5dff2aa169
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue