lib/lignite/motors.rb in lignite-0.2.0 vs lib/lignite/motors.rb in lignite-0.3.0
- old
+ new
@@ -4,14 +4,14 @@
# to work on a pair if motors driving a vehicle.
class Motors
# do the DCs spawn independent threads??
# must run ready in the same block?
- attr :layer
- attr :nos
+ attr_reader :layer
+ attr_reader :nos
# @return [Lignite::DirectCommands]
- attr :dc
+ attr_reader :dc
# 0x02 | 0x04 | 0x08 -> [1, 2, 3]
def nos_as_indices
[0, 1, 2, 3].find_all do |n|
(nos & (1 << n)) != 0
@@ -22,11 +22,11 @@
@layer = layer
@nos = nos
@dc = dc
end
- # TODO filter out support: official: no
+ # TODO: filter out support: official: no
# the type is an OUT param so the VM SETs and we GET to learn the type?
def set_type
layer = @layer
nos_as_indices.map do |no|
@@ -60,10 +60,10 @@
def speed(speed)
dc.output_speed(layer, nos, speed) # does this start them also?
end
def start
- dc.output_start(layer, nos) # apparently not
+ dc.output_start(layer, nos) # apparently not
end
# ATTR ~polarity
def polarity(pol)
dc.output_polarity(layer, nos, pol)