Class: SDN::Message::ILT2::SetMotorSettings
- Inherits:
-
UnknownMessage
- Object
- SDN::Message
- UnknownMessage
- SDN::Message::ILT2::SetMotorSettings
- Defined in:
- lib/sdn/message/ilt2/set.rb
Overview
the motor does not move, and just stores the new values flags of 1 is reverse direction, but you have to set it every time
Constant Summary collapse
- MSG =
0x52- PARAMS_LENGTH =
5
Instance Attribute Summary collapse
-
#down_limit ⇒ Object
Returns the value of attribute down_limit.
-
#flags ⇒ Object
Returns the value of attribute flags.
-
#position_pulses ⇒ Object
Returns the value of attribute position_pulses.
Attributes inherited from UnknownMessage
Attributes inherited from SDN::Message
#ack_requested, #dest, #node_type, #src
Instance Method Summary collapse
-
#initialize(dest = nil, flags = 0, down_limit = 0, position_pulses = 0, **kwargs) ⇒ SetMotorSettings
constructor
A new instance of SetMotorSettings.
- #params ⇒ Object
- #parse(params) ⇒ Object
Methods inherited from UnknownMessage
Methods inherited from SDN::Message
#==, #class_inspect, expected_response?, inherited, #inspect, parse, #serialize
Methods included from Helpers
#checksum, #from_number, #from_string, #is_group_address?, #node_type_from_number, #node_type_to_number, #node_type_to_string, #parse_address, #print_address, #to_number, #to_string, #transform_param
Constructor Details
#initialize(dest = nil, flags = 0, down_limit = 0, position_pulses = 0, **kwargs) ⇒ SetMotorSettings
167 168 169 170 171 172 173 |
# File 'lib/sdn/message/ilt2/set.rb', line 167 def initialize(dest = nil, flags = 0, down_limit = 0, position_pulses = 0, **kwargs) kwargs[:dest] ||= dest super(**kwargs) self.flags = flags self.down_limit = down_limit self.position_pulses = position_pulses end |
Instance Attribute Details
#down_limit ⇒ Object
Returns the value of attribute down_limit.
165 166 167 |
# File 'lib/sdn/message/ilt2/set.rb', line 165 def down_limit @down_limit end |
#flags ⇒ Object
Returns the value of attribute flags.
165 166 167 |
# File 'lib/sdn/message/ilt2/set.rb', line 165 def flags @flags end |
#position_pulses ⇒ Object
Returns the value of attribute position_pulses.
165 166 167 |
# File 'lib/sdn/message/ilt2/set.rb', line 165 def position_pulses @position_pulses end |
Instance Method Details
#params ⇒ Object
182 183 184 |
# File 'lib/sdn/message/ilt2/set.rb', line 182 def params transform_param(flags) + from_number(down_limit, 2) + from_number(position_pulses, 2) end |
#parse(params) ⇒ Object
175 176 177 178 179 180 |
# File 'lib/sdn/message/ilt2/set.rb', line 175 def parse(params) super self.flags = to_number(params[0]) self.down_limit = to_number(params[1..2]) self.position_pulses = to_number(params[3..4]) end |