Properly set default interval

This commit is contained in:
Adrian Zankich 2013-12-15 14:26:16 -08:00
parent 9d32e7973d
commit 1563aa78fc
1 changed files with 5 additions and 0 deletions

View File

@ -17,6 +17,11 @@ func NewDevice(driver interface{}, r *Robot) *Device {
d := new(Device) d := new(Device)
d.Name = reflect.ValueOf(driver).Elem().FieldByName("Name").String() d.Name = reflect.ValueOf(driver).Elem().FieldByName("Name").String()
d.Robot = r d.Robot = r
interval := reflect.ValueOf(driver).Elem().FieldByName("Interval").String()
if interval == "" {
interval = "0.1s"
}
reflect.ValueOf(driver).Elem().FieldByName("Interval").SetString(interval)
d.Driver = driver d.Driver = driver
return d return d
} }