Class: SDN::Message::ILT2::SetMotorSettings

Inherits:
UnknownMessage show all
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 =

Protocol message number

0x52
PARAMS_LENGTH =

Number of protocol parameter bytes expected

5

Instance Attribute Summary collapse

Attributes inherited from UnknownMessage

#msg

Instance Method Summary collapse

Methods inherited from UnknownMessage

#class_inspect, #serialize

Constructor Details

#initialize(dest = nil, flags = 0, down_limit = 0, position_pulses = 0, **kwargs) ⇒ SetMotorSettings

Creates an ILT2 motor settings write command.

Parameters:

  • dest ((Integer, Integer, Integer), nil) (defaults to: nil)

    destination address

  • flags (Integer) (defaults to: 0)

    settings flags

  • down_limit (Integer) (defaults to: 0)

    configured lower limit

  • position_pulses (Integer) (defaults to: 0)

    stored current position

  • kwargs (Hash)

    additional message options



277
278
279
280
281
282
283
# File 'lib/sdn/message/ilt2/set.rb', line 277

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_limitInteger

Returns:

  • (Integer)


265
266
267
# File 'lib/sdn/message/ilt2/set.rb', line 265

def down_limit
  @down_limit
end

#flagsInteger

Returns:

  • (Integer)


262
263
264
# File 'lib/sdn/message/ilt2/set.rb', line 262

def flags
  @flags
end

#position_pulsesInteger

Returns:

  • (Integer)


268
269
270
# File 'lib/sdn/message/ilt2/set.rb', line 268

def position_pulses
  @position_pulses
end

Instance Method Details

#params<Integer>

Returns the protocol-specific payload bytes for this message.

Returns:

  • (<Integer>)


294
295
296
# File 'lib/sdn/message/ilt2/set.rb', line 294

def params
  transform_param(flags) + from_number(down_limit, 2) + from_number(position_pulses, 2)
end

#parse(params) ⇒ void

This method returns an undefined value.

Parses protocol-specific parameter bytes into this message instance.

Parameters:

  • params (<Integer>)

    raw parameter bytes

Raises:



286
287
288
289
290
291
# File 'lib/sdn/message/ilt2/set.rb', line 286

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