-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
246 additions
and
168 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Documentation | ||
============= | ||
|
||
This documentation is available via the `DCC-EX website <https://dcc-ex.com/DCCEXProtocol/index.html>`_. | ||
|
||
For contributors wishing to build local copies of the documentation while updating the library, here is the very high level process of the requirements to make this work on Windows: | ||
|
||
- Install `MSYS2 C++ <https://code.visualstudio.com/docs/cpp/config-mingw#_prerequisites>`_ compilers | ||
- Install `CMake <https://cmake.org/download/>`_ and ensure you select the option to add to your user path | ||
- Install `Doxygen <https://www.doxygen.nl/download.html>`_ and once complete, add to your user path | ||
- Install the CMake Tools extension in VSCode | ||
- Setup a Python virtual environment with "virtualenv venv" and activate with "venv\scripts\activate" | ||
- Install required Python modules with "pip3 install -r requirements.txt" | ||
- Change to the docs directory and run "make html" | ||
|
||
Credit for how to do this to the following: | ||
|
||
- Oliver K Ernst on `Medium <https://medium.com/practical-coding/c-documentation-with-doxygen-cmake-sphinx-breathe-for-those-of-use-who-are-totally-lost-7d555386fe13>`_ | ||
- Sy Brand in her `Microsoft Blog <https://devblogs.microsoft.com/cppblog/clear-functional-c-documentation-with-sphinx-breathe-doxygen-cmake/>`_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
Examples | ||
======== | ||
|
||
Several examples have been included to demonstrate functionality of the library. | ||
|
||
Note that all included examples use a WiFi connection, but the protocol is equally suited to other connections types utilising the Arduino Stream base class including Ethernet and Serial. | ||
|
||
To configure WiFi for your settings in all examples, you will need to copy the provided "config.example.h" to "config.h" and update the parameters to suit your environment: | ||
|
||
.. code-block:: cpp | ||
const char* ssid = "YOUR_SSID_HERE"; // WiFi SSID name here | ||
const char* password = "YOUR_PASSWORD_HERE"; // WiFi password here | ||
IPAddress serverAddress(192,168,4,1); // IP address of your EX-CommandStation | ||
int serverPort = 2560; // Network port of your EX-CommandStation | ||
DCCEXProtocol_Basic | ||
------------------- | ||
|
||
This example demonstrates the basics of creating a WiFi connection to your EX-CommandStation using the library, and monitoring for broadcasts and command responses. | ||
|
||
DCCEXProtocol_Delegate | ||
---------------------- | ||
|
||
This example builds on the basic example and, in addition, demonstrates how to implement a custom DCCEXProtocolDelegate class to respond to broadcasts and command responses received from EX-CommandStation. | ||
|
||
DCCEXProtocol_Roster_etc | ||
------------------------ | ||
|
||
This example demonstrates how to retrieve the object types from EX-CommandStation, and further demonstrates how to use the delegate to display these object lists when received. | ||
|
||
DCCEXProtocol_Loco_Control | ||
-------------------------- | ||
|
||
This example demonstrates basic locomotive speed and function control using dummy DCC addresses, in addition to controlling track power and further use of the delegate to notify when updates to the locomotive have been received. | ||
|
||
DCCEXProtocol_Consist_Control | ||
----------------------------- | ||
|
||
This example demonstrates how to setup a software based consist (similar to how this is accomplished in Engine Driver), with basic speed and function control of the configured dummy locomotives. The delegate is also used to notify when updates to the configured locomotives have been received. | ||
|
||
DCCEXProtocol_Turnout_control | ||
----------------------------- | ||
|
||
This example demonstrates the basics of controlling turnouts (or points) with the library, including being notified via the delegate when turnout/point objects have been closed/thrown. | ||
|
||
DCCEXProtocol_Multi_Throttle_Control | ||
------------------------------------ | ||
|
||
This example demonstrates how client throttle software may be written to control multiple locomotives (or consists for that matter) concurrently. | ||
|
||
What can't be demonstrated in this example is the control of speed and direction, which would typically be accomplished with the use of rotary encoders or similar. | ||
|
||
Note when setting speed and direction, these should be sent to the EX-CommandStation via the DCCEXProtocol library, and any local references to these should be set based on the response received, not directly by the input method in use. | ||
|
||
For example, when setting the speed based on the position of a rotary encoder, send that value via the protocol's `setThrottle()` method, but do not display that speed directly. Instead, utlise the delegate's `receivedLocoUpdate()` method to update the displayed speed. | ||
|
||
This ensures that the user of the throttle sees the accurate results of what the throttle is doing, and provides validation that the EX-CommandStation is responding to the user input. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,33 @@ | ||
.. DCCEXProtocol documentation master file, created by | ||
sphinx-quickstart on Thu Nov 30 15:09:50 2023. | ||
You can adapt this file completely to your liking, but it should at least | ||
contain the root `toctree` directive. | ||
Welcome to DCCEXProtocol's documentation! | ||
========================================= | ||
Documentation for the DCC-EX Native command library - DCCEXProtocol | ||
=================================================================== | ||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
:caption: Contents: | ||
:maxdepth: 4 | ||
:hidden: | ||
|
||
self | ||
overview | ||
examples | ||
library | ||
documentation | ||
|
||
Credits | ||
------- | ||
|
||
The delegate and connection code in this library is taken directly from the WiThrottle library by **Copyright © 2018-2019 Blue Knobby Systems Inc.** | ||
The rest of the code has been developed by Peter Akers (Flash62au), Peter Cole (peteGSX), and Chris Harlow (UKBloke). | ||
|
||
DCC-EX Native command protocol library | ||
-------------------------------------- | ||
|
||
This library implements the DCC-EX Native command protocol (as used in EX-CommandStation ONLY), allowing a device to connect to the server and act as a client (such as a hardware based throttle). | ||
|
||
The implementation of this library is tested on ESP32 based devices running the Arduino framework. There's nothing in here that's specific to the ESP32, and little of Arduino that couldn't be replaced as needed. | ||
|
||
There has also been limited testing on STM32F103C8 Bluepill with a serial connection. | ||
|
||
Indices and tables | ||
================== | ||
|
||
* :ref:`genindex` | ||
* :ref:`search` | ||
|
||
Library | ||
======= | ||
|
||
.. doxygenindex:: | ||
:project: DCCEXProtocol |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Library | ||
======= | ||
|
||
.. doxygenindex:: | ||
:project: DCCEXProtocol |
Oops, something went wrong.