Package jmri.jmrix.bachrus
Class SpeedoConsoleFrame
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- java.awt.Window
-
- java.awt.Frame
-
- javax.swing.JFrame
-
- jmri.util.JmriJFrame
-
- jmri.jmrix.bachrus.SpeedoConsoleFrame
-
- All Implemented Interfaces:
java.awt.event.ComponentListener
,java.awt.event.WindowListener
,java.awt.image.ImageObserver
,java.awt.MenuContainer
,java.beans.PropertyChangeListener
,java.io.Serializable
,java.util.EventListener
,javax.accessibility.Accessible
,javax.swing.RootPaneContainer
,javax.swing.WindowConstants
,BeanInterface
,SpeedoListener
,ModifiedFlag
,ProgListener
,ThrottleListener
,WindowInterface
public class SpeedoConsoleFrame extends JmriJFrame implements SpeedoListener, ThrottleListener, ProgListener, java.beans.PropertyChangeListener
Frame for Speedo Console for Bachrus running stand reader interface- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
SpeedoConsoleFrame.DisplayType
TODO: Complete the help fileprotected static class
SpeedoConsoleFrame.ProfileDirection
protected static class
SpeedoConsoleFrame.ProfileState
protected static class
SpeedoConsoleFrame.ProgState
protected static class
SpeedoConsoleFrame.SpeedMatchSetupState
protected static class
SpeedoConsoleFrame.SpeedMatchState
-
Nested classes/interfaces inherited from class jmri.util.JmriJFrame
JmriJFrame.ScreenDimensions
-
Nested classes/interfaces inherited from class javax.swing.JFrame
javax.swing.JFrame.AccessibleJFrame
-
Nested classes/interfaces inherited from class java.awt.Window
java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
-
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
-
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
-
Nested classes/interfaces inherited from interface jmri.ThrottleListener
ThrottleListener.DecisionType
-
Nested classes/interfaces inherited from interface jmri.util.swing.WindowInterface
WindowInterface.Hint
-
-
Field Summary
Fields Modifier and Type Field Description protected float
acc
protected float
avSpeed
protected static int
BASIC
protected float
circ
protected static int
COMMAND
protected CommandStation
commandStation
protected float
count
protected float
currentSpeed
protected int
customScale
protected javax.swing.JTextField
customScaleField
protected javax.swing.JLabel
customScaleLabel
(package private) java.lang.String
customScalePref
protected int
dccServices
protected static int
defaultScale
protected javax.swing.JRadioButton
dialButton
(package private) java.lang.String
dialTypePref
protected javax.swing.JCheckBox
dirFwdButton
protected javax.swing.JCheckBox
dirRevButton
protected SpeedoConsoleFrame.DisplayType
display
protected static int
DISPLAY_UPDATE
protected javax.swing.JPanel
displayCards
protected javax.swing.ButtonGroup
displayGroup
(package private) javax.swing.Timer
displayTimer
protected javax.swing.JButton
exportProfileButton
protected static int
FAST_DISPLAY_RATIO
(package private) javax.swing.Timer
fastDisplayTimer
(package private) static int[]
filterLength
protected float
freq
protected float
incSpeed
protected static float
kD
protected static float
kI
protected static float
kP
protected javax.swing.JRadioButton
kphButton
protected int
lastReverseTrim
protected float
lastSpeedMatchError
protected int
lastVHigh
protected int
lastVStart
protected javax.swing.JButton
loadProfileButton
protected javax.swing.JRadioButton
mainButton
protected javax.swing.ButtonGroup
modeGroup
protected javax.swing.JRadioButton
mphButton
protected javax.swing.JRadioButton
numButton
protected int
oldMomentumAccel
protected int
oldMomentumDecel
protected float
oldSpeed
protected AddressedProgrammer
ops_mode_prog
(package private) UserPreferencesManager
prefs
protected javax.swing.JButton
printProfileButton
protected javax.swing.JTextField
printTitleText
protected SpeedoConsoleFrame.ProfileDirection
profileDir
(package private) GraphPane
profileGraphPane
protected float
profileSpeed
protected SpeedoConsoleFrame.ProfileState
profileState
protected int
profileStep
(package private) javax.swing.Timer
profileTimer
protected Programmer
prog
protected static int
PROG
protected javax.swing.JRadioButton
progButton
protected SpeedoConsoleFrame.ProgState
progState
protected int
range
protected static int
RANGE1HI
protected static int
RANGE1LO
protected static int
RANGE2HI
protected static int
RANGE2LO
protected static int
RANGE3HI
protected static int
RANGE3LO
protected static int
RANGE4HI
protected static int
RANGE4LO
protected int
readAddress
protected javax.swing.JButton
readAddressButton
protected javax.swing.JLabel
readerLabel
(package private) java.lang.String
replyString
(package private) javax.swing.Timer
replyTimer
protected javax.swing.JButton
resetGraphButton
protected int
reverseTrim
protected RosterEntry
rosterEntry
protected float
sampleSpeed
protected javax.swing.JLabel
scaleLabel
(package private) javax.swing.JComboBox<java.lang.String>
scaleList
protected float[]
scales
protected java.lang.String[]
scaleStrings
protected float
selectedScale
(package private) java.lang.String
selectedScalePref
protected int
series
protected javax.swing.ButtonGroup
speedGroup
protected javax.swing.JButton
speedMatchButton
protected float
speedMatchDerivative
protected int
speedMatchDuration
protected float
speedMatchError
protected float
speedMatchIntegral
protected SpeedoConsoleFrame.SpeedMatchSetupState
speedMatchSetupState
protected SpeedoConsoleFrame.SpeedMatchState
speedMatchState
(package private) javax.swing.Timer
speedMatchTimer
protected javax.swing.JCheckBox
speedMatchWarmUpCheckBox
(package private) static int
SPEEDMATCHWARMUPTIME
protected SpeedoDial
speedoDialDisplay
protected float
speedStep1Target
protected javax.swing.JTextField
speedStep1TargetField
protected javax.swing.JLabel
speedStep1TargetLabel
protected javax.swing.JLabel
speedStep1TargetUnit
protected float
speedStep28Target
protected javax.swing.JTextField
speedStep28TargetField
protected javax.swing.JLabel
speedStep28TargetLabel
protected javax.swing.JLabel
speedStep28TargetUnit
protected static int
speedTestScaleFactor
protected javax.swing.JTextField
speedTextField
(package private) java.lang.String
speedUnitsKphPref
protected DccSpeedProfile
spFwd
protected DccSpeedProfile
spRef
protected DccSpeedProfile
spRev
protected javax.swing.JButton
startProfileButton
protected javax.swing.JLabel
statusLabel
protected javax.swing.JButton
stopProfileButton
protected float
targetSpeed
(package private) SpeedoTrafficController
tc
protected DccThrottle
throttle
protected static int
THROTTLE
protected float
throttleIncrement
protected boolean
timerRunning
protected javax.swing.JCheckBox
toggleGridButton
protected javax.swing.JButton
trackPowerButton
protected int
vHigh
protected int
vStart
-
Fields inherited from class jmri.util.JmriJFrame
allowInFrameServlet, properties, reuseFrameSavedPosition, reuseFrameSavedSized, windowInterface
-
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
-
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
-
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
-
Fields inherited from interface jmri.ProgListener
CommError, ConfirmFailed, FailedTimeout, NoAck, NoLocoDetected, NotImplemented, OK, ProgrammerBusy, ProgrammingShort, SequenceError, UnknownError, UserAborted
-
-
Constructor Summary
Constructors Constructor Description SpeedoConsoleFrame(SpeedoSystemConnectionMemo memo)
Constructor for the SpeedoConsoleFrame
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
avClr()
Clears the average speed calculationprotected void
avFn(float speed)
Calculates the average speed using a filterprotected void
calcSpeed()
Calculates the scale speed in KPHprotected void
checkCustomScale()
Check if custom scale selected and enable the custom scale entry field.protected void
displayTimeout()
Internal routine to update the target speed for displayvoid
dispose()
Override for the JmriJFrame's dispose functionprotected void
fastDisplayTimeout()
Internal routine to update the displayed speedprotected void
getCustomScale()
Validate the users custom scale entry.protected int
getNextSpeedMatchValue(int lastValue)
Gets the next value to try for speed matching using a PID controllervoid
initComponents()
Override for the JmriJFrame's initComponents functionvoid
notifyDecisionRequired(LocoAddress address, ThrottleListener.DecisionType question)
Called when we must decide to steal the throttle for the requested address.void
notifyFailedThrottleRequest(LocoAddress address, java.lang.String reason)
Called when a throttle could not be obtainedvoid
notifyThrottleFound(DccThrottle t)
Called when a throttle is foundprotected void
profileTimeout()
Profile timer timeout handlervoid
programmingOpReply(int value, int status)
Called when the programmer (ops mode or service mode) has completed its operationvoid
propertyChange(java.beans.PropertyChangeEvent evt)
Handles property changes from the power manager.protected void
readAddress()
Starts reading the address (CVs 29 then 1 (short) or 17 and 18 (long)) using the service mode programmerprotected void
readMomentumAccel()
Starts reading the acceleration momentum (CV 3) using the service mode programmerprotected void
readMomentumDecel()
Starts reading the deceleration momentum (CV 4) using the service mode programmervoid
reply(SpeedoReply l)
Handle "replies" from the hardware.protected void
replyTimeout()
Internal routine to reset the speed on a timeout.protected void
setDial()
Set the speed to be displayed as a dial or numericvoid
setRosterEntry(RosterEntry entry)
Set the RosterEntry for this throttle.protected void
setSpeedMatchError(float speedTarget)
Sets the PID controller's speed match error for speed matchingprotected void
setUnits()
Set the displays to mile per hour or kilometers per hourprotected void
setupSpeedMatchTimer(boolean isForward, int speedStep, int initialDelay)
Sets up the speed match timer by setting the throttle direction and speed, clearing the speed match error, and setting the timer initial delay (timer does not auto-repeat for accuracy)protected void
showSpeed()
Displays the speed in the SpeedoConsoleFrame's digital/analog speedometerprotected void
speedMatchTimeout()
Timer timeout handler for the speed match timerprotected void
startDisplayTimer()
Starts the timer used to update the speedometer display speed.protected void
startFastDisplayTimer()
Starts the timer used to update the speedometer display speed at a faster rate.protected void
startOpsModeWrite(java.lang.String cv, int value)
Starts writing a CV using the ops mode programmerprotected void
startProfile()
Start the speed profiling processprotected void
startRead(java.lang.String cv)
Starts reading a CV using the service mode programmerprotected void
startReplyTimer()
Starts the speedo hardware reply timer.protected void
startSpeedMatch()
Starts the auto speed matching processprotected void
stopProfileAndSpeedMatch()
Stops the profiling and speed matching processes.protected void
stopTimers()
Stops profile and speed match timersprotected void
switchRange()
Switches the filter used for averaging speed based on the measured speedprotected void
throttleTimeout()
Timeout requesting a throttle.protected void
tidyUp()
Resets profiling and speed matching timers and other pertinent values and releases the throttle and ops mode programmerprotected java.lang.String
title()
Grabs the title for the SpeedoConsoleFrameprotected void
trackPower()
Called when the track power button is clicked to turn on or off track power Allows user to power up and give time for sound decoder startup sequence before running a profileprotected void
writeForwardTrim(int value)
Starts writing forward trim (CV 66) using the ops mode programmerprotected void
writeMomentumAccel(int value)
Starts writing acceleration momentum (CV 3) using the ops mode programmerprotected void
writeMomentumDecel(int value)
Starts writing deceleration momentum (CV 4) using the ops mode programmerprotected void
writeReverseTrim(int value)
Starts writing reverse trim (CV 95) using the ops mode programmerprotected void
writeVHigh()
Starts writing vHigh to vHigh (CV 5) using the ops mode programmerprotected void
writeVMid()
Starts writing the average of vStart and vHigh to vMid (CV 6) using the ops mode programmerprotected void
writeVStart()
Starts writing vStart to vStart (CV 2) using the ops mode programmer-
Methods inherited from class jmri.util.JmriJFrame
addHelpMenu, componentHidden, componentMoved, componentResized, componentShown, generateWindowRef, getAllowInFrameServlet, getEscapeKeyAction, getEscapeKeyClosesWindow, getFrame, getFrame, getFrameList, getFrameList, getIndexedProperty, getMaximumSize, getModifiedFlag, getPreferredSize, getProperty, getPropertyNames, getSavePosition, getSaveSize, getScreenDimensions, getWindowFrameRef, getWindowInterface, handleModified, hasIndexedProperty, hasProperty, makePrivateWindow, markWindowModified, multipleInstances, pack, setAllowInFrameServlet, setEscapeKeyAction, setEscapeKeyClosesWindow, setFrameLocation, setIndexedProperty, setModifiedFlag, setProperty, setSavePosition, setSaveSize, setShutDownTask, setWindowInterface, show, show, storeValues, undecorate, windowActivated, windowClosed, windowClosing, windowDeactivated, windowDeiconified, windowIconified, windowOpened
-
Methods inherited from class javax.swing.JFrame
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
-
Methods inherited from class java.awt.Frame
addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
-
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
-
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMinimumSize, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
-
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setMixingCutoutShape, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
-
-
-
Field Detail
-
SPEEDMATCHWARMUPTIME
static final int SPEEDMATCHWARMUPTIME
- See Also:
- Constant Field Values
-
scaleLabel
protected javax.swing.JLabel scaleLabel
-
customScaleLabel
protected javax.swing.JLabel customScaleLabel
-
customScaleField
protected javax.swing.JTextField customScaleField
-
customScale
protected int customScale
-
speedTextField
protected javax.swing.JTextField speedTextField
-
displayCards
protected javax.swing.JPanel displayCards
-
modeGroup
protected javax.swing.ButtonGroup modeGroup
-
progButton
protected javax.swing.JRadioButton progButton
-
mainButton
protected javax.swing.JRadioButton mainButton
-
speedGroup
protected javax.swing.ButtonGroup speedGroup
-
mphButton
protected javax.swing.JRadioButton mphButton
-
kphButton
protected javax.swing.JRadioButton kphButton
-
displayGroup
protected javax.swing.ButtonGroup displayGroup
-
numButton
protected javax.swing.JRadioButton numButton
-
dialButton
protected javax.swing.JRadioButton dialButton
-
speedoDialDisplay
protected SpeedoDial speedoDialDisplay
-
dirFwdButton
protected javax.swing.JCheckBox dirFwdButton
-
dirRevButton
protected javax.swing.JCheckBox dirRevButton
-
toggleGridButton
protected javax.swing.JCheckBox toggleGridButton
-
profileGraphPane
GraphPane profileGraphPane
-
statusLabel
protected javax.swing.JLabel statusLabel
-
readerLabel
protected javax.swing.JLabel readerLabel
-
defaultScale
protected static final int defaultScale
- See Also:
- Constant Field Values
-
selectedScale
protected float selectedScale
-
series
protected int series
-
sampleSpeed
protected float sampleSpeed
-
targetSpeed
protected float targetSpeed
-
currentSpeed
protected float currentSpeed
-
incSpeed
protected float incSpeed
-
oldSpeed
protected float oldSpeed
-
acc
protected float acc
-
avSpeed
protected float avSpeed
-
range
protected int range
-
circ
protected float circ
-
count
protected float count
-
freq
protected float freq
-
DISPLAY_UPDATE
protected static final int DISPLAY_UPDATE
- See Also:
- Constant Field Values
-
FAST_DISPLAY_RATIO
protected static final int FAST_DISPLAY_RATIO
- See Also:
- Constant Field Values
-
RANGE1LO
protected static final int RANGE1LO
- See Also:
- Constant Field Values
-
RANGE1HI
protected static final int RANGE1HI
- See Also:
- Constant Field Values
-
RANGE2LO
protected static final int RANGE2LO
- See Also:
- Constant Field Values
-
RANGE2HI
protected static final int RANGE2HI
- See Also:
- Constant Field Values
-
RANGE3LO
protected static final int RANGE3LO
- See Also:
- Constant Field Values
-
RANGE3HI
protected static final int RANGE3HI
- See Also:
- Constant Field Values
-
RANGE4LO
protected static final int RANGE4LO
- See Also:
- Constant Field Values
-
RANGE4HI
protected static final int RANGE4HI
- See Also:
- Constant Field Values
-
filterLength
static final int[] filterLength
-
selectedScalePref
java.lang.String selectedScalePref
-
customScalePref
java.lang.String customScalePref
-
speedUnitsKphPref
java.lang.String speedUnitsKphPref
-
dialTypePref
java.lang.String dialTypePref
-
prefs
UserPreferencesManager prefs
-
replyString
java.lang.String replyString
-
scaleStrings
protected java.lang.String[] scaleStrings
-
scales
protected float[] scales
-
scaleList
javax.swing.JComboBox<java.lang.String> scaleList
-
display
protected SpeedoConsoleFrame.DisplayType display
-
dccServices
protected int dccServices
-
BASIC
protected static final int BASIC
- See Also:
- Constant Field Values
-
PROG
protected static final int PROG
- See Also:
- Constant Field Values
-
COMMAND
protected static final int COMMAND
- See Also:
- Constant Field Values
-
THROTTLE
protected static final int THROTTLE
- See Also:
- Constant Field Values
-
timerRunning
protected boolean timerRunning
-
progState
protected SpeedoConsoleFrame.ProgState progState
-
throttleIncrement
protected float throttleIncrement
-
prog
protected Programmer prog
-
ops_mode_prog
protected AddressedProgrammer ops_mode_prog
-
commandStation
protected CommandStation commandStation
-
readAddressButton
protected javax.swing.JButton readAddressButton
-
rosterEntry
protected RosterEntry rosterEntry
-
readAddress
protected int readAddress
-
trackPowerButton
protected javax.swing.JButton trackPowerButton
-
startProfileButton
protected javax.swing.JButton startProfileButton
-
stopProfileButton
protected javax.swing.JButton stopProfileButton
-
exportProfileButton
protected javax.swing.JButton exportProfileButton
-
printProfileButton
protected javax.swing.JButton printProfileButton
-
resetGraphButton
protected javax.swing.JButton resetGraphButton
-
loadProfileButton
protected javax.swing.JButton loadProfileButton
-
printTitleText
protected javax.swing.JTextField printTitleText
-
spFwd
protected DccSpeedProfile spFwd
-
spRev
protected DccSpeedProfile spRev
-
spRef
protected DccSpeedProfile spRef
-
profileDir
protected SpeedoConsoleFrame.ProfileDirection profileDir
-
throttle
protected DccThrottle throttle
-
profileStep
protected int profileStep
-
profileSpeed
protected float profileSpeed
-
profileState
protected SpeedoConsoleFrame.ProfileState profileState
-
speedStep1TargetLabel
protected javax.swing.JLabel speedStep1TargetLabel
-
speedStep1TargetField
protected javax.swing.JTextField speedStep1TargetField
-
speedStep1TargetUnit
protected javax.swing.JLabel speedStep1TargetUnit
-
speedStep28TargetLabel
protected javax.swing.JLabel speedStep28TargetLabel
-
speedStep28TargetField
protected javax.swing.JTextField speedStep28TargetField
-
speedStep28TargetUnit
protected javax.swing.JLabel speedStep28TargetUnit
-
speedMatchWarmUpCheckBox
protected javax.swing.JCheckBox speedMatchWarmUpCheckBox
-
speedMatchButton
protected javax.swing.JButton speedMatchButton
-
kP
protected static float kP
-
kI
protected static float kI
-
kD
protected static float kD
-
speedMatchIntegral
protected float speedMatchIntegral
-
speedMatchDerivative
protected float speedMatchDerivative
-
lastSpeedMatchError
protected float lastSpeedMatchError
-
speedMatchError
protected float speedMatchError
-
speedStep1Target
protected float speedStep1Target
-
speedStep28Target
protected float speedStep28Target
-
lastVStart
protected int lastVStart
-
lastVHigh
protected int lastVHigh
-
lastReverseTrim
protected int lastReverseTrim
-
vStart
protected int vStart
-
vHigh
protected int vHigh
-
reverseTrim
protected int reverseTrim
-
speedMatchDuration
protected int speedMatchDuration
-
oldMomentumAccel
protected int oldMomentumAccel
-
oldMomentumDecel
protected int oldMomentumDecel
-
speedMatchState
protected SpeedoConsoleFrame.SpeedMatchState speedMatchState
-
speedMatchSetupState
protected SpeedoConsoleFrame.SpeedMatchSetupState speedMatchSetupState
-
speedTestScaleFactor
protected static final int speedTestScaleFactor
- See Also:
- Constant Field Values
-
speedMatchTimer
javax.swing.Timer speedMatchTimer
-
profileTimer
javax.swing.Timer profileTimer
-
replyTimer
javax.swing.Timer replyTimer
-
displayTimer
javax.swing.Timer displayTimer
-
fastDisplayTimer
javax.swing.Timer fastDisplayTimer
-
-
Constructor Detail
-
SpeedoConsoleFrame
public SpeedoConsoleFrame(SpeedoSystemConnectionMemo memo)
Constructor for the SpeedoConsoleFrame- Parameters:
memo
- the memo for the connection the Speedo is using
-
-
Method Detail
-
title
protected java.lang.String title()
Grabs the title for the SpeedoConsoleFrame- Returns:
- the frame's title
-
dispose
public void dispose()
Override for the JmriJFrame's dispose function- Specified by:
dispose
in interfaceWindowInterface
- Overrides:
dispose
in classJmriJFrame
-
initComponents
public void initComponents()
Override for the JmriJFrame's initComponents function- Overrides:
initComponents
in classJmriJFrame
-
reply
public void reply(SpeedoReply l)
Handle "replies" from the hardware. In fact, all the hardware does is send a constant stream of unsolicited speed updates.- Specified by:
reply
in interfaceSpeedoListener
- Parameters:
l
- the reply to handle
-
calcSpeed
protected void calcSpeed()
Calculates the scale speed in KPH
-
avFn
protected void avFn(float speed)
Calculates the average speed using a filter- Parameters:
speed
- the speed of the latest interation
-
avClr
protected void avClr()
Clears the average speed calculation
-
switchRange
protected void switchRange()
Switches the filter used for averaging speed based on the measured speed
-
showSpeed
protected void showSpeed()
Displays the speed in the SpeedoConsoleFrame's digital/analog speedometer
-
checkCustomScale
protected void checkCustomScale()
Check if custom scale selected and enable the custom scale entry field.
-
setDial
protected void setDial()
Set the speed to be displayed as a dial or numeric
-
setUnits
protected void setUnits()
Set the displays to mile per hour or kilometers per hour
-
getCustomScale
protected void getCustomScale()
Validate the users custom scale entry.
-
setRosterEntry
public void setRosterEntry(RosterEntry entry)
Set the RosterEntry for this throttle.- Parameters:
entry
- roster entry selected for throttle
-
propertyChange
public void propertyChange(java.beans.PropertyChangeEvent evt)
Handles property changes from the power manager.- Specified by:
propertyChange
in interfacejava.beans.PropertyChangeListener
-
trackPower
protected void trackPower()
Called when the track power button is clicked to turn on or off track power Allows user to power up and give time for sound decoder startup sequence before running a profile
-
setupSpeedMatchTimer
protected void setupSpeedMatchTimer(boolean isForward, int speedStep, int initialDelay)
Sets up the speed match timer by setting the throttle direction and speed, clearing the speed match error, and setting the timer initial delay (timer does not auto-repeat for accuracy)- Parameters:
isForward
- - throttle direction - true for forward, false for reversespeedStep
- - throttle speed stepinitialDelay
- - initial delay for the timer in milliseconds
-
setSpeedMatchError
protected void setSpeedMatchError(float speedTarget)
Sets the PID controller's speed match error for speed matching- Parameters:
speedTarget
- - target speed in KPH
-
getNextSpeedMatchValue
protected int getNextSpeedMatchValue(int lastValue)
Gets the next value to try for speed matching using a PID controller- Parameters:
lastValue
- - the last vStart or vHigh value tried- Returns:
- the next value to try for speed matching (1-255 inclusive)
-
startSpeedMatch
protected void startSpeedMatch()
Starts the auto speed matching process
-
speedMatchTimeout
protected void speedMatchTimeout()
Timer timeout handler for the speed match timer
-
startProfile
protected void startProfile()
Start the speed profiling process
-
profileTimeout
protected void profileTimeout()
Profile timer timeout handler
-
tidyUp
protected void tidyUp()
Resets profiling and speed matching timers and other pertinent values and releases the throttle and ops mode programmerCalled both when profiling or speed matching finish successfully or error out
-
stopProfileAndSpeedMatch
protected void stopProfileAndSpeedMatch()
Stops the profiling and speed matching processes. Called by pressing either the stop profile or stop speed matching buttons.
-
stopTimers
protected void stopTimers()
Stops profile and speed match timers
-
notifyThrottleFound
public void notifyThrottleFound(DccThrottle t)
Called when a throttle is found- Specified by:
notifyThrottleFound
in interfaceThrottleListener
- Parameters:
t
- the requested DccThrottle
-
notifyFailedThrottleRequest
public void notifyFailedThrottleRequest(LocoAddress address, java.lang.String reason)
Called when a throttle could not be obtained- Specified by:
notifyFailedThrottleRequest
in interfaceThrottleListener
- Parameters:
address
- the requested addressreason
- the reason the throttle could not be obtained
-
notifyDecisionRequired
public void notifyDecisionRequired(LocoAddress address, ThrottleListener.DecisionType question)
Called when we must decide to steal the throttle for the requested address. Since this is a an automatically stealing implementation, the throttle will be automatically stolen.- Specified by:
notifyDecisionRequired
in interfaceThrottleListener
- Parameters:
address
- The LocoAddress that needs the decision.question
- The question being asked, steal / cancel, share / cancel, steal / share / cancel
-
startReplyTimer
protected void startReplyTimer()
Starts the speedo hardware reply timer. Once we receive a speedoReply we expect them regularly, at least once every 4 seconds.
-
startDisplayTimer
protected void startDisplayTimer()
Starts the timer used to update the speedometer display speed.
-
startFastDisplayTimer
protected void startFastDisplayTimer()
Starts the timer used to update the speedometer display speed at a faster rate.
-
replyTimeout
protected void replyTimeout()
Internal routine to reset the speed on a timeout.
-
displayTimeout
protected void displayTimeout()
Internal routine to update the target speed for display
-
fastDisplayTimeout
protected void fastDisplayTimeout()
Internal routine to update the displayed speed
-
throttleTimeout
protected void throttleTimeout()
Timeout requesting a throttle.
-
writeMomentumAccel
protected void writeMomentumAccel(int value)
Starts writing acceleration momentum (CV 3) using the ops mode programmer- Parameters:
value
- acceleration value (0-255 inclusive)
-
writeMomentumDecel
protected void writeMomentumDecel(int value)
Starts writing deceleration momentum (CV 4) using the ops mode programmer- Parameters:
value
- deceleration value (0-255 inclusive)
-
writeVStart
protected void writeVStart()
Starts writing vStart to vStart (CV 2) using the ops mode programmer
-
writeVMid
protected void writeVMid()
Starts writing the average of vStart and vHigh to vMid (CV 6) using the ops mode programmer
-
writeVHigh
protected void writeVHigh()
Starts writing vHigh to vHigh (CV 5) using the ops mode programmer
-
writeForwardTrim
protected void writeForwardTrim(int value)
Starts writing forward trim (CV 66) using the ops mode programmer- Parameters:
value
- forward trim value (0-255 inclusive)
-
writeReverseTrim
protected void writeReverseTrim(int value)
Starts writing reverse trim (CV 95) using the ops mode programmer- Parameters:
value
- reverse trim value (0-255 inclusive)
-
readMomentumAccel
protected void readMomentumAccel()
Starts reading the acceleration momentum (CV 3) using the service mode programmer
-
readMomentumDecel
protected void readMomentumDecel()
Starts reading the deceleration momentum (CV 4) using the service mode programmer
-
readAddress
protected void readAddress()
Starts reading the address (CVs 29 then 1 (short) or 17 and 18 (long)) using the service mode programmer
-
startOpsModeWrite
protected void startOpsModeWrite(java.lang.String cv, int value)
Starts writing a CV using the ops mode programmer- Parameters:
cv
- the CVvalue
- the value to write to the CV (0-255 inclusive)
-
startRead
protected void startRead(java.lang.String cv)
Starts reading a CV using the service mode programmer- Parameters:
cv
- the CV
-
programmingOpReply
public void programmingOpReply(int value, int status)
Called when the programmer (ops mode or service mode) has completed its operation- Specified by:
programmingOpReply
in interfaceProgListener
- Parameters:
value
- Value from a read operation, or value written on a writestatus
- Denotes the completion code. Note that this is a bitwise combination of the various states codes defined in this interface. (see ProgListener.java for possible values)
-
-