hybridgroup / artoo-gpio

Artoo standard drivers for GPIO devices
http://artoo.io
Other
6 stars 9 forks source link

fix passing range configuration to a servo #13

Closed mmmries closed 10 years ago

mmmries commented 10 years ago

I could not find a way to pass a custom safe angle range to a servo. I experimented with code like this:

device :servo, :driver => :servo, :pin => 1, :range => {:min => 0, :max => 180}

But the params I specify get nested under :additional_params like this:

{
  :parent=> #<Device @id=2165082460, @name='name', @driver='driver'>,
  :additional_params=> {
    :name=> :servo,
    :driver=> :servo,
    :pin=> 1,
    :range=> {:min=>0, :max=>180},
    :parent=>#<Robot 2164657460>
  }
}

I followed the pattern found in https://github.com/hybridgroup/artoo-gpio/blob/master/lib/artoo/drivers/motor.rb#L14