Class LocoNetSlot
- Direct Known Subclasses:
UhlenbrockSlot
A SlotListener can be registered to hear of changes in this slot. All changes in values will result in notification.
Strictly speaking, functions 9 through 28 are not in the actual slot, but
it's convenient to imagine there's an "extended slot" and keep track of them
here. This is a partial implementation, though, because setting is still done
directly in LocoNetThrottle. In particular, if this slot has not been
read from the command station, the first message directly setting F9 through
F28 will not have a place to store information. Instead, it will trigger a
slot read, so the following messages will be properly handled.
Some of the message formats used in this class are Copyright Digitrax, Inc. and used with permission as part of the JMRI project. That permission does not extend to uses in other software products. If you wish to use this code, algorithm or these message formats outside of JMRI, please contact Digitrax Inc for separate permission.
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) boolean(package private) boolean(package private) boolean(package private) boolean(package private) boolean(package private) boolean(package private) boolean(package private) boolean(package private) boolean(package private) boolean(package private) boolean(package private) boolean(package private) boolean(package private) boolean(package private) boolean(package private) boolean(package private) boolean(package private) boolean(package private) boolean(package private) boolean -
Constructor Summary
ConstructorsConstructorDescriptionLocoNetSlot(int slotNum) Create a slot based solely on a slot number.LocoNetSlot(int slotNum, int inLoconetProtocol) Create a slot based solely on a slot number.LocoNetSlot(int slotNum, int inLoconetProtocol, SlotMapEntry.SlotType inSlotType) Create a slot , initialize slotnum, protocol and slot typeCreates a slot object based on the contents of a LocoNet message. -
Method Summary
Modifier and TypeMethodDescriptionvoidRegisters a slot listener if it is not already registered.intGet consist status.intcvval()intGet decoder mode.intdirf()Returns the mobile decoder direction and F0-F4 bits, as used in the DIRF bits of various LocoNet messages.Create LocoNet message which dispatches this slot Note that the invoking method ought to invoke the slot's NotifySlotListeners method to inform any other interested parties that the slot status has changed.voidfunctionMessage(long pkt) Sets F9 through F28 (as appropriate) from data extracted from LocoNet "OPC_IMM_PACKET" message.intReturn the days value from the slot.intReturn the fractional minutes value from the slot.intReturn the hours value from the slot.intReturn the minutes value from the slot.intGet the fast-clock rate.booleanGet the state of the Acquire Throttle / slot.longReturns the timestamp when this LocoNetSlot was updated by some LocoNet message.intintintgetSlot()Returns the slot number which was either specified or inferred at object creation time.intGet the throttle ID in the slotintGet the track status byte (location 7)intid()Returns the "Throttle ID" associated with the slot.booleanisF0()Returns the slot's F0 statebooleanisF1()Returns the slot's F1 statebooleanisF10()Returns the slot's F10 statebooleanisF11()Returns the slot's F11 statebooleanisF12()Returns the slot's F12 statebooleanisF13()Returns the slot's F13 statebooleanisF14()Returns the slot's F14 statebooleanisF15()Returns the slot's F15 statebooleanisF16()Returns the slot's F16 statebooleanisF17()Returns the slot's F17 statebooleanisF18()Returns the slot's F1 statebooleanisF19()Returns the slot's F19 statebooleanisF2()Returns the slot's F2 statebooleanisF20()Returns the slot's F20 statebooleanisF21()Returns the slot's F21 statebooleanisF22()Returns the slot's F22 statebooleanisF23()Returns the slot's F23 statebooleanisF24()Returns the slot's F24 statebooleanisF25()Returns the slot's F25 statebooleanisF26()Returns the slot's F26 statebooleanisF27()Returns the slot's F27 statebooleanisF28()Returns the slot's F28 statebooleanisF3()Returns the slot's F3 statebooleanisF4()Returns the slot's F4 statebooleanisF5()Returns the slot's F5 statebooleanisF6()Returns the slot's F6 statebooleanisF7()Returns the slot's F7 statebooleanisF8()Returns the slot's F8 statebooleanisF9()Returns the slot's F9 statebooleanReturns the direction of loco movement which applies when the slot's speed is set for movement.booleanisFunction(int Fn) Return a slot Function state.booleanintlocoAddr()Returns the mobile decoder address associated with the slot.voidNotifies all listeners that this slot has been changed in some way.intpcmd()Returns the programmer command associated with the slot.Create a LocoNet OPC_SLOT_STAT1 message which releases this slot to the "Common" state The invoking method must send the returned LocoNet message to LocoNet in order to have a useful effect.voidUn-registers a slot listener.voidsetFcCntrlBitOff(int val) For fast-clock slot, set a "CLK_CNTRL" bit Off.voidsetFcCntrlBitOn(int val) For fast-clock slot, set a "CLK_CNTRL" bit On.voidsetFcDays(int val) For fast-clock slot, set "days" value.voidsetFcFracMins(int val) Set the "frac_mins" value.voidsetFcHours(int val) For fast-clock slot, set "hours" value.voidsetFcMinutes(int val) For fast-clock slot, set "minutes" value.voidsetFcRate(int val) For fast-clock slot, set "rate" value.protected voidsetIsInitialized(boolean state) protected voidsetProtocol(int value) set the protocol to be usedvoidUpdate the slot object to reflect the specific contents of a LocoNet message.voidsetSlotType(SlotMapEntry.SlotType value) Set the Slot TypevoidsetThrottleIdentity(int throttleId) Set the throttle ID in the slotvoidsetTrackStatus(int status) Set the track status byte (location 7)intGet slot status.intsnd()Returns the mobile decoder F5-F8 bits, as used in the SND bits of various LocoNet messages.intspeed()Returns the mobile decoder speed associated with the slotintss2()Get secondary slot status.writeMode(int status) Update the decoder type bits in STAT1 (D2, D1, D0)Create a message to perform a null move on this slot.Creates a LocoNet "OPC_WR_SL_DATA" message containing the current state of the LocoNetSlot object.writeSpeed(int speed) Update SpeedwriteStatus(int status) Update the status mode bits in STAT1 (D5, D4)writeThrottleID(int newID) Sets the object's ID value and returns a LocoNet message to inform the command station that the throttle ID has been changed.
-
Field Details
-
localF9
boolean localF9 -
localF10
boolean localF10 -
localF11
boolean localF11 -
localF12
boolean localF12 -
localF13
boolean localF13 -
localF14
boolean localF14 -
localF15
boolean localF15 -
localF16
boolean localF16 -
localF17
boolean localF17 -
localF18
boolean localF18 -
localF19
boolean localF19 -
localF20
boolean localF20 -
localF21
boolean localF21 -
localF22
boolean localF22 -
localF23
boolean localF23 -
localF24
boolean localF24 -
localF25
boolean localF25 -
localF26
boolean localF26 -
localF27
boolean localF27 -
localF28
boolean localF28
-
-
Constructor Details
-
LocoNetSlot
Create a slot based solely on a slot number. The remainder of the slot is left un-initialized.- Parameters:
slotNum- slot number to be assigned to the new LocoNetSlot object
-
LocoNetSlot
Create a slot based solely on a slot number. The remainder of the slot is left un-initialized.- Parameters:
slotNum- - slot number to be assigned to the new LocoNetSlot objectinLoconetProtocol- - can be 0 = unknown, 1 = version 1.1, 2 = Expandedslot
-
LocoNetSlot
Create a slot , initialize slotnum, protocol and slot type- Parameters:
slotNum- - slot number to be assigned to the new LocoNetSlot objectinLoconetProtocol- - can be 0 = unknown, 1 = version 1.1, 2 = ExpandedslotinSlotType- - SLotType enum
-
LocoNetSlot
Creates a slot object based on the contents of a LocoNet message. The slot number is assumed to be found in byte 2 of the message if message is 0xE6 or bytes 2 and 3 for 0xE7- Parameters:
l- a LocoNet message- Throws:
LocoNetException- if the slot does not have an easily-found slot number
-
-
Method Details
-
getSlot
Returns the slot number which was either specified or inferred at object creation time.- Returns:
- the slot number
-
setSlotType
Set the Slot Type- Parameters:
value- enum for slottype
-
isSystemSlot
- Returns:
- true if this is a systems slot else false
-
getSlotType
- Returns:
- true if this is a systems slot else false
-
getProtocol
- Returns:
- the protocol level support by the slot.
-
setProtocol
set the protocol to be used- Parameters:
value- one,two or unknown
-
decoderType
Get decoder mode. The decoder (operating) mode is taken from those bits in the slot's STAT byte which reflect the "speed steps" and "consisting" mode. Note that the other bits from the STAT byte are not visible via this method. thisFor slot numbers not normally associated with mobile decoders, these bits may have other meanings.
Possible values are
LnConstants.DEC_MODE_128A,LnConstants.DEC_MODE_28A,LnConstants.DEC_MODE_128,LnConstants.DEC_MODE_14,LnConstants.DEC_MODE_28TRI,LnConstants.DEC_MODE_28- Returns:
- the encoded decoder operating mode.
-
slotStatus
Get slot status.These bits are set based on the STAT byte as seen in LocoNet slot write and slot read messages. These bits determine whether the command station is actively "refreshing" the loco's speed and direction information on the DCC track signal, and whether the slot is able to be re-assigned for use by another locomotive.
For slot numbers not normally associated with mobile decoders, these bits may have other meanings.
This returns only those bits of the slot's STAT byte which are related to the slot's "status".
Possible values are
LnConstants.LOCO_IN_USE,LnConstants.LOCO_IDLE,LnConstants.LOCO_COMMON,LnConstants.LOCO_FREE- Returns:
- the slot status bits associated with the slot
-
ss2
Get secondary slot status.These bits are set based on the STAT2 byte as seen in LocoNet slot write and slot read messages. These bits determine how the command station interprets the "address" field of the slot.
For slot numbers not normally associated with mobile decoders, these bits may have other meanings.
This returns only those bits of the slot's STAT2 byte which are related to the slot's "secondary status".
- Returns:
- the slot secondary status bits associated with the slot
-
getIsInitilized
Get the state of the Acquire Throttle / slot. It is fully initialized if this is true. If it is false then any changes to its state may be lost.- Returns:
- true
-
setIsInitialized
-
consistStatus
Get consist status.This returns only those bits of the slot's STAT byte which are related to the slot's "consisting status".
For slot numbers not normally associated with mobile decoders, these bits may have other meanings.
Possible values are
LnConstants.CONSIST_NO,LnConstants.CONSIST_TOP,LnConstants.CONSIST_MID,LnConstants.CONSIST_SUB- Returns:
- the slot "consist status", with unrelated bits zeroed
-
isForward
Returns the direction of loco movement which applies when the slot's speed is set for movement.For slot numbers not normally associated with mobile decoders, this bit may have other meanings.
- Returns:
- true if slot is set for forward movement, else false
-
isFunction
Return a slot Function state.See individual Functions for meanings.
- Parameters:
Fn- Function number, 0-28- Returns:
- true if Function is "on", else false
-
isF0
Returns the slot's F0 stateFor slot numbers not normally associated with mobile decoders, this bit may have other meanings.
- Returns:
- true if F0 is "on", else false
-
isF1
Returns the slot's F1 stateFor slot numbers not normally associated with mobile decoders, this bit may have other meanings.
- Returns:
- true if F1 is "on", else false
-
isF2
Returns the slot's F2 stateFor slot numbers not normally associated with mobile decoders, this bit may have other meanings.
- Returns:
- true if F2 is "on", else false
-
isF3
Returns the slot's F3 stateFor slot numbers not normally associated with mobile decoders, this bit may have other meanings.
- Returns:
- true if F3 is "on", else false
-
isF4
Returns the slot's F4 stateFor slot numbers not normally associated with mobile decoders, this bit may have other meanings.
- Returns:
- true if F4 is "on", else false
-
isF5
Returns the slot's F5 stateFor slot numbers not normally associated with mobile decoders, this bit may have other meanings.
- Returns:
- true if F5 is "on", else false
-
isF6
Returns the slot's F6 stateFor slot numbers not normally associated with mobile decoders, this bit may have other meanings.
- Returns:
- true if F6 is "on", else false
-
isF7
Returns the slot's F7 stateFor slot numbers not normally associated with mobile decoders, this bit may have other meanings.
- Returns:
- true if F7 is "on", else false
-
isF8
Returns the slot's F8 stateFor slot numbers not normally associated with mobile decoders, this bit may have other meanings.
- Returns:
- true if F8 is "on", else false
-
isF9
Returns the slot's F9 stateSome command stations do not actively remember the state of this function. JMRI attempts to track the messages which control this function, but may not reliably do so in some cases.
For slot numbers not normally associated with mobile decoders, this bit may have other meanings.
- Returns:
- true if F9 is "on", else false
-
isF10
Returns the slot's F10 stateSome command stations do not actively remember the state of this function. JMRI attempts to track the messages which control this function, but may not reliably do so in some cases.
For slot numbers not normally associated with mobile decoders, this bit may have other meanings.
- Returns:
- true if F10 is "on", else false
-
isF11
Returns the slot's F11 stateSome command stations do not actively remember the state of this function. JMRI attempts to track the messages which control this function, but may not reliably do so in some cases.
For slot numbers not normally associated with mobile decoders, this bit may have other meanings.
- Returns:
- true if F11 is "on", else false
-
isF12
Returns the slot's F12 stateSome command stations do not actively remember the state of this function. JMRI attempts to track the messages which control this function, but may not reliably do so in some cases.
For slot numbers not normally associated with mobile decoders, this bit may have other meanings.
- Returns:
- true if F12 is "on", else false
-
isF13
Returns the slot's F13 stateSome command stations do not actively remember the state of this function. JMRI attempts to track the messages which control this function, but may not reliably do so in some cases.
For slot numbers not normally associated with mobile decoders, this bit may have other meanings.
- Returns:
- true if F13 is "on", else false
-
isF14
Returns the slot's F14 stateSome command stations do not actively remember the state of this function. JMRI attempts to track the messages which control this function, but may not reliably do so in some cases.
For slot numbers not normally associated with mobile decoders, this bit may have other meanings.
- Returns:
- true if F14 is "on", else false
-
isF15
Returns the slot's F15 stateSome command stations do not actively remember the state of this function. JMRI attempts to track the messages which control this function, but may not reliably do so in some cases.
For slot numbers not normally associated with mobile decoders, this bit may have other meanings.
- Returns:
- true if F15 is "on", else false
-
isF16
Returns the slot's F16 stateSome command stations do not actively remember the state of this function. JMRI attempts to track the messages which control this function, but may not reliably do so in some cases.
For slot numbers not normally associated with mobile decoders, this bit may have other meanings.
- Returns:
- true if F16 is "on", else false
-
isF17
Returns the slot's F17 stateSome command stations do not actively remember the state of this function. JMRI attempts to track the messages which control this function, but may not reliably do so in some cases.
For slot numbers not normally associated with mobile decoders, this bit may have other meanings.
- Returns:
- true if F17 is "on", else false
-
isF18
Returns the slot's F1 stateSome command stations do not actively remember the state of this function. JMRI attempts to track the messages which control this function, but may not reliably do so in some cases.
For slot numbers not normally associated with mobile decoders, this bit may have other meanings.
- Returns:
- true if F1 is "on", else false
-
isF19
Returns the slot's F19 stateSome command stations do not actively remember the state of this function. JMRI attempts to track the messages which control this function, but may not reliably do so in some cases.
For slot numbers not normally associated with mobile decoders, this bit may have other meanings.
- Returns:
- true if F19 is "on", else false
-
isF20
Returns the slot's F20 stateSome command stations do not actively remember the state of this function. JMRI attempts to track the messages which control this function, but may not reliably do so in some cases.
For slot numbers not normally associated with mobile decoders, this bit may have other meanings.
- Returns:
- true if F20 is "on", else false
-
isF21
Returns the slot's F21 stateSome command stations do not actively remember the state of this function. JMRI attempts to track the messages which control this function, but may not reliably do so in some cases.
For slot numbers not normally associated with mobile decoders, this bit may have other meanings.
- Returns:
- true if F21 is "on", else false
-
isF22
Returns the slot's F22 stateSome command stations do not actively remember the state of this function. JMRI attempts to track the messages which control this function, but may not reliably do so in some cases.
For slot numbers not normally associated with mobile decoders, this bit may have other meanings.
- Returns:
- true if F22 is "on", else false
-
isF23
Returns the slot's F23 stateSome command stations do not actively remember the state of this function. JMRI attempts to track the messages which control this function, but may not reliably do so in some cases.
For slot numbers not normally associated with mobile decoders, this bit may have other meanings.
- Returns:
- true if F23 is "on", else false
-
isF24
Returns the slot's F24 stateSome command stations do not actively remember the state of this function. JMRI attempts to track the messages which control this function, but may not reliably do so in some cases.
For slot numbers not normally associated with mobile decoders, this bit may have other meanings.
- Returns:
- true if F24 is "on", else false
-
isF25
Returns the slot's F25 stateSome command stations do not actively remember the state of this function. JMRI attempts to track the messages which control this function, but may not reliably do so in some cases.
For slot numbers not normally associated with mobile decoders, this bit may have other meanings.
- Returns:
- true if F25 is "on", else false
-
isF26
Returns the slot's F26 stateSome command stations do not actively remember the state of this function. JMRI attempts to track the messages which control this function, but may not reliably do so in some cases.
For slot numbers not normally associated with mobile decoders, this bit may have other meanings.
- Returns:
- true if F26 is "on", else false
-
isF27
Returns the slot's F27 stateSome command stations do not actively remember the state of this function. JMRI attempts to track the messages which control this function, but may not reliably do so in some cases.
For slot numbers not normally associated with mobile decoders, this bit may have other meanings.
- Returns:
- true if F27 is "on", else false
-
isF28
Returns the slot's F28 stateSome command stations do not actively remember the state of this function. JMRI attempts to track the messages which control this function, but may not reliably do so in some cases.
For slot numbers not normally associated with mobile decoders, this bit may have other meanings.
- Returns:
- true if F28 is "on", else false
-
locoAddr
Returns the mobile decoder address associated with the slot.Note that the returned address can encode a "short" address, a "long" address or an "alias".
For slot numbers not normally associated with mobile decoders, these bits may have other meanings.
- Returns:
- the mobile decoder address
-
speed
Returns the mobile decoder speed associated with the slotIf this slot object is consisted to another slot and is not the "top" of the consist, then the return value is the slot number to which this slot is consisted.
For slot numbers not normally associated with mobile decoders, these bits may have other meanings.
- Returns:
- the current speed step associated with the slot.
-
dirf
Returns the mobile decoder direction and F0-F4 bits, as used in the DIRF bits of various LocoNet messages.If this slot object is consisted to another slot and is not the "top" of the consist, then the "direction" bit reflects the relative direction of this loco with respect to the loco it is consisted to, where "Reverse" means it travels in the "reverse" direction with respect to the loco to which it is consisted.
For slot numbers not normally associated with mobile decoders, these bits may have other meanings.
- Returns:
- the <DIRF> byte value
-
snd
Returns the mobile decoder F5-F8 bits, as used in the SND bits of various LocoNet messages.For slot numbers not normally associated with mobile decoders, these bits may have other meanings.
- Returns:
- the <SND> byte value
-
id
Returns the "Throttle ID" associated with the slot.The returned value is a 14-bit integer comprised of ID1 as the least-significant bits and ID2 as the most-significant bits.
For slot numbers not normally associated with mobile decoders, these bits may have other meanings.
- Returns:
- an integer representing the throttle ID number
-
pcmd
Returns the programmer command associated with the slot.The returned value is taken from the <PCMD> byte of programmer slot read and write LocoNet messages.
For slot numbers other than the programmer slot, these bits may have other meanings.
- Returns:
- the <PCMD> byte
-
cvval
-
setSlot
Update the slot object to reflect the specific contents of a LocoNet message.Note that the object's "slot" field is not updated by this method.
- Parameters:
l- a LocoNet message- Throws:
LocoNetException- if the message is not one which contains slot-related data
-
functionMessage
Sets F9 through F28 (as appropriate) from data extracted from LocoNet "OPC_IMM_PACKET" message.If the pkt parameter does not contain data from an appropriate OPC_IMM_PACKET message, the pkt is ignored and the slot object remains unchanged.
- Parameters:
pkt- is a "long" consisting of four bytes extracted from a LocoNet "OPC_IMM_PACKET" message.
-
writeMode
Update the decoder type bits in STAT1 (D2, D1, D0)- Parameters:
status- New values for STAT1 (D2, D1, D0)- Returns:
- Formatted LocoNet message to change value.
-
writeThrottleID
Sets the object's ID value and returns a LocoNet message to inform the command station that the throttle ID has been changed.- Parameters:
newID- the new ID number to set into the slot object- Returns:
- a LocoNet message containing a "Slot Write" message to inform the command station that a specific throttle is controlling the slot.
-
setThrottleIdentity
Set the throttle ID in the slot- Parameters:
throttleId- full id
-
getThrottleIdentity
Get the throttle ID in the slot- Returns:
- the Id of the Throttle
-
getLeadSlot
-
writeStatus
Update the status mode bits in STAT1 (D5, D4)- Parameters:
status- New values for STAT1 (D5, D4)- Returns:
- Formatted LocoNet message to change value.
-
writeSpeed
Update Speed- Parameters:
speed- new speed- Returns:
- Formatted LocoNet message to change value.
-
dispatchSlot
Create LocoNet message which dispatches this slot Note that the invoking method ought to invoke the slot's NotifySlotListeners method to inform any other interested parties that the slot status has changed.- Returns:
- LocoNet message which "dispatches" the slot
-
writeNullMove
Create a message to perform a null move on this slot.- Returns:
- correct LocoNetMessage for protocol being used.
-
releaseSlot
Create a LocoNet OPC_SLOT_STAT1 message which releases this slot to the "Common" state The invoking method must send the returned LocoNet message to LocoNet in order to have a useful effect. Upon receipt of the echo of the transmitted OPC_SLOT_STAT1 message, the LocoNetSlot object will notify its listeners.- Returns:
- LocoNet message which "releases" the slot to the "Common" state
-
writeSlot
Creates a LocoNet "OPC_WR_SL_DATA" message containing the current state of the LocoNetSlot object.- Returns:
- a LocoNet message which can be used to inform the command station of a change in the slot contents.
-
addSlotListener
Registers a slot listener if it is not already registered.- Parameters:
l- a slot listener
-
removeSlotListener
Un-registers a slot listener.- Parameters:
l- a slot listener
-
getLastUpdateTime
Returns the timestamp when this LocoNetSlot was updated by some LocoNet message.- Returns:
- last time the slot info was updated
-
notifySlotListeners
Notifies all listeners that this slot has been changed in some way. -
setFcCntrlBitOn
For fast-clock slot, set a "CLK_CNTRL" bit On. This method logs an error if invoked for a slot other than the fast-clock slot.- Parameters:
val- is the new "CLK_CNTRL" bit value to turn On
-
setFcCntrlBitOff
For fast-clock slot, set a "CLK_CNTRL" bit Off. This method logs an error if invoked for a slot other than the fast-clock slot.- Parameters:
val- is the new "CLK_CNTRL" bit value to turn Off
-
getTrackStatus
Get the track status byte (location 7)Note that the <TRK> byte is not accurate on some command stations.
- Returns:
- the effective <TRK> byte
-
setTrackStatus
Set the track status byte (location 7)Note that setting the LocoNetSlot object's track status may result in a change to the command station's actual track status if the slot's status is communicated to the command station via an OPC_WR_DL_DATA LocoNet message.
- Parameters:
status- is the new track status value.
-
getFcDays
Return the days value from the slot. Only valid for fast-clock slot.This method logs an error if invoked for a slot other than the fast-clock slot.
- Returns:
- "Days" value currently in fast-clock slot.
-
setFcDays
For fast-clock slot, set "days" value.Note that the new days value is not effective until a LocoNet message is sent which writes the fast-clock slot data.
This method logs an error if invoked for a slot other than the fast-clock slot.
- Parameters:
val- is the new fast-clock "days" value
-
getFcHours
Return the hours value from the slot. Only valid for fast-clock slot.This method logs an error if invoked for a slot other than the fast-clock slot.
- Returns:
- "Hours" value currently stored in fast clock slot.
-
setFcHours
For fast-clock slot, set "hours" value.Note that the new hours value is not effective until a LocoNet message is sent which writes the fast-clock slot data.
This method logs an error if invoked for a slot other than the fast-clock slot.
- Parameters:
val- is the new fast-clock "hours" value
-
getFcMinutes
Return the minutes value from the slot. Only valid for fast-clock slot.This method logs an error if invoked for a slot other than the fast-clock slot.
- Returns:
- Return minutes value currently stored in the fast clock slot.
-
setFcMinutes
For fast-clock slot, set "minutes" value.Note that the new minutes value is not effective until a LocoNet message is sent which writes the fast-clock slot data.
This method logs an error if invoked for a slot other than the fast-clock slot.
- Parameters:
val- is the new fast-clock "minutes" value
-
getFcFracMins
Return the fractional minutes value from the slot. Only valid for fast- clock slot.This method logs an error if invoked for a slot other than the fast-clock slot.
- Returns:
- Return frac_mins field which is the number of 65ms ticks until then next minute rollover. These ticks step at the current fast clock rate
-
setFcFracMins
Set the "frac_mins" value. This has to be calculated as required by the Command Station, then bit shifted if required. It is comprised of a base number and the distance from the base to 0x8000 or 0x4000 deoending on command station. It is read and written as is LO,HO and loses the bit 7 of the LO. It was never intended for external use. The base can be found by setting the clock to 0xXX7F, with a rate of 1 and pounding the clock every 250 to 100 msecs until it roles.Note 1: The new fractional minutes value is not effective until a LocoNet slot write happens
Note 2: DT40x & DT500 throttles ignore this value, and set only the whole minutes.
This method logs an error if invoked for a slot other than the fast-clock slot.
- Parameters:
val- is the new fast-clock "fractional minutes" including the base, and bit shifted if required.
-
getFcRate
Get the fast-clock rate. Only valid for fast-clock slot.This method logs an error if invoked for a slot other than the fast-clock slot.
- Returns:
- Rate stored in fast clock slot.
-
setFcRate
For fast-clock slot, set "rate" value.Note that the new rate is not effective until a LocoNet message is sent which writes the fast-clock slot data.
This method logs an error if invoked for a slot other than the fast-clock slot.
- Parameters:
val- is the new fast-clock rate
-