Skip to content

Commit

Permalink
Small refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
zankich committed Dec 15, 2013
1 parent 1563aa7 commit 216bbd3
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions device.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,9 @@ func NewDevice(driver interface{}, r *Robot) *Device {
d := new(Device)
d.Name = reflect.ValueOf(driver).Elem().FieldByName("Name").String()
d.Robot = r
interval := reflect.ValueOf(driver).Elem().FieldByName("Interval").String()
if interval == "" {
interval = "0.1s"
if reflect.ValueOf(driver).Elem().FieldByName("Interval").String() == "" {
reflect.ValueOf(driver).Elem().FieldByName("Interval").SetString("0.1s")
}
reflect.ValueOf(driver).Elem().FieldByName("Interval").SetString(interval)
d.Driver = driver
return d
}
Expand Down

0 comments on commit 216bbd3

Please sign in to comment.