Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
Loco.hxx File Reference
#include "dcc/Defs.hxx"
#include "dcc/Packet.hxx"
#include "dcc/PacketSource.hxx"
#include "dcc/UpdateLoop.hxx"
#include "utils/constants.hxx"
#include "utils/logging.h"

Go to the source code of this file.

Classes

class  dcc::AbstractTrain< P >
 AbstractTrain is a templated class for train implementations in a command station. More...
 
struct  dcc::DccPayloadBase
 Common storage variables for the different DCC Payload types. More...
 
struct  dcc::Dcc28Payload
 Structure defining the volatile state for a 28-speed-step DCC locomotive. More...
 
class  dcc::DccTrain< Payload >
 TrainImpl class for a DCC locomotive. More...
 
struct  dcc::Dcc128Payload
 Structure defining the volatile state for a 128-speed-step DCC locomotive. More...
 
struct  dcc::MMOldPayload
 Structure defining the volatile state for a Marklin-Motorola v1 protocol locomotive (with 14 speed steps, one function and relative direction only). More...
 
class  dcc::MMOldTrain
 TrainImpl structure for Marklin-Motorola v1 protocol locomotives. More...
 
struct  dcc::MMNewPayload
 Structure defining the volatile state for a Marklin-Motorola v2 protocol locomotive (with 28 speed steps, five functions and absolute direction). More...
 
class  dcc::MMNewTrain
 TrainImpl structure for Marklin-Motorola v2 protocol locomotives. More...
 

Typedefs

typedef DccTrain< Dcc28Payloaddcc::Dcc28Train
 TrainImpl class for a 28-speed-step DCC locomotive.
 
typedef DccTrain< Dcc128Payloaddcc::Dcc128Train
 TrainImpl class for a 128-speed-step DCC locomotive.
 

Enumerations

enum  dcc::DccTrainUpdateCode {
  REFRESH = 0 , SPEED = 1 , FUNCTION0 = 2 , FUNCTION5 = 3 ,
  FUNCTION9 = 4 , FUNCTION13 = 5 , FUNCTION21 = 6 , FUNCTION29 = 7 ,
  FUNCTION37 = 8 , FUNCTION45 = 9 , FUNCTION53 = 10 , FUNCTION61 = 11 ,
  MM_F1 = 2 , MM_F2 , MM_F3 , MM_F4 ,
  MIN_REFRESH = SPEED , dcc::MAX_REFRESH = FUNCTION9 , MM_MAX_REFRESH = 7 , ESTOP = 16
}
 Describes what sort of packet the dcc:PacketSource (usually a single train) should generate. More...
 

Functions

 DECLARE_CONST (dcc_virtual_f0_offset)
 At this function number there will be three virtual functions available on the OpenLCB TrainImpl, controlling advanced functions related to the light (f0) function of trains.
 

Detailed Description

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Defines a simple DCC locomotive.

Author
Balazs Racz
Date
10 May 2014

Definition in file Loco.hxx.

Typedef Documentation

◆ Dcc128Train

typedef DccTrain<Dcc128Payload> dcc::Dcc128Train

TrainImpl class for a 128-speed-step DCC locomotive.

Definition at line 552 of file Loco.hxx.

◆ Dcc28Train

typedef DccTrain<Dcc28Payload> dcc::Dcc28Train

TrainImpl class for a 28-speed-step DCC locomotive.

Definition at line 520 of file Loco.hxx.

Enumeration Type Documentation

◆ DccTrainUpdateCode

Describes what sort of packet the dcc:PacketSource (usually a single train) should generate.

This is used for two purposes:

  • When a user action results in a high priority band packet to be enerated, we can enqueue a message containing this code to the refreshloop object. Then when the refresh loop gets to the given packet, the train will be called with the appropriate code to generate the desired packet from its internal state (the freshest version of that).
  • When a train is on the background refresh loop, it can keep an internal variable describing what packet to generate next as a refresh packet.
Enumerator
MAX_REFRESH 

@TODO(balazs.racz) choose adaptive max-refresh based on how many functions are actually in use for the loco.

Definition at line 64 of file Loco.hxx.