DCC-EX Simple Throttle
Simple throttle for a DCC-EX CommandStation
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | List of all members
ThrottleScreen Class Reference

#include <ThrottleScreen.h>

Inheritance diagram for ThrottleScreen:
Inheritance graph
[legend]
Collaboration diagram for ThrottleScreen:
Collaboration graph
[legend]

Public Member Functions

 ThrottleScreen (DCCEXProtocol *dccexProtocolClient, uint8_t throttleStep, uint8_t throttleStepFaster, uint8_t throttleStepFastest)
 Constructor for the throttle screen, requires throttle step values.
 
void handleUserConfirmationAction (UserConfirmationAction action) override
 Implement this method to define what to do when user confirmation actions are performed.
 
void handleUserSelectionAction (UserSelectionAction action, bool throttleInverted) override
 Implement this method to define what to do when user selection actions are performed.
 
void drawScreen (DisplayInterface *display) override
 Implement this method to draw the associated screen object on the specified display.
 
void setLoco (Loco *loco)
 Set the loco currently being operated.
 
void locoBroadcastReceived (LocoBroadcast locoBroadcast)
 Method to call when a loco broadcast has been received.
 
uint8_t getSpeed ()
 Get the current speed.
 
void trackPowerUpdateReceived (TrackPower trackPower)
 Method to call when a track power update has been received.
 
void requestLocoUpdate ()
 Explicitly request an update for the currently selected loco address.
 
void requestTrackPowerUpdate ()
 Explicitly request a track power update (actually sends for server version which does this)
 
- Public Member Functions inherited from ScreenInterface
virtual ~ScreenInterface ()=default
 Destructor for the object.
 
ScreenInterfacegetNext ()
 Get the next screen object in the linked list.
 
void setNext (ScreenInterface *screen)
 Set the next screen object in the linked list.
 

Private Member Functions

void _toggleTrackPower ()
 Toggle track power state - if unknown, turn on.
 
void _toggleLights ()
 Toggle lights (assumed to be F0) on/off.
 

Private Attributes

uint8_t _speed
 
bool _speedChanged
 
Direction _direction
 
bool _directionChanged
 
Loco * _loco
 
TrackPower _trackPower
 
bool _trackPowerChanged
 
DCCEXProtocol * _dccexProtocolClient
 
uint8_t _throttleStep
 
uint8_t _throttleStepFaster
 
uint8_t _throttleStepFastest
 
unsigned long _speedUpdateDelay
 
unsigned long _lastSpeedUpdate
 

Constructor & Destructor Documentation

◆ ThrottleScreen()

ThrottleScreen::ThrottleScreen ( DCCEXProtocol *  dccexProtocolClient,
uint8_t  throttleStep,
uint8_t  throttleStepFaster,
uint8_t  throttleStepFastest 
)

Constructor for the throttle screen, requires throttle step values.

Parameters
dccexProtocolClientPointer to the DCCEXProtocol client connection in use by the application
throttleStepNormal throttle step change
throttleStepFasterFaster throttle step change (eg. rotary encoder moves faster)
throttleStepFastestFastest throttle step change (eg. rotary encoder moves fastest)

Member Function Documentation

◆ _toggleLights()

void ThrottleScreen::_toggleLights ( )
private

Toggle lights (assumed to be F0) on/off.

Here is the caller graph for this function:

◆ _toggleTrackPower()

void ThrottleScreen::_toggleTrackPower ( )
private

Toggle track power state - if unknown, turn on.

Here is the caller graph for this function:

◆ drawScreen()

void ThrottleScreen::drawScreen ( DisplayInterface display)
overridevirtual

Implement this method to draw the associated screen object on the specified display.

Parameters
displayPointer to the display object

Implements ScreenInterface.

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

◆ getSpeed()

uint8_t ThrottleScreen::getSpeed ( )

Get the current speed.

Returns
Speed
Here is the caller graph for this function:

◆ handleUserConfirmationAction()

void ThrottleScreen::handleUserConfirmationAction ( UserConfirmationAction  action)
overridevirtual

Implement this method to define what to do when user confirmation actions are performed.

Parameters
actionUserConfirmationAction::[None|SingleClick|DoubleClick|LongPress]

Implements ScreenInterface.

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

◆ handleUserSelectionAction()

void ThrottleScreen::handleUserSelectionAction ( UserSelectionAction  action,
bool  throttleInverted 
)
overridevirtual

Implement this method to define what to do when user selection actions are performed.

Parameters
actionUserSelectionAction::[None|Up|UpFaster|UpFastest|Down|DownFaster|DownFastest]

Implements ScreenInterface.

Here is the caller graph for this function:

◆ locoBroadcastReceived()

void ThrottleScreen::locoBroadcastReceived ( LocoBroadcast  locoBroadcast)

Method to call when a loco broadcast has been received.

Parameters
locoBroadcastLocoBroadcast data structure containing address, speed, direction, and function map
Here is the caller graph for this function:

◆ requestLocoUpdate()

void ThrottleScreen::requestLocoUpdate ( )

Explicitly request an update for the currently selected loco address.

Here is the caller graph for this function:

◆ requestTrackPowerUpdate()

void ThrottleScreen::requestTrackPowerUpdate ( )

Explicitly request a track power update (actually sends for server version which does this)

Here is the caller graph for this function:

◆ setLoco()

void ThrottleScreen::setLoco ( Loco *  loco)

Set the loco currently being operated.

Parameters
locoPointer to the loco object
Here is the caller graph for this function:

◆ trackPowerUpdateReceived()

void ThrottleScreen::trackPowerUpdateReceived ( TrackPower  trackPower)

Method to call when a track power update has been received.

Parameters
trackPowerTrack power state
Here is the caller graph for this function:

Member Data Documentation

◆ _dccexProtocolClient

DCCEXProtocol* ThrottleScreen::_dccexProtocolClient
private

◆ _direction

Direction ThrottleScreen::_direction
private

◆ _directionChanged

bool ThrottleScreen::_directionChanged
private

◆ _lastSpeedUpdate

unsigned long ThrottleScreen::_lastSpeedUpdate
private

◆ _loco

Loco* ThrottleScreen::_loco
private

◆ _speed

uint8_t ThrottleScreen::_speed
private

◆ _speedChanged

bool ThrottleScreen::_speedChanged
private

◆ _speedUpdateDelay

unsigned long ThrottleScreen::_speedUpdateDelay
private

◆ _throttleStep

uint8_t ThrottleScreen::_throttleStep
private

◆ _throttleStepFaster

uint8_t ThrottleScreen::_throttleStepFaster
private

◆ _throttleStepFastest

uint8_t ThrottleScreen::_throttleStepFastest
private

◆ _trackPower

TrackPower ThrottleScreen::_trackPower
private

◆ _trackPowerChanged

bool ThrottleScreen::_trackPowerChanged
private

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