Class Pr2Throttle

    • Method Detail

      • floatSpeed

        protected float floatSpeed​(int lSpeed)
        Convert a LocoNet speed integer to a float speed value.
        Parameters:
        lSpeed - loconet speed value
        Returns:
        speed as float 0->1.0
      • intSpeed

        protected int intSpeed​(float fSpeed)
        Get an integer speed for the given raw speed value. This is a convenience method that calls AbstractThrottle.intSpeed(float, int) with a maxStep of 127.

        This implementation does not support 128 speed steps.

        Overrides:
        intSpeed in class AbstractThrottle
        Parameters:
        fSpeed - the speed as a percentage of maximum possible speed; negative values indicate a need for an emergency stop
        Returns:
        an integer in the range 0-127
      • sendFunctionGroup3

        protected void sendFunctionGroup3()
        Send the message to set the state of functions F9, F10, F11, F12.

        This is used in the setFn implementations provided in this class, but a real implementation needs to be provided.

        Overrides:
        sendFunctionGroup3 in class AbstractThrottle
      • setIsForward

        public void setIsForward​(boolean forward)
        LocoNet actually puts forward and backward in the same message as the first function group.
        Specified by:
        setIsForward in interface Throttle
        Overrides:
        setIsForward in class AbstractThrottle
        Parameters:
        forward - true if forward; false otherwise
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • getLocoAddress

        public LocoAddress getLocoAddress()
        Locomotive address. The exact format is defined by the specific implementation, as subclasses of LocoAddress will contain different information.

        This is an unbound property.

        Returns:
        The locomotive address