Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
dcc::MMOldPayload Struct Reference

Structure defining the volatile state for a Marklin-Motorola v1 protocol locomotive (with 14 speed steps, one function and relative direction only). More...

#include <Loco.hxx>

Public Member Functions

unsigned get_speed_steps ()
 
unsigned get_max_fn ()
 
void set_fn_store (unsigned idx, bool value)
 Set a given function bit in storage.
 
bool get_fn_store (unsigned idx)
 Get a given function bit in storage.
 
unsigned get_fn_update_code (unsigned address)
 

Static Public Member Functions

static TrainAddressType get_address_type ()
 

Public Attributes

unsigned address_: 8
 largest address allowed is 80, but we keep a few more bits around to allow for an extension to arbitrary MM address packets.
 
unsigned lastSetSpeed_: 16
 fp16 value of the last set speed.
 
unsigned fn_: 1
 function f0.
 
unsigned direction_: 1
 0: forward, 1: reverse
 
unsigned directionChanged_: 1
 Whether the direction change packet still needs to go out.
 
unsigned speed_: 4
 Speed step we last set.
 
unsigned isEstop_: 1
 1 if the last speed set was estop.
 
unsigned f0SetDirectional_: 1
 1 if the F0 function should be set/get in a directional way.
 
unsigned f0OnForward_: 1
 1 if directional f0 is used and f0 is on for F.
 
unsigned f0OnReverse_: 1
 1 if directional f0 is used and f0 is on for R.
 
unsigned f0BlankForward_: 1
 1 if F0 should be turned off when dir==forward.
 
unsigned f0BlankReverse_: 1
 1 if F0 should be turned off when dir==reverse.
 

Detailed Description

Structure defining the volatile state for a Marklin-Motorola v1 protocol locomotive (with 14 speed steps, one function and relative direction only).

Definition at line 556 of file Loco.hxx.

Constructor & Destructor Documentation

◆ MMOldPayload()

dcc::MMOldPayload::MMOldPayload ( )
inline

Definition at line 558 of file Loco.hxx.

Member Function Documentation

◆ get_address_type()

static TrainAddressType dcc::MMOldPayload::get_address_type ( )
inlinestatic
Returns
what type of address this train has.

Definition at line 631 of file Loco.hxx.

◆ get_fn_store()

bool dcc::MMOldPayload::get_fn_store ( unsigned  idx)
inline

Get a given function bit in storage.

Parameters
idxfunction number, 0 to get_max_fn.
Returns
function state

Definition at line 618 of file Loco.hxx.

◆ get_fn_update_code()

unsigned dcc::MMOldPayload::get_fn_update_code ( unsigned  address)
inline
Returns
the update code to send to the packet handler for a given function value change.
Parameters
addressis ignored

Definition at line 625 of file Loco.hxx.

◆ get_max_fn()

unsigned dcc::MMOldPayload::get_max_fn ( )
inline
Returns
the largest function number that is still valid.

Definition at line 596 of file Loco.hxx.

◆ get_speed_steps()

unsigned dcc::MMOldPayload::get_speed_steps ( )
inline
Returns
the number of speed steps (in float).

Definition at line 590 of file Loco.hxx.

◆ set_fn_store()

void dcc::MMOldPayload::set_fn_store ( unsigned  idx,
bool  value 
)
inline

Set a given function bit in storage.

Parameters
idxfunction number, 0 to get_max_fn.
valuefunction state

Definition at line 604 of file Loco.hxx.

Member Data Documentation

◆ address_

unsigned dcc::MMOldPayload::address_

largest address allowed is 80, but we keep a few more bits around to allow for an extension to arbitrary MM address packets.

Definition at line 564 of file Loco.hxx.

◆ direction_

unsigned dcc::MMOldPayload::direction_

0: forward, 1: reverse

Definition at line 570 of file Loco.hxx.

◆ directionChanged_

unsigned dcc::MMOldPayload::directionChanged_

Whether the direction change packet still needs to go out.

Definition at line 572 of file Loco.hxx.

◆ f0BlankForward_

unsigned dcc::MMOldPayload::f0BlankForward_

1 if F0 should be turned off when dir==forward.

Definition at line 585 of file Loco.hxx.

◆ f0BlankReverse_

unsigned dcc::MMOldPayload::f0BlankReverse_

1 if F0 should be turned off when dir==reverse.

Definition at line 587 of file Loco.hxx.

◆ f0OnForward_

unsigned dcc::MMOldPayload::f0OnForward_

1 if directional f0 is used and f0 is on for F.

Definition at line 581 of file Loco.hxx.

◆ f0OnReverse_

unsigned dcc::MMOldPayload::f0OnReverse_

1 if directional f0 is used and f0 is on for R.

Definition at line 583 of file Loco.hxx.

◆ f0SetDirectional_

unsigned dcc::MMOldPayload::f0SetDirectional_

1 if the F0 function should be set/get in a directional way.

Definition at line 579 of file Loco.hxx.

◆ fn_

unsigned dcc::MMOldPayload::fn_

function f0.

Definition at line 568 of file Loco.hxx.

◆ isEstop_

unsigned dcc::MMOldPayload::isEstop_

1 if the last speed set was estop.

Definition at line 576 of file Loco.hxx.

◆ lastSetSpeed_

unsigned dcc::MMOldPayload::lastSetSpeed_

fp16 value of the last set speed.

Definition at line 566 of file Loco.hxx.

◆ speed_

unsigned dcc::MMOldPayload::speed_

Speed step we last set.

Definition at line 574 of file Loco.hxx.


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