LCC Fusion Project 1.0
LCC Automation
Loading...
Searching...
No Matches
Turnout Struct Reference

#include <Turnout.h>

Collaboration diagram for Turnout:

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 Turnoutget (int id)
 
static void remove (int id)
 
static int count ()
 
static void show ()
 
static bool parse (char *c)
 
static Turnoutcreate (int id, int add, int subAdd)
 

Public Attributes

struct TurnoutData data
 
TurnoutnextTurnout
 

Static Public Attributes

static TurnoutfirstTurnout = NULL
 

Detailed Description

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).

Definition at line 120 of file Turnout.h.

Member Function Documentation

◆ activate()

void Turnout::activate ( int  s = 1)

Change the activation state of the turnout.

Parameters
snew state : 0 for off, 1 for on. Default is 1.

Definition at line 76 of file Turnout.cpp.

Here is the caller graph for this function:

◆ begin()

void Turnout::begin ( int  id,
int  add,
int  subAdd 
)

Initialize the turnout created by regular C++ instantiation.

Parameters
idThe numeric ID (0-32767) of the sensor.
addThe primary address of the decoder controlling this turnout (0-511).
subAddThe sub-address of the decoder controlling this turnout (0-3).
Remarks
Should not be used in command line mode.

Definition at line 37 of file Turnout.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ count()

int Turnout::count ( )
static

Get the total number of turnouts.

Returns
Number of turnouts.
Remarks
Only available when USE_EEPROM or USE_TEXTCOMMAND is defined.

Definition at line 144 of file Turnout.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ create()

Turnout * Turnout::create ( int  id,
int  add,
int  subAdd 
)
static

Creates a new turnout in the list..

Parameters
idThe numeric ID (0-32767) of the sensor.
addThe primary address of the decoder controlling this turnout (0-511).
subAddThe sub-address of the decoder controlling this turnout (0-3).
Remarks
Should not be used in C++ mode.
Only available when USE_TEXTCOMMAND is defined.

Definition at line 262 of file Turnout.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get()

Turnout * Turnout::get ( int  id)
static

Get a particular turnout.

Parameters
idThe numeric ID (0-32767) of the turnout.
Returns
The found turnout or NULL if not found.
Remarks
Only available when USE_EEPROM or USE_TEXTCOMMAND is defined.

Definition at line 103 of file Turnout.cpp.

Here is the caller graph for this function:

◆ inactivate()

void Turnout::inactivate ( )
inline

Inactivate the turnout.

Definition at line 144 of file Turnout.h.

Here is the call graph for this function:

◆ isActivated()

bool Turnout::isActivated ( )
inline

Checks if the output is activated or not.

Returns
True if the output is activated. Otherwise false (of course...).

Definition at line 148 of file Turnout.h.

◆ parse()

bool Turnout::parse ( char *  c)
static

Do command according to the given command string.

Parameters
cstring to interpret... See syntax in class description.
Remarks
Only available when USE_TEXTCOMMAND is defined.

Definition at line 209 of file Turnout.cpp.

Here is the call graph for this function:

◆ remove()

void Turnout::remove ( int  id)
static

Removes a particular turnout.

Parameters
idThe numeric ID (0-32767) of the turnout.
Remarks
Only available when USE_EEPROM or USE_TEXTCOMMAND is defined.

Definition at line 111 of file Turnout.cpp.

Here is the caller graph for this function:

◆ set()

void Turnout::set ( int  id,
int  add,
int  subAdd 
)

Force the turnout values created by command line.

Parameters
idThe numeric ID (0-32767) of the sensor.
addThe primary address of the decoder controlling this turnout (0-511).
subAddThe sub-address of the decoder controlling this turnout (0-3).
Remarks
Should not be used in C++ mode.

Definition at line 67 of file Turnout.cpp.

Here is the caller graph for this function:

◆ show()

void Turnout::show ( )
static

Show the content of all the turnouts.

Remarks
Only available when DCCPP_PRINT_DCCPP is defined.

Definition at line 287 of file Turnout.cpp.

Here is the caller graph for this function:

Member Data Documentation

◆ data

struct TurnoutData Turnout::data

Data associated to this output.

Definition at line 122 of file Turnout.h.

◆ firstTurnout

Turnout * Turnout::firstTurnout = NULL
static

Address of the first object of this class. NULL means empty list of turnouts. Do not change it !

Definition at line 151 of file Turnout.h.

◆ nextTurnout

Turnout* Turnout::nextTurnout

Address of the next object of this class. NULL means end of the list of turnouts. Do not change it !

Definition at line 152 of file Turnout.h.


The documentation for this struct was generated from the following files: