#include "Turnout.h"
Public Member Functions | |
void | begin (int id, int add, int subAdd) |
void | set (int id, int add, int subAdd) |
void | activate (int s = 1) |
void | inactivate () |
bool | isActivated () |
Static Public Member Functions | |
static Turnout * | get (int id) |
static void | remove (int id) |
static int | count () |
static void | load () |
static void | store () |
static void | parse (char *c) |
static Turnout * | create (int id, int add, int subAdd) |
Public Attributes | |
struct TurnoutData | data |
Turnout * | nextTurnout |
int | eepromPos |
Static Public Attributes | |
static Turnout * | firstTurnout = NULL |
DCC++ BASE STATION can keep track of the direction of any turnout that is controlled by a DCC stationary accessory decoder.
If the TextCommand is used, all turnouts, as well as any other DCC accessories connected in this fashion, can always be operated using the DCC BASE STATION Turnout command.
When controlled as such, the Arduino updates and stores the direction of each Turnout in EEPROM so that it is retained even without power. A list of the current directions of each Turnout in the form <H ID THROW> is generated by this sketch whenever the <s> status command is invoked. This provides an efficient way of initializing the directions of any Turnouts being monitored or controlled by a separate interface or GUI program.
Once all turnouts have been properly defined, use the <E> command to store their definitions to EEPROM. If you later make edits/additions/deletions to the turnout definitions, you must invoke the <E> command if you want those new definitions updated in the EEPROM. You can also clear everything stored in the EEPROM by invoking the <e> command.
Without TextCommand, this is a classic C++ usage. An instance of the structure is created by the user, and functions like begin() and activate() can be applied on this instance. load() and store() of the class can still be used (if USE_EEPROM is activated).
void begin | ( | int | id, |
int | add, | ||
int | subAdd | ||
) |
Initialize the turnout created by regular C++ instantiation.
id | The numeric ID (0-32767) of the sensor. |
add | The primary address of the decoder controlling this turnout (0-511). |
subAdd | The sub-address of the decoder controlling this turnout (0-3). |
Definition at line 33 of file Turnout.cpp.
void set | ( | int | id, |
int | add, | ||
int | subAdd | ||
) |
Force the turnout values created by command line.
id | The numeric ID (0-32767) of the sensor. |
add | The primary address of the decoder controlling this turnout (0-511). |
subAdd | The sub-address of the decoder controlling this turnout (0-3). |
Definition at line 63 of file Turnout.cpp.
void activate | ( | int | s = 1 | ) |
Change the activation state of the turnout.
s | new state : 0 for off, 1 for on. Default is 1. |
Definition at line 72 of file Turnout.cpp.
bool isActivated | ( | ) |
|
static |
Get a particular turnout.
id | The numeric ID (0-32767) of the turnout. |
Definition at line 99 of file Turnout.cpp.
|
static |
Removes a particular turnout.
id | The numeric ID (0-32767) of the turnout. |
Definition at line 107 of file Turnout.cpp.
|
static |
Get the total number of turnouts.
Definition at line 140 of file Turnout.cpp.
|
static |
Load the content of all turnouts from EEPROM.
Definition at line 151 of file Turnout.cpp.
|
static |
Store the content of all turnouts in EEPROM.
Definition at line 180 of file Turnout.cpp.
|
static |
Do command according to the given command string.
c | string to interpret... See syntax in class description. |
Definition at line 205 of file Turnout.cpp.
|
static |
Creates a new turnout in the list..
id | The numeric ID (0-32767) of the sensor. |
add | The primary address of the decoder controlling this turnout (0-511). |
subAdd | The sub-address of the decoder controlling this turnout (0-3). |
Definition at line 242 of file Turnout.cpp.
struct TurnoutData data |
|
static |
Turnout* nextTurnout |