Fix incorrect change state

This commit is contained in:
Vladislav Vlastovskiy 2017-04-12 12:12:40 +03:00
parent 0278d8af75
commit dc88e80dca
1 changed files with 3 additions and 3 deletions

View File

@ -182,12 +182,12 @@ func (m *MotorDriver) isDigital() bool {
func (m *MotorDriver) changeState(state byte) (err error) {
m.CurrentState = state
if state == 1 {
m.CurrentSpeed = 0
} else {
m.CurrentSpeed = 255
} else {
m.CurrentSpeed = 0
}
if m.ForwardPin != "" {
if state == 0 {
if state == 1 {
err = m.Direction(m.CurrentDirection)
if err != nil {
return