Class NceMacroRestore

java.lang.Object
java.lang.Thread
jmri.jmrix.nce.macro.NceMacroRestore
All Implemented Interfaces:
Runnable, EventListener, AbstractMRListener, NceListener

public class NceMacroRestore
extends Thread
implements NceListener
Restores NCE Macros from a text file defined by NCE.

NCE "Backup macros" dumps the macros into a text file. Each line contains the contents of one macro. The first macro, 0 starts at address xC800. The last macro 255 is at address xDBEC.

NCE file format:

:C800 (macro 0: 20 hex chars representing 10 accessories) :C814 (macro 1: 20 hex chars representing 10 accessories) :C828 (macro 2: 20 hex chars representing 10 accessories) . . :DBEC (macro 255: 20 hex chars representing 10 accessories) :0000

Macro data byte:

bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 _ _ _ _ 1 0 A A A A A A 1 A A A C D D D addr bit 7 6 5 4 3 2 10 9 8 1 0 turnout T

By convention, MSB address bits 10 - 8 are one's complement. NCE macros always set the C bit to 1. The LSB "D" (0) determines if the accessory is to be thrown (0) or closed (1). The next two bits "D D" are the LSBs of the accessory address. Note that NCE display addresses are 1 greater than NMRA DCC. Note that address bit 2 isn't supposed to be inverted, but it is the way NCE implemented their macros.

Examples:

81F8 = accessory 1 thrown 9FFC = accessory 123 thrown B5FD = accessory 211 close BF8F = accessory 2044 close

FF10 = link macro 16

The restore routine checks that each line of the file begins with the appropriate macro address.