66 result |= std::signbit(
velocity) ? 0x00 : 0x80;
80 if ((value & 0x7F) <= 1)
90 if ((value & 0x80) == 0)
123 result |= result & 0x01 ? 0xA0 : 0x80;
127 result |= std::signbit(
velocity) ? 0x00 : 0x20;
143 value |= value & 0x20 ? 0x01 : 0x00;
145 if ((value & 0x1F) <= 3)
156 if ((value & 0x40) == 0)
191 result |= std::signbit(
velocity) ? 0x00 : 0x20;
205 if ((value & 0x0F) <= 1)
216 if ((value & 0x20) == 0)
#define MPH_FACTOR
Conversion factor for MPH.
float speed() const
Return the speed independent of direction.
void set_dcc_28(uint8_t value)
Set the speed from DCC 28 speed step format.
float velocity
Floating point representation of velocity.
float mph() const
Convert the native meters/sec representation into mile per hour.
void forward()
Set the direction to forward.
uint8_t get_dcc_28()
Get the speed in DCC 28 speed step format.
void set_dcc_128(uint8_t value)
Set the speed from DCC 128 speed step format.
uint8_t get_dcc_128()
Get the speed in DCC 128 speed step format.
void set_dcc_14(uint8_t value)
Set the speed from DCC 14 speed step format.
uint8_t get_dcc_14()
Get the speed in DCC 14 speed step format.