mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2025-07-29 18:33:44 +02:00
Compare commits
146 Commits
v3.2.0rc12
...
frightrisk
Author | SHA1 | Date | |
---|---|---|---|
|
56bcb57d83 | ||
|
354cc0cbcb | ||
|
99521f8a3f | ||
|
fcf05206b4 | ||
|
cc3aba1feb | ||
|
91d36ae909 | ||
|
98af5c45ed | ||
|
d3eceb6d6c | ||
|
79eaaa85fa | ||
|
0f5b8adb6b | ||
|
da8faa808b | ||
|
7311f2ce64 | ||
|
7e4f9eb0e1 | ||
|
1f5eafbcca | ||
|
7e16ec7088 | ||
|
912646f8ff | ||
|
dd309a3705 | ||
|
5376c9f410 | ||
|
b1d110ecbf | ||
|
5b7801ca6c | ||
|
aca9c9c941 | ||
|
6f94cd71ab | ||
|
1827a11f83 | ||
|
0023ce3356 | ||
|
7b9f3ae08d | ||
|
5e50731a78 | ||
|
df6c511d1d | ||
|
4bfd4b1a12 | ||
|
4a3f3d0f34 | ||
|
f0d1909d9f | ||
|
daf6799ac1 | ||
|
b7a010f904 | ||
|
d1518b8af0 | ||
|
39a85903ce | ||
|
d72474cd8f | ||
|
941e74beaf | ||
|
e618b91900 | ||
|
dcab5a0e72 | ||
|
1901d9547e | ||
|
7388d14bab | ||
|
2da28ad2db | ||
|
06bd80438e | ||
|
cd15eed005 | ||
|
23d0158804 | ||
|
2e9e614ad5 | ||
|
64b1de08be | ||
|
34c3d10767 | ||
|
f2eb64fd21 | ||
|
a80b16acba | ||
|
b1f5e9f48c | ||
|
661d042744 | ||
|
ebebd0dc11 | ||
|
506b65d0ea | ||
|
632d777fe7 | ||
|
ff73a60874 | ||
|
357560b226 | ||
|
589336eac3 | ||
|
e13afd064d | ||
|
2d37947246 | ||
|
9367d708f7 | ||
|
a614a616fa | ||
|
2fd7a31ae4 | ||
|
977802f160 | ||
|
7b40bd3290 | ||
|
b2df10a99a | ||
|
0dc91451d9 | ||
|
85c437b108 | ||
|
f7d64d5449 | ||
|
e7fb3648b0 | ||
|
c58a126dfc | ||
|
afd94f0645 | ||
|
ad97592788 | ||
|
431208d191 | ||
|
17eb7c560e | ||
|
ff4dd2f1cd | ||
|
9cf70f5870 | ||
|
14834d47a5 | ||
|
6515f1b512 | ||
|
64cae26333 | ||
|
920fcbc095 | ||
|
45f690eb4d | ||
|
766fdc43ac | ||
|
32fdb014ef | ||
|
28a4406044 | ||
|
20b12bcb7c | ||
|
e13175635c | ||
|
b41ca2f44a | ||
|
bfb88bb30a | ||
|
5846e0fe23 | ||
|
4c8b7f8517 | ||
|
7c1c6dafa1 | ||
|
731d838e83 | ||
|
566f8ada23 | ||
|
a4c2ab7566 | ||
|
8085d03d65 | ||
|
0ab3fe07c5 | ||
|
a37ca6b6b6 | ||
|
5b12c2864d | ||
|
90ca262cd9 | ||
|
b29eedf772 | ||
|
71cd3fc292 | ||
|
331538549f | ||
|
6826e01bd3 | ||
|
931e348c3d | ||
|
2cd0c169ce | ||
|
92c2768c0b | ||
|
0040f5caf6 | ||
|
349f5d5362 | ||
|
269e1b36ea | ||
|
367e400d75 | ||
|
f5fb1540f0 | ||
|
ac3ffd2a36 | ||
|
c15ea6e083 | ||
|
90092b4ad5 | ||
|
fa4f5f08ef | ||
|
3038f29dac | ||
|
e57cd1e2aa | ||
|
c47dd101a5 | ||
|
cf905ce2f3 | ||
|
4bfcaa605a | ||
|
557b71c036 | ||
|
d0b01e3f03 | ||
|
bd9a04572d | ||
|
a26d988acc | ||
|
4300a3fdac | ||
|
22bf2b69f1 | ||
|
58ef7d25db | ||
|
1ec3b173fd | ||
|
07c0004996 | ||
|
99a62883c7 | ||
|
b7af6be1f2 | ||
|
eb6b14b848 | ||
|
fa261ec39f | ||
|
4ebf7978d8 | ||
|
a0a635c167 | ||
|
ca0c34f9fa | ||
|
b6501c7e3e | ||
|
8af74f7082 | ||
|
75598b2b8b | ||
|
bd7c8bf78e | ||
|
05545321a9 | ||
|
03f7014c02 | ||
|
306f100085 | ||
|
509014bb6a | ||
|
f577c11eb7 | ||
|
b4aa47a451 |
2
.github/FUNDING.yml
vendored
Normal file
2
.github/FUNDING.yml
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
github: DCC-EX
|
||||
patreon: dccex
|
80
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
Normal file
80
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
# Bug report GitHub issue form
|
||||
#
|
||||
# This file needs to reside in the ".github/ISSUE_TEMPLATE/" folder.
|
||||
|
||||
name: Bug Report
|
||||
description: Submit a bug report
|
||||
labels:
|
||||
- Bug
|
||||
title: "Bug Report: "
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Thanks for taking the time to submit a bug report to the DCC-EX team!
|
||||
|
||||
In order to help us to validate the bug and ascertain what's causing it, please provide as much information as possible in this form.
|
||||
|
||||
- type: input
|
||||
id: version
|
||||
attributes:
|
||||
label: Version
|
||||
description: Please provide the version of EX-CommandStation in use.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: description
|
||||
attributes:
|
||||
label: Bug description
|
||||
description: Please provide a clear and concise description of what the symptoms of the bug are.
|
||||
placeholder: |
|
||||
When attempting to drive a locomotive on the main track, it runs forwards, backwards, spins around, jumps up and down, blows the horn, and then stops.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: reproduction
|
||||
attributes:
|
||||
label: Steps to reproduce the bug
|
||||
description: Please provide the steps to reproduce the behaviour.
|
||||
placeholder: |
|
||||
1. Turn on the CommandStation and track power.
|
||||
2. Connect Engine Driver to the CommandStation.
|
||||
3. Select locomotive with address 123.
|
||||
4. Throttle up to half speed.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: expectation
|
||||
attributes:
|
||||
label: Expected behaviour
|
||||
description: Please provide a clear and concise description of what you expected to happen.
|
||||
placeholder: |
|
||||
The locomotive should accelerate smoothly to half speed in a forward direction.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: screenshots
|
||||
attributes:
|
||||
label: Screenshots
|
||||
description: If applicable, upload any screenshots here.
|
||||
|
||||
- type: textarea
|
||||
id: hardware
|
||||
attributes:
|
||||
label: Hardware in use
|
||||
description: Please provide details of hardware in use including microcontroller, motor shield, and any other relevant information.
|
||||
placeholder: |
|
||||
Elegoo Mega2560
|
||||
Arduino R3 motor shield
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: extra-context
|
||||
attributes:
|
||||
label: Additional context
|
||||
description: Please provide any other relevant information that could help us resolve this issue, for example a customised config.h file.
|
12
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
12
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
# Configuration file for the template chooser
|
||||
#
|
||||
# This file needs to exist in the https://github.com/DCC-EX/.github repository in the ".github/ISSUE_TEMPLATE/" folder.
|
||||
|
||||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: DCC-EX Discord server
|
||||
url: https://discord.gg/y2sB4Fp
|
||||
about: For the best support experience, join our Discord server
|
||||
- name: DCC-EX Contact and Support page
|
||||
url: https://dcc-ex.com/support/index.html
|
||||
about: For other support options, refer to our Contact & Support page
|
31
.github/ISSUE_TEMPLATE/documentation_update.yml
vendored
Normal file
31
.github/ISSUE_TEMPLATE/documentation_update.yml
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
# Documentation update GitHub issue form
|
||||
#
|
||||
# This file needs to reside in the ".github/ISSUE_TEMPLATE/" folder.
|
||||
|
||||
name: Documentation Update
|
||||
description: Submit a request for documentation updates, or to report broken links or inaccuracies
|
||||
title: "[Documentation Update]: "
|
||||
labels:
|
||||
- Needs Documentation
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Use this template to submit a request for updates to our documentation.
|
||||
|
||||
This can be used for general documentation requests if information is missing or lacking, or to correct issues with our existing documentation such as broken links, or inaccurate information.
|
||||
|
||||
- type: textarea
|
||||
id: details
|
||||
attributes:
|
||||
label: Documentation details
|
||||
description: Provide the details of what needs to be documented or corrected.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: input
|
||||
id: page
|
||||
attributes:
|
||||
label: Page with issues
|
||||
description: If reporting broken links or inaccuracies, please provide the link to the page here.
|
||||
placeholder: https://dcc-ex.com/index.html
|
37
.github/ISSUE_TEMPLATE/feature_request.yml
vendored
Normal file
37
.github/ISSUE_TEMPLATE/feature_request.yml
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
# Feature Request GitHub issue form
|
||||
#
|
||||
# This file needs to reside in the ".github/ISSUE_TEMPLATE/" folder.
|
||||
|
||||
name: Feature Request
|
||||
description: Suggest a new feature
|
||||
title: "[Feature Request]: "
|
||||
labels:
|
||||
- Enhancement
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Use this template to suggest a new feature for EX-CommandStation.
|
||||
|
||||
- type: textarea
|
||||
id: description
|
||||
attributes:
|
||||
label: Problem/idea statement
|
||||
description: Please provide the problem you're trying to solve, or share the idea you have.
|
||||
placeholder: A clear and concise description of the problem you're trying to solve, or the idea you have. For example, I'm always frustrated when...
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: alternatives
|
||||
attributes:
|
||||
label: Alternatives or workarounds
|
||||
description: Please provide any alternatives or workarounds you currently use.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: context
|
||||
attributes:
|
||||
label: Additional context
|
||||
description: Add any other context, screenshots, or files related to the feature request here.
|
39
.github/ISSUE_TEMPLATE/support_request.yml
vendored
Normal file
39
.github/ISSUE_TEMPLATE/support_request.yml
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
# Support Request GitHub issue form
|
||||
#
|
||||
# This file needs to reside in the ".github/ISSUE_TEMPLATE/" folder.
|
||||
|
||||
name: Support Request
|
||||
description: Request support or assistance
|
||||
title: "[Support Request]: "
|
||||
labels:
|
||||
- Support Request
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Use this template to request support or assistance with EX-CommandStation.
|
||||
|
||||
- type: input
|
||||
id: version
|
||||
attributes:
|
||||
label: Version
|
||||
description: Please provide the version of the software in use.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: description
|
||||
attributes:
|
||||
label: Issue description
|
||||
description: Please describe the issue being encountered as accurately and detailed as possible.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: hardware
|
||||
attributes:
|
||||
label: Hardware
|
||||
description: If appropriate, please provide details of the hardware in use.
|
||||
placeholder: |
|
||||
Elegoo Mega2560
|
||||
Arduino Motor Shield R3
|
24
.github/ISSUE_TEMPLATE/to_do.yml
vendored
Normal file
24
.github/ISSUE_TEMPLATE/to_do.yml
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
# General To Do item GitHub issue form
|
||||
#
|
||||
# This file needs to reside in the ".github/ISSUE_TEMPLATE/" folder.
|
||||
|
||||
name: To Do
|
||||
description: Create a general To Do item
|
||||
title: "[To Do]: "
|
||||
labels:
|
||||
- To Do
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Use this template to create an issue for a general task that needs to be done.
|
||||
|
||||
This is handy for capturing ad-hoc items that don't necessarily require code to be written or updated.
|
||||
|
||||
- type: textarea
|
||||
id: description
|
||||
attributes:
|
||||
label: Task description
|
||||
description: Provide the details of what needs to be done.
|
||||
validations:
|
||||
required: true
|
14
.github/workflows/label-sponsors.yml
vendored
Normal file
14
.github/workflows/label-sponsors.yml
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
name: Label sponsors
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened]
|
||||
issues:
|
||||
types: [opened]
|
||||
jobs:
|
||||
build:
|
||||
name: is-sponsor-label
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: JasonEtco/is-sponsor-label-action@v1.2.0
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
156
.github/workflows/new-items.yml
vendored
Normal file
156
.github/workflows/new-items.yml
vendored
Normal file
@@ -0,0 +1,156 @@
|
||||
# This workflow is to be used for all repositories to integrate with the DCC++ EX Beta Project.
|
||||
# It will add all issues and pull requests for a repository to the project, and put in the correct status.
|
||||
#
|
||||
# Ensure "REPO_LABEL" is updated with the correct label for the repo stream of work.
|
||||
name: Add Issue or Pull Request to Project
|
||||
|
||||
env:
|
||||
REPO_LABEL: ${{ secrets.PROJECT_STREAM_LABEL }}
|
||||
PROJECT_NUMBER: 7
|
||||
ORG: DCC-EX
|
||||
|
||||
on:
|
||||
issues:
|
||||
types:
|
||||
- opened
|
||||
pull_request_target:
|
||||
types:
|
||||
- ready_for_review
|
||||
- opened
|
||||
- review_requested
|
||||
|
||||
jobs:
|
||||
add_to_project:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Add labels
|
||||
uses: andymckay/labeler@master
|
||||
with:
|
||||
add-labels: ${{ env.REPO_LABEL }}
|
||||
|
||||
- name: Generate token
|
||||
id: generate_token
|
||||
uses: tibdex/github-app-token@36464acb844fc53b9b8b2401da68844f6b05ebb0
|
||||
with:
|
||||
app_id: ${{ secrets.PROJECT_APP_ID }}
|
||||
private_key: ${{ secrets. PROJECT_APP_KEY }}
|
||||
|
||||
- name: Get project data
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
|
||||
run: |
|
||||
gh api graphql -f query='
|
||||
query($org: String!, $number: Int!) {
|
||||
organization(login: $org){
|
||||
projectV2(number: $number) {
|
||||
id
|
||||
fields(first:20) {
|
||||
nodes {
|
||||
... on ProjectV2Field {
|
||||
id
|
||||
name
|
||||
}
|
||||
... on ProjectV2SingleSelectField {
|
||||
id
|
||||
name
|
||||
options {
|
||||
id
|
||||
name
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}' -f org=$ORG -F number=$PROJECT_NUMBER > project_data.json
|
||||
|
||||
echo 'PROJECT_ID='$(jq '.data.organization.projectV2.id' project_data.json) >> $GITHUB_ENV
|
||||
echo 'STATUS_FIELD_ID='$(jq '.data.organization.projectV2.fields.nodes[] | select(.name== "Status") | .id' project_data.json) >> $GITHUB_ENV
|
||||
echo 'BACKLOG_OPTION_ID='$(jq '.data.organization.projectV2.fields.nodes[] | select(.name== "Status") |.options[] | select(.name=="Backlog") |.id' project_data.json) >> $GITHUB_ENV
|
||||
echo 'TO_DO_OPTION_ID='$(jq '.data.organization.projectV2.fields.nodes[] | select(.name== "Status") |.options[] | select(.name=="To Do") |.id' project_data.json) >> $GITHUB_ENV
|
||||
echo 'NEEDS_REVIEW_OPTION_ID='$(jq '.data.organization.projectV2.fields.nodes[] | select(.name== "Status") |.options[] | select(.name=="Needs Review") |.id' project_data.json) >> $GITHUB_ENV
|
||||
echo 'IN_PROGRESS_OPTION_ID='$(jq '.data.organization.projectV2.fields.nodes[] | select(.name== "Status") |.options[] | select(.name=="In Progress") |.id' project_data.json) >> $GITHUB_ENV
|
||||
|
||||
- name: Add issue to project
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
|
||||
ITEM_ID: ${{ github.event.issue.node_id }}
|
||||
if: github.event_name == 'issues'
|
||||
run: |
|
||||
project_item_id="$( gh api graphql -f query='
|
||||
mutation($project:ID!, $item:ID!) {
|
||||
addProjectV2ItemById(input: {projectId: $project, contentId: $item}) {
|
||||
item {
|
||||
id
|
||||
}
|
||||
}
|
||||
}' -f project=$PROJECT_ID -f item=$ITEM_ID --jq '.data.addProjectV2ItemById.item.id')"
|
||||
echo 'PROJECT_ITEM_ID='$project_item_id >> $GITHUB_ENV
|
||||
|
||||
- name: Add PR to project
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
|
||||
ITEM_ID: ${{ github.event.pull_request.node_id }}
|
||||
if: github.event_name == 'pull_request'
|
||||
run: |
|
||||
project_item_id="$( gh api graphql -f query='
|
||||
mutation($project:ID!, $item:ID!) {
|
||||
addProjectV2ItemById(input: {projectId: $project, contentId: $item}) {
|
||||
item {
|
||||
id
|
||||
}
|
||||
}
|
||||
}' -f project=$PROJECT_ID -f item=$ITEM_ID --jq '.data.addProjectV2ItemById.item.id')"
|
||||
echo 'PROJECT_ITEM_ID='$project_item_id >> $GITHUB_ENV
|
||||
|
||||
- name: Set status - To Do
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
|
||||
if: github.event_name == 'issues' && (contains(github.event.*.labels.*.name, 'Bug') || contains(github.event.*.labels.*.name, 'Support Request'))
|
||||
run: |
|
||||
gh api graphql -f query='
|
||||
mutation(
|
||||
$project: ID!
|
||||
$item: ID!
|
||||
$status_field: ID!
|
||||
$status_value: String!
|
||||
){
|
||||
set_status: updateProjectV2ItemFieldValue(input: {
|
||||
projectId: $project
|
||||
itemId: $item
|
||||
fieldId: $status_field
|
||||
value: {
|
||||
singleSelectOptionId: $status_value
|
||||
}
|
||||
}) {
|
||||
projectV2Item {
|
||||
id
|
||||
}
|
||||
}
|
||||
}' -f project=$PROJECT_ID -f item=$PROJECT_ITEM_ID -f status_field=$STATUS_FIELD_ID -f status_value=${{ env.TO_DO_OPTION_ID }} --silent
|
||||
|
||||
- name: Set status - Review
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
|
||||
if: github.event_name == 'issues' && (contains(github.event.*.labels.*.name, 'Unit Tested') || contains(github.event.*.labels.*.name, 'Regression Tested') || contains(github.event.*.labels.*.name, 'Needs Review')) || github.event_name == 'pull_request'
|
||||
run: |
|
||||
gh api graphql -f query='
|
||||
mutation(
|
||||
$project: ID!
|
||||
$item: ID!
|
||||
$status_field: ID!
|
||||
$status_value: String!
|
||||
){
|
||||
set_status: updateProjectV2ItemFieldValue(input: {
|
||||
projectId: $project
|
||||
itemId: $item
|
||||
fieldId: $status_field
|
||||
value: {
|
||||
singleSelectOptionId: $status_value
|
||||
}
|
||||
}) {
|
||||
projectV2Item {
|
||||
id
|
||||
}
|
||||
}
|
||||
}' -f project=$PROJECT_ID -f item=$PROJECT_ITEM_ID -f status_field=$STATUS_FIELD_ID -f status_value=${{ env.NEEDS_REVIEW_OPTION_ID }} --silent
|
3
.github/workflows/sha.yml
vendored
3
.github/workflows/sha.yml
vendored
@@ -24,10 +24,11 @@ jobs:
|
||||
sha=$(git rev-parse --short "$GITHUB_SHA")
|
||||
echo "#define GITHUB_SHA \"$sha\"" > GITHUB_SHA.h
|
||||
|
||||
- uses: EndBug/add-and-commit@v4 # You can change this to use a specific version
|
||||
- uses: EndBug/add-and-commit@v8 # You can change this to use a specific version
|
||||
with:
|
||||
add: 'GITHUB_SHA.h'
|
||||
message: 'Committing a SHA'
|
||||
commit: --amend
|
||||
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Leave this line unchanged
|
||||
|
2
.gitignore
vendored
2
.gitignore
vendored
@@ -7,7 +7,7 @@ Release/*
|
||||
.pio/
|
||||
.vscode/
|
||||
config.h
|
||||
.vscode/extensions.json
|
||||
.vscode/*
|
||||
mySetup.h
|
||||
mySetup.cpp
|
||||
myHal.cpp
|
||||
|
3
.vscode/extensions.json
vendored
3
.vscode/extensions.json
vendored
@@ -3,5 +3,8 @@
|
||||
// for the documentation about the extensions.json format
|
||||
"recommendations": [
|
||||
"platformio.platformio-ide"
|
||||
],
|
||||
"unwantedRecommendations": [
|
||||
"ms-vscode.cpptools-extension-pack"
|
||||
]
|
||||
}
|
||||
|
@@ -135,3 +135,8 @@ void CommandDistributor::broadcastPower() {
|
||||
LCD(2,F("Power %S%S"),state=='1'?F("On"):F("Off"),reason);
|
||||
broadcast(true);
|
||||
}
|
||||
|
||||
void CommandDistributor::broadcastText(const FSH * msg) {
|
||||
StringFormatter::send(broadcastBufferWriter,F("%S"),msg);
|
||||
broadcast(false);
|
||||
}
|
||||
|
@@ -32,6 +32,7 @@ public :
|
||||
static void broadcastSensor(int16_t id, bool value);
|
||||
static void broadcastTurnout(int16_t id, bool isClosed);
|
||||
static void broadcastPower();
|
||||
static void broadcastText(const FSH * msg);
|
||||
static void forget(byte clientId);
|
||||
private:
|
||||
static void broadcast(bool includeWithrottleClients);
|
||||
|
@@ -91,7 +91,7 @@ void setup()
|
||||
// STANDARD_MOTOR_SHIELD, POLOLU_MOTOR_SHIELD, FIREBOX_MK1, FIREBOX_MK1S are pre defined in MotorShields.h
|
||||
DCC::begin(MOTOR_SHIELD_TYPE);
|
||||
|
||||
// Start RMFT (ignored if no automnation)
|
||||
// Start RMFT aka EX-RAIL (ignored if no automnation)
|
||||
RMFT::begin();
|
||||
|
||||
|
||||
|
9
DCC.cpp
9
DCC.cpp
@@ -33,7 +33,7 @@
|
||||
#include "version.h"
|
||||
#include "FSH.h"
|
||||
#include "IODevice.h"
|
||||
#include "RMFT2.h"
|
||||
#include "EXRAIL2.h"
|
||||
#include "CommandDistributor.h"
|
||||
|
||||
// This module is responsible for converting API calls into
|
||||
@@ -252,7 +252,7 @@ void DCC::setAccessory(int address, byte number, bool activate) {
|
||||
b[1] = ((((address / 64) % 8) << 4) + (number % 4 << 1) + activate % 2) ^ 0xF8; // second byte is of the form 1AAACDDD, where C should be 1, and the least significant D represent activate/deactivate
|
||||
|
||||
DCCWaveform::mainTrack.schedulePacket(b, 2, 4); // Repeat the packet four times
|
||||
#if defined(RMFT_ACTIVE)
|
||||
#if defined(EXRAIL_ACTIVE)
|
||||
RMFT2::activateEvent(address<<2|number,activate);
|
||||
#endif
|
||||
}
|
||||
@@ -647,7 +647,7 @@ byte DCC::cv2(int cv) {
|
||||
return lowByte(cv);
|
||||
}
|
||||
|
||||
int DCC::lookupSpeedTable(int locoId) {
|
||||
int DCC::lookupSpeedTable(int locoId, bool autoCreate) {
|
||||
// determine speed reg for this loco
|
||||
int firstEmpty = MAX_LOCOS;
|
||||
int reg;
|
||||
@@ -655,6 +655,9 @@ int DCC::lookupSpeedTable(int locoId) {
|
||||
if (speedTable[reg].loco == locoId) break;
|
||||
if (speedTable[reg].loco == 0 && firstEmpty == MAX_LOCOS) firstEmpty = reg;
|
||||
}
|
||||
|
||||
// return -1 if not found and not auto creating
|
||||
if (reg== MAX_LOCOS && !autoCreate) return -1;
|
||||
if (reg == MAX_LOCOS) reg = firstEmpty;
|
||||
if (reg >= MAX_LOCOS) {
|
||||
DIAG(F("Too many locos"));
|
||||
|
5
DCC.h
5
DCC.h
@@ -128,7 +128,6 @@ public:
|
||||
static void forgetLoco(int cab); // removes any speed reminders for this loco
|
||||
static void forgetAllLocos(); // removes all speed reminders
|
||||
static void displayCabList(Print *stream);
|
||||
|
||||
static FSH *getMotorShieldName();
|
||||
static inline void setGlobalSpeedsteps(byte s) {
|
||||
globalSpeedsteps = s;
|
||||
@@ -148,7 +147,8 @@ public:
|
||||
unsigned long functions;
|
||||
};
|
||||
static LOCO speedTable[MAX_LOCOS];
|
||||
|
||||
static int lookupSpeedTable(int locoId, bool autoCreate=true);
|
||||
|
||||
private:
|
||||
static byte joinRelay;
|
||||
static byte loopStatus;
|
||||
@@ -162,7 +162,6 @@ private:
|
||||
|
||||
static byte cv1(byte opcode, int cv);
|
||||
static byte cv2(int cv);
|
||||
static int lookupSpeedTable(int locoId);
|
||||
static void issueReminders();
|
||||
static void callback(int value);
|
||||
|
||||
|
2
DCCEX.h
2
DCCEX.h
@@ -43,7 +43,7 @@
|
||||
#include "Turnouts.h"
|
||||
#include "Sensors.h"
|
||||
#include "Outputs.h"
|
||||
#include "RMFT.h"
|
||||
#include "CommandDistributor.h"
|
||||
#include "EXRAIL.h"
|
||||
|
||||
#endif
|
||||
|
148
DCCEXParser.cpp
148
DCCEXParser.cpp
@@ -37,6 +37,7 @@
|
||||
#include "CommandDistributor.h"
|
||||
#include "EEStore.h"
|
||||
#include "DIAG.h"
|
||||
#include "EXRAIL2.h"
|
||||
#include <avr/wdt.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -74,8 +75,10 @@ const int16_t HASH_KEYWORD_SPEED28 = -17064;
|
||||
const int16_t HASH_KEYWORD_SPEED128 = 25816;
|
||||
const int16_t HASH_KEYWORD_SERVO=27709;
|
||||
const int16_t HASH_KEYWORD_VPIN=-415;
|
||||
const int16_t HASH_KEYWORD_C=67;
|
||||
const int16_t HASH_KEYWORD_T=84;
|
||||
const int16_t HASH_KEYWORD_A='A';
|
||||
const int16_t HASH_KEYWORD_C='C';
|
||||
const int16_t HASH_KEYWORD_R='R';
|
||||
const int16_t HASH_KEYWORD_T='T';
|
||||
const int16_t HASH_KEYWORD_LCN = 15137;
|
||||
const int16_t HASH_KEYWORD_HAL = 10853;
|
||||
const int16_t HASH_KEYWORD_SHOW = -21309;
|
||||
@@ -91,7 +94,7 @@ Print *DCCEXParser::stashStream = NULL;
|
||||
RingStream *DCCEXParser::stashRingStream = NULL;
|
||||
byte DCCEXParser::stashTarget=0;
|
||||
|
||||
// This is a JMRI command parser, one instance per incoming stream
|
||||
// This is a JMRI command parser.
|
||||
// It doesnt know how the string got here, nor how it gets back.
|
||||
// It knows nothing about hardware or tracks... it just parses strings and
|
||||
// calls the corresponding DCC api.
|
||||
@@ -145,7 +148,7 @@ int16_t DCCEXParser::splitValues(int16_t result[MAX_COMMAND_PARAMS], const byte
|
||||
runningValue = 16 * runningValue + (hot - 'A' + 10);
|
||||
break;
|
||||
}
|
||||
if (hot >= 'A' && hot <= 'Z')
|
||||
if (hot=='_' || (hot >= 'A' && hot <= 'Z'))
|
||||
{
|
||||
// Since JMRI got modified to send keywords in some rare cases, we need this
|
||||
// Super Kluge to turn keywords into a hash value that can be recognised later
|
||||
@@ -162,9 +165,12 @@ int16_t DCCEXParser::splitValues(int16_t result[MAX_COMMAND_PARAMS], const byte
|
||||
return parameterCount;
|
||||
}
|
||||
|
||||
FILTER_CALLBACK DCCEXParser::filterCallback = 0;
|
||||
extern __attribute__((weak)) void myFilter(Print * stream, byte & opcode, byte & paramCount, int16_t p[]);
|
||||
FILTER_CALLBACK DCCEXParser::filterCallback = myFilter;
|
||||
FILTER_CALLBACK DCCEXParser::filterRMFTCallback = 0;
|
||||
AT_COMMAND_CALLBACK DCCEXParser::atCommandCallback = 0;
|
||||
|
||||
// deprecated
|
||||
void DCCEXParser::setFilter(FILTER_CALLBACK filter)
|
||||
{
|
||||
filterCallback = filter;
|
||||
@@ -189,7 +195,21 @@ void DCCEXParser::parse(const FSH * cmd) {
|
||||
|
||||
// See documentation on DCC class for info on this section
|
||||
|
||||
void DCCEXParser::parse(Print *stream, byte *com, RingStream * ringStream)
|
||||
void DCCEXParser::parse(Print *stream, byte *com, RingStream *ringStream) {
|
||||
// This function can get stings of the form "<C OMM AND>" or "C OMM AND"
|
||||
// found is true first after the leading "<" has been passed
|
||||
bool found = (com[0] != '<');
|
||||
for (byte *c=com; c[0] != '\0'; c++) {
|
||||
if (found) {
|
||||
parseOne(stream, c, ringStream);
|
||||
found=false;
|
||||
}
|
||||
if (c[0] == '<')
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
|
||||
void DCCEXParser::parseOne(Print *stream, byte *com, RingStream * ringStream)
|
||||
{
|
||||
#ifndef DISABLE_EEPROM
|
||||
(void)EEPROM; // tell compiler not to warn this is unused
|
||||
@@ -214,10 +234,23 @@ void DCCEXParser::parse(Print *stream, byte *com, RingStream * ringStream)
|
||||
return; // filterCallback asked us to ignore
|
||||
case 't': // THROTTLE <t [REGISTER] CAB SPEED DIRECTION>
|
||||
{
|
||||
if (params==1) { // <t cab> display state
|
||||
|
||||
int16_t slot=DCC::lookupSpeedTable(p[0],false);
|
||||
if (slot>=0) {
|
||||
DCC::LOCO * sp=&DCC::speedTable[slot];
|
||||
StringFormatter::send(stream,F("<l %d %d %d %l>\n"),
|
||||
sp->loco,slot,sp->speedCode,sp->functions);
|
||||
}
|
||||
else // send dummy state speed 0 fwd no functions.
|
||||
StringFormatter::send(stream,F("<l %d -1 128 0>\n"),p[0]);
|
||||
return;
|
||||
}
|
||||
|
||||
int16_t cab;
|
||||
int16_t tspeed;
|
||||
int16_t direction;
|
||||
|
||||
|
||||
if (params == 4)
|
||||
{ // <t REGISTER CAB SPEED DIRECTION>
|
||||
cab = p[1];
|
||||
@@ -333,7 +366,9 @@ void DCCEXParser::parse(Print *stream, byte *com, RingStream * ringStream)
|
||||
break;
|
||||
if (params == 1) // <W id> Write new loco id (clearing consist and managing short/long)
|
||||
DCC::setLocoId(p[0],callback_Wloco);
|
||||
else // WRITE CV ON PROG <W CV VALUE [CALLBACKNUM] [CALLBACKSUB]>
|
||||
else if (params == 4) // WRITE CV ON PROG <W CV VALUE [CALLBACKNUM] [CALLBACKSUB]>
|
||||
DCC::writeCVByte(p[0], p[1], callback_W4);
|
||||
else // WRITE CV ON PROG <W CV VALUE>
|
||||
DCC::writeCVByte(p[0], p[1], callback_W);
|
||||
return;
|
||||
|
||||
@@ -361,6 +396,13 @@ void DCCEXParser::parse(Print *stream, byte *com, RingStream * ringStream)
|
||||
return;
|
||||
|
||||
case 'R': // READ CV ON PROG
|
||||
if (params == 1)
|
||||
{ // <R CV> -- uses verify callback
|
||||
if (!stashCallback(stream, p, ringStream))
|
||||
break;
|
||||
DCC::verifyCVByte(p[0], p[1], callback_Vbyte);
|
||||
return;
|
||||
}
|
||||
if (params == 3)
|
||||
{ // <R CV CALLBACKNUM CALLBACKSUB>
|
||||
if (!stashCallback(stream, p, ringStream))
|
||||
@@ -500,6 +542,7 @@ void DCCEXParser::parse(Print *stream, byte *com, RingStream * ringStream)
|
||||
DCC::setFn(p[0], p[1], p[2] == 1);
|
||||
return;
|
||||
|
||||
#if WIFI_ON
|
||||
case '+': // Complex Wifi interface command (not usual parse)
|
||||
if (atCommandCallback && !ringStream) {
|
||||
DCCWaveform::mainTrack.setPowerMode(POWERMODE::OFF);
|
||||
@@ -508,6 +551,72 @@ void DCCEXParser::parse(Print *stream, byte *com, RingStream * ringStream)
|
||||
return;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
case 'J' : // throttle info access
|
||||
{
|
||||
if ((params<1) | (params>2)) break; // <J>
|
||||
int16_t id=(params==2)?p[1]:0;
|
||||
switch(p[0]) {
|
||||
case HASH_KEYWORD_A: // <JA> returns automations/routes
|
||||
StringFormatter::send(stream, F("<jA"));
|
||||
if (params==1) {// <JA>
|
||||
#ifdef EXRAIL_ACTIVE
|
||||
sendFlashList(stream,RMFT2::routeIdList);
|
||||
sendFlashList(stream,RMFT2::automationIdList);
|
||||
#endif
|
||||
}
|
||||
else { // <JA id>
|
||||
StringFormatter::send(stream,F(" %d %c \"%S\""),
|
||||
id,
|
||||
#ifdef EXRAIL_ACTIVE
|
||||
RMFT2::getRouteType(id), // A/R
|
||||
RMFT2::getRouteDescription(id)
|
||||
#else
|
||||
'X',F("")
|
||||
#endif
|
||||
);
|
||||
}
|
||||
StringFormatter::send(stream, F(">\n"));
|
||||
return;
|
||||
case HASH_KEYWORD_R: // <JR> returns rosters
|
||||
StringFormatter::send(stream, F("<jR"));
|
||||
#ifdef EXRAIL_ACTIVE
|
||||
if (params==1) sendFlashList(stream,RMFT2::rosterIdList);
|
||||
else StringFormatter::send(stream,F(" %d \"%S\" \"%S\""),
|
||||
id, RMFT2::getRosterName(id), RMFT2::getRosterFunctions(id));
|
||||
#endif
|
||||
StringFormatter::send(stream, F(">\n"));
|
||||
return;
|
||||
case HASH_KEYWORD_T: // <JT> returns turnout list
|
||||
StringFormatter::send(stream, F("<jT"));
|
||||
if (params==1) { // <JT>
|
||||
for ( Turnout * t=Turnout::first(); t; t=t->next()) {
|
||||
if (t->isHidden()) continue;
|
||||
StringFormatter::send(stream, F(" %d"),t->getId());
|
||||
}
|
||||
}
|
||||
else { // <JT id>
|
||||
Turnout * t=Turnout::get(id);
|
||||
if (!t || t->isHidden()) StringFormatter::send(stream, F(" %d X"),id);
|
||||
else {
|
||||
const FSH *tdesc = NULL;
|
||||
#ifdef EXRAIL_ACTIVE
|
||||
tdesc = RMFT2::getTurnoutDescription(id);
|
||||
#endif
|
||||
if (tdesc == NULL)
|
||||
tdesc = F("");
|
||||
StringFormatter::send(stream, F(" %d %c \"%S\""),
|
||||
id,t->isThrown()?'T':'C',
|
||||
tdesc);
|
||||
}
|
||||
}
|
||||
StringFormatter::send(stream, F(">\n"));
|
||||
return;
|
||||
default: break;
|
||||
} // switch(p[1])
|
||||
break; // case J
|
||||
}
|
||||
|
||||
default: //anything else will diagnose and drop out to <X>
|
||||
DIAG(F("Opcode=%c params=%d"), opcode, params);
|
||||
@@ -521,6 +630,14 @@ void DCCEXParser::parse(Print *stream, byte *com, RingStream * ringStream)
|
||||
StringFormatter::send(stream, F("<X>\n"));
|
||||
}
|
||||
|
||||
void DCCEXParser::sendFlashList(Print * stream,const int16_t flashList[]) {
|
||||
for (int16_t i=0;;i++) {
|
||||
int16_t value=GETFLASHW(flashList+i);
|
||||
if (value==0) return;
|
||||
StringFormatter::send(stream,F(" %d"),value);
|
||||
}
|
||||
}
|
||||
|
||||
bool DCCEXParser::parseZ(Print *stream, int16_t params, int16_t p[])
|
||||
{
|
||||
|
||||
@@ -741,10 +858,10 @@ bool DCCEXParser::parseD(Print *stream, int16_t params, int16_t p[])
|
||||
LCD(1, F("Ack Limit=%dmA"), p[2]); // <D ACK LIMIT 42>
|
||||
} else if (p[1] == HASH_KEYWORD_MIN) {
|
||||
DCCWaveform::progTrack.setMinAckPulseDuration(p[2]);
|
||||
LCD(0, F("Ack Min=%dus"), p[2]); // <D ACK MIN 1500>
|
||||
LCD(0, F("Ack Min=%uus"), p[2]); // <D ACK MIN 1500>
|
||||
} else if (p[1] == HASH_KEYWORD_MAX) {
|
||||
DCCWaveform::progTrack.setMaxAckPulseDuration(p[2]);
|
||||
LCD(0, F("Ack Max=%dus"), p[2]); // <D ACK MAX 9000>
|
||||
LCD(0, F("Ack Max=%uus"), p[2]); // <D ACK MAX 9000>
|
||||
} else if (p[1] == HASH_KEYWORD_RETRY) {
|
||||
if (p[2] >255) p[2]=3;
|
||||
LCD(0, F("Ack Retry=%d Sum=%d"), p[2], DCC::setAckRetry(p[2])); // <D ACK RETRY 2>
|
||||
@@ -856,7 +973,14 @@ void DCCEXParser::commitAsyncReplyStream() {
|
||||
void DCCEXParser::callback_W(int16_t result)
|
||||
{
|
||||
StringFormatter::send(getAsyncReplyStream(),
|
||||
F("<r%d|%d|%d %d>\n"), stashP[2], stashP[3], stashP[0], result == 1 ? stashP[1] : -1);
|
||||
F("<r %d %d>\n"), stashP[0], result == 1 ? stashP[1] : -1);
|
||||
commitAsyncReplyStream();
|
||||
}
|
||||
|
||||
void DCCEXParser::callback_W4(int16_t result)
|
||||
{
|
||||
StringFormatter::send(getAsyncReplyStream(),
|
||||
F("<r%d|%d|%d %d>\n"), stashP[2], stashP[3], stashP[0], result == 1 ? stashP[1] : -1);
|
||||
commitAsyncReplyStream();
|
||||
}
|
||||
|
||||
@@ -886,7 +1010,7 @@ void DCCEXParser::callback_R(int16_t result)
|
||||
void DCCEXParser::callback_Rloco(int16_t result) {
|
||||
const FSH * detail;
|
||||
if (result<=0) {
|
||||
detail=F("<r ERROR %d>\n");
|
||||
detail=F("<r %d>\n");
|
||||
} else {
|
||||
bool longAddr=result & LONG_ADDR_MARKER; //long addr
|
||||
if (longAddr)
|
||||
|
@@ -33,6 +33,7 @@ struct DCCEXParser
|
||||
|
||||
static void parse(Print * stream, byte * command, RingStream * ringStream);
|
||||
static void parse(const FSH * cmd);
|
||||
static void parseOne(Print * stream, byte * command, RingStream * ringStream);
|
||||
static void setFilter(FILTER_CALLBACK filter);
|
||||
static void setRMFTFilter(FILTER_CALLBACK filter);
|
||||
static void setAtCommandCallback(AT_COMMAND_CALLBACK filter);
|
||||
@@ -60,6 +61,7 @@ struct DCCEXParser
|
||||
static int16_t stashP[MAX_COMMAND_PARAMS];
|
||||
static bool stashCallback(Print * stream, int16_t p[MAX_COMMAND_PARAMS], RingStream * ringStream);
|
||||
static void callback_W(int16_t result);
|
||||
static void callback_W4(int16_t result);
|
||||
static void callback_B(int16_t result);
|
||||
static void callback_R(int16_t result);
|
||||
static void callback_Rloco(int16_t result);
|
||||
@@ -70,6 +72,7 @@ struct DCCEXParser
|
||||
static FILTER_CALLBACK filterRMFTCallback;
|
||||
static AT_COMMAND_CALLBACK atCommandCallback;
|
||||
static void funcmap(int16_t cab, byte value, byte fstart, byte fstop);
|
||||
static void sendFlashList(Print * stream,const int16_t flashList[]);
|
||||
|
||||
};
|
||||
|
||||
|
@@ -289,7 +289,7 @@ void DCCWaveform::setAckBaseline() {
|
||||
if (isMainTrack) return;
|
||||
int baseline=motorDriver->getCurrentRaw();
|
||||
ackThreshold= baseline + motorDriver->mA2raw(ackLimitmA);
|
||||
if (Diag::ACK) DIAG(F("ACK baseline=%d/%dmA Threshold=%d/%dmA Duration between %dus and %dus"),
|
||||
if (Diag::ACK) DIAG(F("ACK baseline=%d/%dmA Threshold=%d/%dmA Duration between %uus and %uus"),
|
||||
baseline,motorDriver->raw2mA(baseline),
|
||||
ackThreshold,motorDriver->raw2mA(ackThreshold),
|
||||
minAckPulseDuration, maxAckPulseDuration);
|
||||
@@ -309,7 +309,7 @@ void DCCWaveform::setAckPending() {
|
||||
|
||||
byte DCCWaveform::getAck() {
|
||||
if (ackPending) return (2); // still waiting
|
||||
if (Diag::ACK) DIAG(F("%S after %dmS max=%d/%dmA pulse=%duS samples=%d gaps=%d"),ackDetected?F("ACK"):F("NO-ACK"), ackCheckDuration,
|
||||
if (Diag::ACK) DIAG(F("%S after %dmS max=%d/%dmA pulse=%uuS samples=%d gaps=%d"),ackDetected?F("ACK"):F("NO-ACK"), ackCheckDuration,
|
||||
ackMaxCurrent,motorDriver->raw2mA(ackMaxCurrent), ackPulseDuration, numAckSamples, numAckGaps);
|
||||
if (ackDetected) return (1); // Yes we had an ack
|
||||
return(0); // pending set off but not detected means no ACK.
|
||||
|
@@ -157,7 +157,7 @@ class DCCWaveform {
|
||||
volatile bool ackPending;
|
||||
volatile bool ackDetected;
|
||||
int ackThreshold;
|
||||
int ackLimitmA = 60;
|
||||
int ackLimitmA = 50;
|
||||
int ackMaxCurrent;
|
||||
unsigned long ackCheckStart; // millis
|
||||
unsigned int ackCheckDuration; // millis
|
||||
@@ -165,8 +165,8 @@ class DCCWaveform {
|
||||
unsigned int ackPulseDuration; // micros
|
||||
unsigned long ackPulseStart; // micros
|
||||
|
||||
unsigned int minAckPulseDuration = 4000; // micros
|
||||
unsigned int maxAckPulseDuration = 8500; // micros
|
||||
unsigned int minAckPulseDuration = 2000; // micros
|
||||
unsigned int maxAckPulseDuration = 20000; // micros
|
||||
|
||||
volatile static uint8_t numAckGaps;
|
||||
volatile static uint8_t numAckSamples;
|
||||
|
@@ -1,8 +1,8 @@
|
||||
#ifndef RMFT_H
|
||||
#define RMFT_H
|
||||
#ifndef EXRAIL_H
|
||||
#define EXRAIL_H
|
||||
|
||||
#if defined(RMFT_ACTIVE)
|
||||
#include "RMFT2.h"
|
||||
#if defined(EXRAIL_ACTIVE)
|
||||
#include "EXRAIL2.h"
|
||||
|
||||
class RMFT {
|
||||
public:
|
||||
@@ -10,7 +10,7 @@
|
||||
static void inline loop() {RMFT2::loop();}
|
||||
};
|
||||
|
||||
#include "RMFTMacros.h"
|
||||
#include "EXRAILMacros.h"
|
||||
|
||||
#else
|
||||
// Dummy RMFT
|
@@ -40,9 +40,8 @@
|
||||
T2. Extend to >64k
|
||||
*/
|
||||
|
||||
|
||||
#include <Arduino.h>
|
||||
#include "RMFT2.h"
|
||||
#include "EXRAIL2.h"
|
||||
#include "DCC.h"
|
||||
#include "DCCWaveform.h"
|
||||
#include "DIAG.h"
|
||||
@@ -63,15 +62,19 @@ const int16_t HASH_KEYWORD_UNLATCH=1353;
|
||||
const int16_t HASH_KEYWORD_PAUSE=-4142;
|
||||
const int16_t HASH_KEYWORD_RESUME=27609;
|
||||
const int16_t HASH_KEYWORD_KILL=5218;
|
||||
const int16_t HASH_KEYWORD_ALL=3457;
|
||||
const int16_t HASH_KEYWORD_ROUTES=-3702;
|
||||
const int16_t HASH_KEYWORD_RED=26099;
|
||||
const int16_t HASH_KEYWORD_AMBER=18713;
|
||||
const int16_t HASH_KEYWORD_GREEN=-31493;
|
||||
|
||||
// One instance of RMFT clas is used for each "thread" in the automation.
|
||||
// Each thread manages a loco on a journey through the layout, and/or may manage a scenery automation.
|
||||
// The thrrads exist in a ring, each time through loop() the next thread in the ring is serviced.
|
||||
// The threads exist in a ring, each time through loop() the next thread in the ring is serviced.
|
||||
|
||||
// Statics
|
||||
const int16_t LOCO_ID_WAITING=-99; // waiting for loco id from prog track
|
||||
int16_t RMFT2::progtrackLocoId; // used for callback when detecting a loco on prograck
|
||||
int16_t RMFT2::progtrackLocoId; // used for callback when detecting a loco on prog track
|
||||
bool RMFT2::diag=false; // <D EXRAIL ON>
|
||||
RMFT2 * RMFT2::loopTask=NULL; // loopTask contains the address of ONE of the tasks in a ring.
|
||||
RMFT2 * RMFT2::pausingTask=NULL; // Task causing a PAUSE.
|
||||
@@ -166,14 +169,10 @@ int16_t LookList::find(int16_t value) {
|
||||
|
||||
// Second pass startup, define any turnouts or servos, set signals red
|
||||
// add sequences onRoutines to the lookups
|
||||
for (int sigpos=0;;sigpos+=3) {
|
||||
VPIN redpin=GETFLASHW(RMFT2::SignalDefinitions+sigpos);
|
||||
if (redpin==0) break; // end of signal list
|
||||
VPIN amberpin=GETFLASHW(RMFT2::SignalDefinitions+sigpos+1);
|
||||
VPIN greenpin=GETFLASHW(RMFT2::SignalDefinitions+sigpos+2);
|
||||
IODevice::write(redpin,true);
|
||||
if (amberpin) IODevice::write(amberpin,false);
|
||||
IODevice::write(greenpin,false);
|
||||
for (int sigpos=0;;sigpos+=4) {
|
||||
VPIN sigid=GETFLASHW(RMFT2::SignalDefinitions+sigpos);
|
||||
if (sigid==0) break; // end of signal list
|
||||
doSignal(sigid & SIGNAL_ID_MASK, SIGNAL_RED);
|
||||
}
|
||||
|
||||
for (progCounter=0;; SKIPOP){
|
||||
@@ -196,7 +195,7 @@ int16_t LookList::find(int16_t value) {
|
||||
VPIN id=operand;
|
||||
int addr=GET_OPERAND(1);
|
||||
byte subAddr=GET_OPERAND(2);
|
||||
DCCTurnout::create(id,addr,subAddr);
|
||||
setTurnoutHiddenState(DCCTurnout::create(id,addr,subAddr));
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -206,14 +205,14 @@ int16_t LookList::find(int16_t value) {
|
||||
int activeAngle=GET_OPERAND(2);
|
||||
int inactiveAngle=GET_OPERAND(3);
|
||||
int profile=GET_OPERAND(4);
|
||||
ServoTurnout::create(id,pin,activeAngle,inactiveAngle,profile);
|
||||
setTurnoutHiddenState(ServoTurnout::create(id,pin,activeAngle,inactiveAngle,profile));
|
||||
break;
|
||||
}
|
||||
|
||||
case OPCODE_PINTURNOUT: {
|
||||
VPIN id=operand;
|
||||
VPIN pin=GET_OPERAND(1);
|
||||
VpinTurnout::create(id,pin);
|
||||
setTurnoutHiddenState(VpinTurnout::create(id,pin));
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -257,6 +256,23 @@ int16_t LookList::find(int16_t value) {
|
||||
new RMFT2(0); // add the startup route
|
||||
}
|
||||
|
||||
void RMFT2::setTurnoutHiddenState(Turnout * t) {
|
||||
t->setHidden(GETFLASH(getTurnoutDescription(t->getId()))==0x01);
|
||||
}
|
||||
|
||||
char RMFT2::getRouteType(int16_t id) {
|
||||
for (int16_t i=0;;i++) {
|
||||
int16_t rid= GETFLASHW(routeIdList+i);
|
||||
if (rid==id) return 'R';
|
||||
if (rid==0) break;
|
||||
}
|
||||
for (int16_t i=0;;i++) {
|
||||
int16_t rid= GETFLASHW(automationIdList+i);
|
||||
if (rid==id) return 'A';
|
||||
if (rid==0) break;
|
||||
}
|
||||
return 'X';
|
||||
}
|
||||
// This filter intercepts <> commands to do the following:
|
||||
// - Implement RMFT specific commands/diagnostics
|
||||
// - Reject/modify JMRI commands that would interfere with RMFT processing
|
||||
@@ -304,12 +320,23 @@ bool RMFT2::parseSlash(Print * stream, byte & paramCount, int16_t p[]) {
|
||||
// Now stream the flags
|
||||
for (int id=0;id<MAX_FLAGS; id++) {
|
||||
byte flag=flags[id];
|
||||
if (flag & ~TASK_FLAG) { // not interested in TASK_FLAG only. Already shown above
|
||||
StringFormatter::send(stream,F("\nflags[%d} "),id);
|
||||
if (flag & SECTION_FLAG) StringFormatter::send(stream,F(" RESERVED"));
|
||||
if (flag & LATCH_FLAG) StringFormatter::send(stream,F(" LATCHED"));
|
||||
if (flag & ~TASK_FLAG & ~SIGNAL_MASK) { // not interested in TASK_FLAG only. Already shown above
|
||||
StringFormatter::send(stream,F("\nflags[%d] "),id);
|
||||
if (flag & SECTION_FLAG) StringFormatter::send(stream,F(" RESERVED"));
|
||||
if (flag & LATCH_FLAG) StringFormatter::send(stream,F(" LATCHED"));
|
||||
}
|
||||
}
|
||||
// do the signals
|
||||
// flags[n] represents the state of the nth signal in the table
|
||||
for (int sigslot=0;;sigslot++) {
|
||||
VPIN sigid=GETFLASHW(RMFT2::SignalDefinitions+sigslot*4);
|
||||
if (sigid==0) break; // end of signal list
|
||||
byte flag=flags[sigslot] & SIGNAL_MASK; // obtain signal flags for this id
|
||||
StringFormatter::send(stream,F("\n%S[%d]"),
|
||||
(flag == SIGNAL_RED)? F("RED") : (flag==SIGNAL_GREEN) ? F("GREEN") : F("AMBER"),
|
||||
sigid & SIGNAL_ID_MASK);
|
||||
}
|
||||
|
||||
StringFormatter::send(stream,F(" *>\n"));
|
||||
return true;
|
||||
}
|
||||
@@ -346,32 +373,30 @@ bool RMFT2::parseSlash(Print * stream, byte & paramCount, int16_t p[]) {
|
||||
}
|
||||
return true;
|
||||
|
||||
case HASH_KEYWORD_ROUTES: // </ ROUTES > JMRI withrottle support
|
||||
if (paramCount>1) return false;
|
||||
StringFormatter::send(stream,F("</ROUTES "));
|
||||
emitWithrottleRouteList(stream);
|
||||
StringFormatter::send(stream,F(">"));
|
||||
return true;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
// check KILL ALL here, otherwise the next validation confuses ALL with a flag
|
||||
if (p[0]==HASH_KEYWORD_KILL && p[1]==HASH_KEYWORD_ALL) {
|
||||
while (loopTask) loopTask->kill(F("KILL ALL")); // destructor changes loopTask
|
||||
return true;
|
||||
}
|
||||
|
||||
// all other / commands take 1 parameter 0 to MAX_FLAGS-1
|
||||
|
||||
if (paramCount!=2 || p[1]<0 || p[1]>=MAX_FLAGS) return false;
|
||||
|
||||
switch (p[0]) {
|
||||
case HASH_KEYWORD_KILL: // Kill taskid
|
||||
case HASH_KEYWORD_KILL: // Kill taskid|ALL
|
||||
{
|
||||
RMFT2 * task=loopTask;
|
||||
while(task) {
|
||||
if (task->taskId==p[1]) {
|
||||
delete task;
|
||||
return true;
|
||||
}
|
||||
task=task->next;
|
||||
if (task==loopTask) break;
|
||||
if (task->taskId==p[1]) {
|
||||
task->kill(F("KILL"));
|
||||
return true;
|
||||
}
|
||||
task=task->next;
|
||||
if (task==loopTask) break;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
@@ -391,6 +416,18 @@ bool RMFT2::parseSlash(Print * stream, byte & paramCount, int16_t p[]) {
|
||||
case HASH_KEYWORD_UNLATCH:
|
||||
setFlag(p[1], 0, LATCH_FLAG);
|
||||
return true;
|
||||
|
||||
case HASH_KEYWORD_RED:
|
||||
doSignal(p[1],SIGNAL_RED);
|
||||
return true;
|
||||
|
||||
case HASH_KEYWORD_AMBER:
|
||||
doSignal(p[1],SIGNAL_AMBER);
|
||||
return true;
|
||||
|
||||
case HASH_KEYWORD_GREEN:
|
||||
doSignal(p[1],SIGNAL_GREEN);
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
@@ -402,11 +439,7 @@ bool RMFT2::parseSlash(Print * stream, byte & paramCount, int16_t p[]) {
|
||||
// Automations are given a state to set the button to "handoff" which implies
|
||||
// handing over the loco to the automation.
|
||||
// Routes are given "Set" buttons and do not cause the loco to be handed over.
|
||||
void RMFT2::emitWithrottleRouteList(Print* stream) {
|
||||
StringFormatter::send(stream,F("PRT]\\[Routes}|{Route]\\[Set}|{2]\\[Handoff}|{4\nPRL"));
|
||||
emitWithrottleDescriptions(stream);
|
||||
StringFormatter::send(stream,F("\n"));
|
||||
}
|
||||
|
||||
|
||||
|
||||
RMFT2::RMFT2(int progCtr) {
|
||||
@@ -428,7 +461,7 @@ RMFT2::RMFT2(int progCtr) {
|
||||
invert=false;
|
||||
timeoutFlag=false;
|
||||
stackDepth=0;
|
||||
onTurnoutId=0; // Not handling an ONTHROW/ONCLOSE
|
||||
onTurnoutId=-1; // Not handling an ONTHROW/ONCLOSE
|
||||
|
||||
// chain into ring of RMFTs
|
||||
if (loopTask==NULL) {
|
||||
@@ -493,28 +526,21 @@ bool RMFT2::skipIfBlock() {
|
||||
while (nest > 0) {
|
||||
SKIPOP;
|
||||
byte opcode = GET_OPCODE;
|
||||
switch(opcode) {
|
||||
case OPCODE_ENDEXRAIL:
|
||||
kill(F("missing ENDIF"), nest);
|
||||
return false;
|
||||
case OPCODE_IF:
|
||||
case OPCODE_IFCLOSED:
|
||||
case OPCODE_IFGTE:
|
||||
case OPCODE_IFLT:
|
||||
case OPCODE_IFNOT:
|
||||
case OPCODE_IFRANDOM:
|
||||
case OPCODE_IFRESERVE:
|
||||
case OPCODE_IFTHROWN:
|
||||
case OPCODE_IFTIMEOUT:
|
||||
nest++;
|
||||
break;
|
||||
case OPCODE_ENDIF:
|
||||
nest--;
|
||||
break;
|
||||
case OPCODE_ELSE:
|
||||
// if nest==1 then this is the ELSE for the IF we are skipping
|
||||
if (nest==1) nest=0; // cause loop exit and return after ELSE
|
||||
break;
|
||||
// all other IF type commands increase the nesting level
|
||||
if (opcode>IF_TYPE_OPCODES) nest++;
|
||||
else switch(opcode) {
|
||||
case OPCODE_ENDEXRAIL:
|
||||
kill(F("missing ENDIF"), nest);
|
||||
return false;
|
||||
|
||||
case OPCODE_ENDIF:
|
||||
nest--;
|
||||
break;
|
||||
|
||||
case OPCODE_ELSE:
|
||||
// if nest==1 then this is the ELSE for the IF we are skipping
|
||||
if (nest==1) nest=0; // cause loop exit and return after ELSE
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -525,7 +551,15 @@ bool RMFT2::skipIfBlock() {
|
||||
|
||||
|
||||
/* static */ void RMFT2::readLocoCallback(int16_t cv) {
|
||||
progtrackLocoId=cv;
|
||||
if (cv & LONG_ADDR_MARKER) { // maker bit indicates long addr
|
||||
progtrackLocoId = cv ^ LONG_ADDR_MARKER; // remove marker bit to get real long addr
|
||||
if (progtrackLocoId <= HIGHEST_SHORT_ADDR ) { // out of range for long addr
|
||||
DIAG(F("Long addr %d <= %d unsupported\n"), progtrackLocoId, HIGHEST_SHORT_ADDR);
|
||||
progtrackLocoId = -1;
|
||||
}
|
||||
} else {
|
||||
progtrackLocoId=cv;
|
||||
}
|
||||
}
|
||||
|
||||
void RMFT2::loop() {
|
||||
@@ -542,6 +576,10 @@ void RMFT2::loop2() {
|
||||
|
||||
byte opcode = GET_OPCODE;
|
||||
int16_t operand = GET_OPERAND(0);
|
||||
|
||||
// skipIf will get set to indicate a failing IF condition
|
||||
bool skipIf=false;
|
||||
|
||||
// if (diag) DIAG(F("RMFT2 %d %d"),opcode,operand);
|
||||
// Attention: Returning from this switch leaves the program counter unchanged.
|
||||
// This is used for unfinished waits for timers or sensors.
|
||||
@@ -570,6 +608,13 @@ void RMFT2::loop2() {
|
||||
driveLoco(operand);
|
||||
break;
|
||||
|
||||
case OPCODE_FORGET:
|
||||
if (loco!=0) {
|
||||
DCC::forgetLoco(loco);
|
||||
loco=0;
|
||||
}
|
||||
break;
|
||||
|
||||
case OPCODE_INVERT_DIRECTION:
|
||||
invert= !invert;
|
||||
driveLoco(speedo);
|
||||
@@ -594,6 +639,18 @@ void RMFT2::loop2() {
|
||||
delayMe(50);
|
||||
return;
|
||||
|
||||
case OPCODE_ATGTE: // wait for analog sensor>= value
|
||||
timeoutFlag=false;
|
||||
if (IODevice::readAnalogue(operand) >= (int)(GET_OPERAND(1))) break;
|
||||
delayMe(50);
|
||||
return;
|
||||
|
||||
case OPCODE_ATLT: // wait for analog sensor < value
|
||||
timeoutFlag=false;
|
||||
if (IODevice::readAnalogue(operand) < (int)(GET_OPERAND(1))) break;
|
||||
delayMe(50);
|
||||
return;
|
||||
|
||||
case OPCODE_ATTIMEOUT1: // ATTIMEOUT(vpin,timeout) part 1
|
||||
timeoutStart=millis();
|
||||
timeoutFlag=false;
|
||||
@@ -609,7 +666,7 @@ void RMFT2::loop2() {
|
||||
return;
|
||||
|
||||
case OPCODE_IFTIMEOUT: // do next operand if timeout flag set
|
||||
if (!timeoutFlag) if (!skipIfBlock()) return;
|
||||
skipIf=!timeoutFlag;
|
||||
break;
|
||||
|
||||
case OPCODE_AFTER: // waits for sensor to hit and then remain off for 0.5 seconds. (must come after an AT operation)
|
||||
@@ -661,40 +718,52 @@ void RMFT2::loop2() {
|
||||
break;
|
||||
|
||||
case OPCODE_IF: // do next operand if sensor set
|
||||
if (!readSensor(operand)) if (!skipIfBlock()) return;
|
||||
skipIf=!readSensor(operand);
|
||||
break;
|
||||
|
||||
case OPCODE_ELSE: // skip to matching ENDIF
|
||||
if (!skipIfBlock()) return;
|
||||
skipIf=true;
|
||||
break;
|
||||
|
||||
case OPCODE_IFGTE: // do next operand if sensor>= value
|
||||
if (IODevice::readAnalogue(operand)<(int)(GET_OPERAND(1))) if (!skipIfBlock()) return;
|
||||
skipIf=IODevice::readAnalogue(operand)<(int)(GET_OPERAND(1));
|
||||
break;
|
||||
|
||||
case OPCODE_IFLT: // do next operand if sensor< value
|
||||
if (IODevice::readAnalogue(operand)>=(int)(GET_OPERAND(1))) if (!skipIfBlock()) return;
|
||||
skipIf=IODevice::readAnalogue(operand)>=(int)(GET_OPERAND(1));
|
||||
break;
|
||||
|
||||
case OPCODE_IFNOT: // do next operand if sensor not set
|
||||
if (readSensor(operand)) if (!skipIfBlock()) return;
|
||||
skipIf=readSensor(operand);
|
||||
break;
|
||||
|
||||
case OPCODE_IFRANDOM: // do block on random percentage
|
||||
if ((int16_t)random(100)>=operand) if (!skipIfBlock()) return;
|
||||
skipIf=(int16_t)random(100)>=operand;
|
||||
break;
|
||||
|
||||
case OPCODE_IFRESERVE: // do block if we successfully RERSERVE
|
||||
if (!getFlag(operand,SECTION_FLAG)) setFlag(operand,SECTION_FLAG);
|
||||
else if (!skipIfBlock()) return;
|
||||
else skipIf=true;
|
||||
break;
|
||||
|
||||
case OPCODE_IFRED: // do block if signal as expected
|
||||
skipIf=!isSignal(operand,SIGNAL_RED);
|
||||
break;
|
||||
|
||||
case OPCODE_IFAMBER: // do block if signal as expected
|
||||
skipIf=!isSignal(operand,SIGNAL_AMBER);
|
||||
break;
|
||||
|
||||
case OPCODE_IFGREEN: // do block if signal as expected
|
||||
skipIf=!isSignal(operand,SIGNAL_GREEN);
|
||||
break;
|
||||
|
||||
case OPCODE_IFTHROWN:
|
||||
if (Turnout::isClosed(operand)) if (!skipIfBlock()) return;
|
||||
skipIf=Turnout::isClosed(operand);
|
||||
break;
|
||||
|
||||
case OPCODE_IFCLOSED:
|
||||
if (!Turnout::isClosed(operand)) if (!skipIfBlock()) return;
|
||||
skipIf=Turnout::isThrown(operand);
|
||||
break;
|
||||
|
||||
case OPCODE_ENDIF:
|
||||
@@ -717,15 +786,15 @@ void RMFT2::loop2() {
|
||||
break;
|
||||
|
||||
case OPCODE_RED:
|
||||
doSignal(operand,true,false,false);
|
||||
doSignal(operand,SIGNAL_RED);
|
||||
break;
|
||||
|
||||
case OPCODE_AMBER:
|
||||
doSignal(operand,false,true,false);
|
||||
doSignal(operand,SIGNAL_AMBER);
|
||||
break;
|
||||
|
||||
case OPCODE_GREEN:
|
||||
doSignal(operand,false,false,true);
|
||||
doSignal(operand,SIGNAL_GREEN);
|
||||
break;
|
||||
|
||||
case OPCODE_FON:
|
||||
@@ -787,13 +856,23 @@ void RMFT2::loop2() {
|
||||
case OPCODE_ENDEXRAIL:
|
||||
kill();
|
||||
return;
|
||||
|
||||
|
||||
case OPCODE_KILLALL:
|
||||
while(loopTask) loopTask->kill(F("KILLALL"));
|
||||
return;
|
||||
|
||||
case OPCODE_JOIN:
|
||||
DCCWaveform::mainTrack.setPowerMode(POWERMODE::ON);
|
||||
DCCWaveform::progTrack.setPowerMode(POWERMODE::ON);
|
||||
DCC::setProgTrackSyncMain(true);
|
||||
CommandDistributor::broadcastPower();
|
||||
break;
|
||||
|
||||
case OPCODE_POWERON:
|
||||
DCCWaveform::mainTrack.setPowerMode(POWERMODE::ON);
|
||||
DCC::setProgTrackSyncMain(false);
|
||||
CommandDistributor::broadcastPower();
|
||||
break;
|
||||
|
||||
case OPCODE_UNJOIN:
|
||||
DCC::setProgTrackSyncMain(false);
|
||||
@@ -870,13 +949,13 @@ void RMFT2::loop2() {
|
||||
break;
|
||||
|
||||
case OPCODE_AUTOSTART: // Handled only during begin process
|
||||
case OPCODE_PAD: // Just a padding for previous opcode needing >1 operad byte.
|
||||
case OPCODE_PAD: // Just a padding for previous opcode needing >1 operand byte.
|
||||
case OPCODE_TURNOUT: // Turnout definition ignored at runtime
|
||||
case OPCODE_SERVOTURNOUT: // Turnout definition ignored at runtime
|
||||
case OPCODE_PINTURNOUT: // Turnout definition ignored at runtime
|
||||
case OPCODE_ONCLOSE: // Turnout event catcers ignored here
|
||||
case OPCODE_ONCLOSE: // Turnout event catchers ignored here
|
||||
case OPCODE_ONTHROW:
|
||||
case OPCODE_ONACTIVATE: // Activate event catcers ignored here
|
||||
case OPCODE_ONACTIVATE: // Activate event catchers ignored here
|
||||
case OPCODE_ONDEACTIVATE:
|
||||
break;
|
||||
|
||||
@@ -884,6 +963,8 @@ void RMFT2::loop2() {
|
||||
kill(F("INVOP"),operand);
|
||||
}
|
||||
// Falling out of the switch means move on to the next opcode
|
||||
// but if we are skipping a false IF or else
|
||||
if (skipIf) if (!skipIfBlock()) return;
|
||||
SKIPOP;
|
||||
}
|
||||
|
||||
@@ -911,26 +992,65 @@ void RMFT2::kill(const FSH * reason, int operand) {
|
||||
delete this;
|
||||
}
|
||||
|
||||
/* static */ void RMFT2::doSignal(VPIN id,bool red, bool amber, bool green) {
|
||||
//if (diag) DIAG(F(" dosignal %d"),id);
|
||||
for (int sigpos=0;;sigpos+=3) {
|
||||
VPIN redpin=GETFLASHW(RMFT2::SignalDefinitions+sigpos);
|
||||
//if (diag) DIAG(F("red=%d"),redpin);
|
||||
if (redpin==0) {
|
||||
DIAG(F("EXRAIL Signal %d not defined"), id);
|
||||
return; // signal not found
|
||||
}
|
||||
if (redpin==id) {
|
||||
VPIN amberpin=GETFLASHW(RMFT2::SignalDefinitions+sigpos+1);
|
||||
VPIN greenpin=GETFLASHW(RMFT2::SignalDefinitions+sigpos+2);
|
||||
//if (diag) DIAG(F("signal %d %d %d"),redpin,amberpin,greenpin);
|
||||
// If amberpin is zero, synthesise amber from red+green
|
||||
IODevice::write(redpin,red || (amber && (amberpin==0)));
|
||||
if (amberpin) IODevice::write(amberpin,amber);
|
||||
if (greenpin) IODevice::write(greenpin,green || (amber && (amberpin==0)));
|
||||
return;
|
||||
}
|
||||
int16_t RMFT2::getSignalSlot(VPIN id) {
|
||||
for (int sigpos=0;;sigpos+=4) {
|
||||
VPIN sigid=GETFLASHW(RMFT2::SignalDefinitions+sigpos);
|
||||
if (sigid==0) { // end of signal list
|
||||
DIAG(F("EXRAIL Signal %d not defined"), id);
|
||||
return -1;
|
||||
}
|
||||
// sigid is the signal id used in RED/AMBER/GREEN macro
|
||||
// for a LED signal it will be same as redpin
|
||||
// but for a servo signal it will also have SERVO_SIGNAL_FLAG set.
|
||||
|
||||
if ((sigid & SIGNAL_ID_MASK)!= id) continue; // keep looking
|
||||
return sigpos/4; // relative slot in signals table
|
||||
}
|
||||
}
|
||||
/* static */ void RMFT2::doSignal(VPIN id,char rag) {
|
||||
if (diag) DIAG(F(" doSignal %d %x"),id,rag);
|
||||
int16_t sigslot=getSignalSlot(id);
|
||||
if (sigslot<0) return;
|
||||
|
||||
// keep track of signal state
|
||||
setFlag(sigslot,rag,SIGNAL_MASK);
|
||||
|
||||
// Correct signal definition found, get the rag values
|
||||
int16_t sigpos=sigslot*4;
|
||||
VPIN sigid=GETFLASHW(RMFT2::SignalDefinitions+sigpos);
|
||||
VPIN redpin=GETFLASHW(RMFT2::SignalDefinitions+sigpos+1);
|
||||
VPIN amberpin=GETFLASHW(RMFT2::SignalDefinitions+sigpos+2);
|
||||
VPIN greenpin=GETFLASHW(RMFT2::SignalDefinitions+sigpos+3);
|
||||
if (diag) DIAG(F("signal %d %d %d %d"),sigid,redpin,amberpin,greenpin);
|
||||
|
||||
if (sigid & SERVO_SIGNAL_FLAG) {
|
||||
// A servo signal, the pin numbers are actually servo positions
|
||||
// Note, setting a signal to a zero position has no effect.
|
||||
int16_t servopos= rag==SIGNAL_RED? redpin: (rag==SIGNAL_GREEN? greenpin : amberpin);
|
||||
if (diag) DIAG(F("sigA %d %d"),id,servopos);
|
||||
if (servopos!=0) IODevice::writeAnalogue(id,servopos,PCA9685::Bounce);
|
||||
return;
|
||||
}
|
||||
|
||||
// LED or similar 3 pin signal
|
||||
// If amberpin is zero, synthesise amber from red+green
|
||||
const byte SIMAMBER=0x00;
|
||||
if (rag==SIGNAL_AMBER && (amberpin==0)) rag=SIMAMBER; // special case this func only
|
||||
|
||||
// Manage invert (HIGH on) pins
|
||||
bool aHigh=sigid & ACTIVE_HIGH_SIGNAL_FLAG;
|
||||
|
||||
// set the three pins
|
||||
if (redpin) IODevice::write(redpin,(rag==SIGNAL_RED || rag==SIMAMBER)^aHigh);
|
||||
if (amberpin) IODevice::write(amberpin,(rag==SIGNAL_AMBER)^aHigh);
|
||||
if (greenpin) IODevice::write(greenpin,(rag==SIGNAL_GREEN || rag==SIMAMBER)^aHigh);
|
||||
return;
|
||||
}
|
||||
|
||||
/* static */ bool RMFT2::isSignal(VPIN id,char rag) {
|
||||
int16_t sigslot=getSignalSlot(id);
|
||||
if (sigslot<0) return false;
|
||||
return (flags[sigslot] & SIGNAL_MASK) == rag;
|
||||
}
|
||||
|
||||
void RMFT2::turnoutEvent(int16_t turnoutId, bool closed) {
|
||||
@@ -977,8 +1097,4 @@ void RMFT2::printMessage2(const FSH * msg) {
|
||||
DIAG(F("EXRAIL(%d) %S"),loco,msg);
|
||||
}
|
||||
|
||||
// This is called by emitRouteDescriptions to emit a withrottle description for a route or autoomation.
|
||||
void RMFT2::emitRouteDescription(Print * stream, char type, int id, const FSH * description) {
|
||||
StringFormatter::send(stream,F("]\\[%c%d}|{%S}|{%c"),
|
||||
type,id,description, type=='R'?'2':'4');
|
||||
}
|
||||
|
@@ -18,10 +18,11 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with CommandStation. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef RMFT2_H
|
||||
#define RMFT2_H
|
||||
#ifndef EXRAIL2_H
|
||||
#define EXRAIL2_H
|
||||
#include "FSH.h"
|
||||
#include "IODevice.h"
|
||||
#include "Turnouts.h"
|
||||
|
||||
// The following are the operation codes (or instructions) for a kind of virtual machine.
|
||||
// Each instruction is normally 3 bytes long with an operation code followed by a parameter.
|
||||
@@ -33,33 +34,48 @@ enum OPCODE : byte {OPCODE_THROW,OPCODE_CLOSE,
|
||||
OPCODE_FWD,OPCODE_REV,OPCODE_SPEED,OPCODE_INVERT_DIRECTION,
|
||||
OPCODE_RESERVE,OPCODE_FREE,
|
||||
OPCODE_AT,OPCODE_AFTER,OPCODE_AUTOSTART,
|
||||
OPCODE_ATTIMEOUT1,OPCODE_ATTIMEOUT2,OPCODE_IFTIMEOUT,
|
||||
OPCODE_ATGTE,OPCODE_ATLT,
|
||||
OPCODE_ATTIMEOUT1,OPCODE_ATTIMEOUT2,
|
||||
OPCODE_LATCH,OPCODE_UNLATCH,OPCODE_SET,OPCODE_RESET,
|
||||
OPCODE_IF,OPCODE_IFNOT,OPCODE_ENDIF,OPCODE_IFRANDOM,OPCODE_IFRESERVE,
|
||||
OPCODE_IFCLOSED, OPCODE_IFTHROWN,OPCODE_ELSE,
|
||||
OPCODE_ENDIF,OPCODE_ELSE,
|
||||
OPCODE_DELAY,OPCODE_DELAYMINS,OPCODE_DELAYMS,OPCODE_RANDWAIT,
|
||||
OPCODE_FON,OPCODE_FOFF,OPCODE_XFON,OPCODE_XFOFF,
|
||||
OPCODE_RED,OPCODE_GREEN,OPCODE_AMBER,OPCODE_DRIVE,
|
||||
OPCODE_SERVO,OPCODE_SIGNAL,OPCODE_TURNOUT,OPCODE_WAITFOR,
|
||||
OPCODE_PAD,OPCODE_FOLLOW,OPCODE_CALL,OPCODE_RETURN,
|
||||
OPCODE_JOIN,OPCODE_UNJOIN,OPCODE_READ_LOCO1,OPCODE_READ_LOCO2,OPCODE_POM,
|
||||
OPCODE_START,OPCODE_SETLOCO,OPCODE_SENDLOCO,
|
||||
OPCODE_PAUSE, OPCODE_RESUME,OPCODE_POWEROFF,
|
||||
OPCODE_START,OPCODE_SETLOCO,OPCODE_SENDLOCO,OPCODE_FORGET,
|
||||
OPCODE_PAUSE, OPCODE_RESUME,OPCODE_POWEROFF,OPCODE_POWERON,
|
||||
OPCODE_ONCLOSE, OPCODE_ONTHROW, OPCODE_SERVOTURNOUT, OPCODE_PINTURNOUT,
|
||||
OPCODE_PRINT,OPCODE_DCCACTIVATE,
|
||||
OPCODE_ONACTIVATE,OPCODE_ONDEACTIVATE,OPCODE_IFGTE,OPCODE_IFLT,
|
||||
OPCODE_ROSTER,
|
||||
OPCODE_ROUTE,OPCODE_AUTOMATION,OPCODE_SEQUENCE,OPCODE_ENDTASK,OPCODE_ENDEXRAIL
|
||||
OPCODE_ONACTIVATE,OPCODE_ONDEACTIVATE,
|
||||
OPCODE_ROSTER,OPCODE_KILLALL,
|
||||
OPCODE_ROUTE,OPCODE_AUTOMATION,OPCODE_SEQUENCE,
|
||||
OPCODE_ENDTASK,OPCODE_ENDEXRAIL,
|
||||
|
||||
// OPcodes below this point are skip-nesting IF operations
|
||||
// placed here so that they may be skipped as a group
|
||||
// see skipIfBlock()
|
||||
IF_TYPE_OPCODES, // do not move this...
|
||||
OPCODE_IFRED,OPCODE_IFAMBER,OPCODE_IFGREEN,
|
||||
OPCODE_IFGTE,OPCODE_IFLT,
|
||||
OPCODE_IFTIMEOUT,
|
||||
OPCODE_IF,OPCODE_IFNOT,
|
||||
OPCODE_IFRANDOM,OPCODE_IFRESERVE,
|
||||
OPCODE_IFCLOSED, OPCODE_IFTHROWN
|
||||
};
|
||||
|
||||
|
||||
|
||||
// Flag bits for status of hardware and TPL
|
||||
static const byte SECTION_FLAG = 0x80;
|
||||
static const byte LATCH_FLAG = 0x40;
|
||||
static const byte TASK_FLAG = 0x20;
|
||||
static const byte SPARE_FLAG = 0x10;
|
||||
static const byte COUNTER_MASK= 0x0F;
|
||||
static const byte LATCH_FLAG = 0x40;
|
||||
static const byte TASK_FLAG = 0x20;
|
||||
static const byte SPARE_FLAG = 0x10;
|
||||
static const byte SIGNAL_MASK = 0x0C;
|
||||
static const byte SIGNAL_RED = 0x08;
|
||||
static const byte SIGNAL_AMBER = 0x0C;
|
||||
static const byte SIGNAL_GREEN = 0x04;
|
||||
|
||||
static const byte MAX_STACK_DEPTH=4;
|
||||
|
||||
@@ -86,14 +102,24 @@ class LookList {
|
||||
RMFT2(int route, uint16_t cab);
|
||||
~RMFT2();
|
||||
static void readLocoCallback(int16_t cv);
|
||||
static void emitWithrottleRouteList(Print* stream);
|
||||
static void createNewTask(int route, uint16_t cab);
|
||||
static void turnoutEvent(int16_t id, bool closed);
|
||||
static void activateEvent(int16_t addr, bool active);
|
||||
static void emitTurnoutDescription(Print* stream,int16_t id);
|
||||
static const byte rosterNameCount;
|
||||
static void emitWithrottleRoster(Print * stream);
|
||||
static const FSH * getRosterFunctions(int16_t cabid);
|
||||
static const int16_t SERVO_SIGNAL_FLAG=0x4000;
|
||||
static const int16_t ACTIVE_HIGH_SIGNAL_FLAG=0x2000;
|
||||
static const int16_t SIGNAL_ID_MASK=0x0FFF;
|
||||
|
||||
// Throttle Info Access functions built by exrail macros
|
||||
static const byte rosterNameCount;
|
||||
static const int16_t FLASH routeIdList[];
|
||||
static const int16_t FLASH automationIdList[];
|
||||
static const int16_t FLASH rosterIdList[];
|
||||
static const FSH * getRouteDescription(int16_t id);
|
||||
static char getRouteType(int16_t id);
|
||||
static const FSH * getTurnoutDescription(int16_t id);
|
||||
static const FSH * getRosterName(int16_t id);
|
||||
static const FSH * getRosterFunctions(int16_t id);
|
||||
|
||||
private:
|
||||
static void ComandFilter(Print * stream, byte & opcode, byte & paramCount, int16_t p[]);
|
||||
static bool parseSlash(Print * stream, byte & paramCount, int16_t p[]) ;
|
||||
@@ -101,10 +127,10 @@ private:
|
||||
static void setFlag(VPIN id,byte onMask, byte OffMask=0);
|
||||
static bool getFlag(VPIN id,byte mask);
|
||||
static int16_t progtrackLocoId;
|
||||
static void doSignal(VPIN id,bool red, bool amber, bool green);
|
||||
static void emitRouteDescription(Print * stream, char type, int id, const FSH * description);
|
||||
static void emitWithrottleDescriptions(Print * stream);
|
||||
|
||||
static void doSignal(VPIN id,char rag);
|
||||
static bool isSignal(VPIN id,char rag);
|
||||
static int16_t getSignalSlot(VPIN id);
|
||||
static void setTurnoutHiddenState(Turnout * t);
|
||||
static RMFT2 * loopTask;
|
||||
static RMFT2 * pausingTask;
|
||||
void delayMe(long millisecs);
|
||||
@@ -128,6 +154,7 @@ private:
|
||||
static LookList * onActivateLookup;
|
||||
static LookList * onDeactivateLookup;
|
||||
|
||||
|
||||
// Local variables - exist for each instance/task
|
||||
RMFT2 *next; // loop chain
|
||||
int progCounter; // Byte offset of next route opcode in ROUTES table
|
@@ -29,9 +29,12 @@
|
||||
#undef ALIAS
|
||||
#undef AMBER
|
||||
#undef AT
|
||||
#undef ATGTE
|
||||
#undef ATLT
|
||||
#undef ATTIMEOUT
|
||||
#undef AUTOMATION
|
||||
#undef AUTOSTART
|
||||
#undef BROADCAST
|
||||
#undef CALL
|
||||
#undef CLOSE
|
||||
#undef DEACTIVATE
|
||||
@@ -51,20 +54,25 @@
|
||||
#undef FOFF
|
||||
#undef FOLLOW
|
||||
#undef FON
|
||||
#undef FORGET
|
||||
#undef FREE
|
||||
#undef FWD
|
||||
#undef GREEN
|
||||
#undef IF
|
||||
#undef IFAMBER
|
||||
#undef IFCLOSED
|
||||
#undef IFGREEN
|
||||
#undef IFGTE
|
||||
#undef IFLT
|
||||
#undef IFNOT
|
||||
#undef IFRANDOM
|
||||
#undef IFRED
|
||||
#undef IFRESERVE
|
||||
#undef IFTHROWN
|
||||
#undef IFTIMEOUT
|
||||
#undef INVERT_DIRECTION
|
||||
#undef JOIN
|
||||
#undef KILLALL
|
||||
#undef LATCH
|
||||
#undef LCD
|
||||
#undef LCN
|
||||
@@ -74,11 +82,13 @@
|
||||
#undef ONDEACTIVATEL
|
||||
#undef ONCLOSE
|
||||
#undef ONTHROW
|
||||
#undef PARSE
|
||||
#undef PAUSE
|
||||
#undef PIN_TURNOUT
|
||||
#undef PRINT
|
||||
#undef POM
|
||||
#undef POWEROFF
|
||||
#undef POWERON
|
||||
#undef READ_LOCO
|
||||
#undef RED
|
||||
#undef RESERVE
|
||||
@@ -97,9 +107,11 @@
|
||||
#undef SERVO
|
||||
#undef SERVO2
|
||||
#undef SERVO_TURNOUT
|
||||
#undef SERVO_SIGNAL
|
||||
#undef SET
|
||||
#undef SETLOCO
|
||||
#undef SIGNAL
|
||||
#undef SIGNALH
|
||||
#undef SPEED
|
||||
#undef START
|
||||
#undef STOP
|
||||
@@ -107,6 +119,7 @@
|
||||
#undef TURNOUT
|
||||
#undef UNJOIN
|
||||
#undef UNLATCH
|
||||
#undef VIRTUAL_TURNOUT
|
||||
#undef WAITFOR
|
||||
#undef XFOFF
|
||||
#undef XFON
|
||||
@@ -115,12 +128,15 @@
|
||||
#define ACTIVATE(addr,subaddr)
|
||||
#define ACTIVATEL(addr)
|
||||
#define AFTER(sensor_id)
|
||||
#define ALIAS(name,value)
|
||||
#define ALIAS(name,value...)
|
||||
#define AMBER(signal_id)
|
||||
#define AT(sensor_id)
|
||||
#define ATGTE(sensor_id,value)
|
||||
#define ATLT(sensor_id,value)
|
||||
#define ATTIMEOUT(sensor_id,timeout_ms)
|
||||
#define AUTOMATION(id, description)
|
||||
#define AUTOMATION(id,description)
|
||||
#define AUTOSTART
|
||||
#define BROADCAST(msg)
|
||||
#define CALL(route)
|
||||
#define CLOSE(id)
|
||||
#define DEACTIVATE(addr,subaddr)
|
||||
@@ -139,21 +155,26 @@
|
||||
#define FADE(pin,value,ms)
|
||||
#define FOFF(func)
|
||||
#define FOLLOW(route)
|
||||
#define FON(func)
|
||||
#define FON(func)
|
||||
#define FORGET
|
||||
#define FREE(blockid)
|
||||
#define FWD(speed)
|
||||
#define GREEN(signal_id)
|
||||
#define IF(sensor_id)
|
||||
#define IFAMBER(signal_id)
|
||||
#define IFCLOSED(turnout_id)
|
||||
#define IFGREEN(signal_id)
|
||||
#define IFGTE(sensor_id,value)
|
||||
#define IFLT(sensor_id,value)
|
||||
#define IFNOT(sensor_id)
|
||||
#define IFRANDOM(percent)
|
||||
#define IFRED(signal_id)
|
||||
#define IFTHROWN(turnout_id)
|
||||
#define IFRESERVE(block)
|
||||
#define IFTIMEOUT
|
||||
#define INVERT_DIRECTION
|
||||
#define JOIN
|
||||
#define KILLALL
|
||||
#define LATCH(sensor_id)
|
||||
#define LCD(row,msg)
|
||||
#define LCN(msg)
|
||||
@@ -166,8 +187,10 @@
|
||||
#define PAUSE
|
||||
#define PIN_TURNOUT(id,pin,description...)
|
||||
#define PRINT(msg)
|
||||
#define PARSE(msg)
|
||||
#define POM(cv,value)
|
||||
#define POWEROFF
|
||||
#define POWERON
|
||||
#define READ_LOCO
|
||||
#define RED(signal_id)
|
||||
#define RESERVE(blockid)
|
||||
@@ -175,7 +198,7 @@
|
||||
#define RESUME
|
||||
#define RETURN
|
||||
#define REV(speed)
|
||||
#define ROUTE(id, description)
|
||||
#define ROUTE(id,description)
|
||||
#define ROSTER(cab,name,funcmap...)
|
||||
#define SENDLOCO(cab,route)
|
||||
#define SEQUENCE(id)
|
||||
@@ -185,10 +208,12 @@
|
||||
#define SERIAL3(msg)
|
||||
#define SERVO(id,position,profile)
|
||||
#define SERVO2(id,position,duration)
|
||||
#define SERVO_SIGNAL(vpin,redpos,amberpos,greenpos)
|
||||
#define SERVO_TURNOUT(id,pin,activeAngle,inactiveAngle,profile,description...)
|
||||
#define SET(pin)
|
||||
#define SETLOCO(loco)
|
||||
#define SIGNAL(redpin,amberpin,greenpin)
|
||||
#define SIGNALH(redpin,amberpin,greenpin)
|
||||
#define SPEED(speed)
|
||||
#define START(route)
|
||||
#define STOP
|
||||
@@ -196,6 +221,7 @@
|
||||
#define TURNOUT(id,addr,subaddr,description...)
|
||||
#define UNJOIN
|
||||
#define UNLATCH(sensor_id)
|
||||
#define VIRTUAL_TURNOUT(id,description...)
|
||||
#define WAITFOR(pin)
|
||||
#define XFOFF(cab,func)
|
||||
#define XFON(cab,func)
|
@@ -19,8 +19,8 @@
|
||||
* along with CommandStation. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef RMFTMacros_H
|
||||
#define RMFTMacros_H
|
||||
#ifndef EXRAILMacros_H
|
||||
#define EXRAILMacros_H
|
||||
|
||||
// remove normal code LCD & SERIAL macros (will be restored later)
|
||||
#undef LCD
|
||||
@@ -49,26 +49,53 @@
|
||||
|
||||
// CAUTION: The macros below are multiple passed over myAutomation.h
|
||||
|
||||
|
||||
// helper macro for turnout descriptions, creates NULL for missing description
|
||||
#define O_DESC(id, desc) case id: return ("" desc)[0]?F("" desc):NULL;
|
||||
// helper macro for turnout description as HIDDEN
|
||||
#define HIDDEN "\x01"
|
||||
|
||||
// Pass 1 Implements aliases
|
||||
#include "RMFT2MacroReset.h"
|
||||
#include "EXRAIL2MacroReset.h"
|
||||
#undef ALIAS
|
||||
#define ALIAS(name,value) const int name=value;
|
||||
#define ALIAS(name,value...) const int name= 1##value##0 ==10 ? -__COUNTER__ : value##0/10;
|
||||
#include "myAutomation.h"
|
||||
|
||||
// Pass 2 convert descriptions to withrottle format emitter function
|
||||
#include "RMFT2MacroReset.h"
|
||||
// Pass 2 create throttle route list
|
||||
#include "EXRAIL2MacroReset.h"
|
||||
#undef ROUTE
|
||||
#define ROUTE(id, description) emitRouteDescription(stream,'R',id,F(description));
|
||||
#undef AUTOMATION
|
||||
#define AUTOMATION(id, description) emitRouteDescription(stream,'A',id,F(description));
|
||||
void RMFT2::emitWithrottleDescriptions(Print * stream) {
|
||||
(void)stream;
|
||||
#define ROUTE(id, description) id,
|
||||
const int16_t FLASH RMFT2::routeIdList[]= {
|
||||
#include "myAutomation.h"
|
||||
0};
|
||||
// Pass 2a create throttle automation list
|
||||
#include "EXRAIL2MacroReset.h"
|
||||
#undef AUTOMATION
|
||||
#define AUTOMATION(id, description) id,
|
||||
const int16_t FLASH RMFT2::automationIdList[]= {
|
||||
#include "myAutomation.h"
|
||||
0};
|
||||
|
||||
// Pass 3 Create route descriptions:
|
||||
#undef ROUTE
|
||||
#define ROUTE(id, description) case id: return F(description);
|
||||
#undef AUTOMATION
|
||||
#define AUTOMATION(id, description) case id: return F(description);
|
||||
const FSH * RMFT2::getRouteDescription(int16_t id) {
|
||||
switch(id) {
|
||||
#include "myAutomation.h"
|
||||
default: break;
|
||||
}
|
||||
return F("");
|
||||
}
|
||||
|
||||
// Pass 3... Create Text sending functions
|
||||
#include "RMFT2MacroReset.h"
|
||||
// Pass 4... Create Text sending functions
|
||||
#include "EXRAIL2MacroReset.h"
|
||||
const int StringMacroTracker1=__COUNTER__;
|
||||
#undef BROADCAST
|
||||
#define BROADCAST(msg) case (__COUNTER__ - StringMacroTracker1) : CommandDistributor::broadcastText(F(msg));break;
|
||||
#undef PARSE
|
||||
#define PARSE(msg) case (__COUNTER__ - StringMacroTracker1) : DCCEXParser::parse(F(msg));break;
|
||||
#undef PRINT
|
||||
#define PRINT(msg) case (__COUNTER__ - StringMacroTracker1) : printMessage2(F(msg));break;
|
||||
#undef LCN
|
||||
@@ -92,69 +119,80 @@ void RMFT2::printMessage(uint16_t id) {
|
||||
}
|
||||
|
||||
|
||||
// Pass 4: Turnout descriptions (optional)
|
||||
#include "RMFT2MacroReset.h"
|
||||
// Pass 5: Turnout descriptions (optional)
|
||||
#include "EXRAIL2MacroReset.h"
|
||||
#undef TURNOUT
|
||||
#define TURNOUT(id,addr,subaddr,description...) case id: desc=F("" description); break;
|
||||
#define TURNOUT(id,addr,subaddr,description...) O_DESC(id,description)
|
||||
#undef PIN_TURNOUT
|
||||
#define PIN_TURNOUT(id,pin,description...) case id: desc=F("" description); break;
|
||||
#define PIN_TURNOUT(id,pin,description...) O_DESC(id,description)
|
||||
#undef SERVO_TURNOUT
|
||||
#define SERVO_TURNOUT(id,pin,activeAngle,inactiveAngle,profile,description...) case id: desc=F("" description); break;
|
||||
#define SERVO_TURNOUT(id,pin,activeAngle,inactiveAngle,profile,description...) O_DESC(id,description)
|
||||
#undef VIRTUAL_TURNOUT
|
||||
#define VIRTUAL_TURNOUT(id,description...) O_DESC(id,description)
|
||||
|
||||
void RMFT2::emitTurnoutDescription(Print* stream,int16_t turnoutid) {
|
||||
const FSH * desc=F("");
|
||||
const FSH * RMFT2::getTurnoutDescription(int16_t turnoutid) {
|
||||
switch (turnoutid) {
|
||||
#include "myAutomation.h"
|
||||
default: break;
|
||||
default:break;
|
||||
}
|
||||
if (GETFLASH(desc)=='\0') desc=F("%d");
|
||||
StringFormatter::send(stream,desc,turnoutid);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Pass 5: Roster names (count)
|
||||
#include "RMFT2MacroReset.h"
|
||||
// Pass 6: Roster IDs (count)
|
||||
#include "EXRAIL2MacroReset.h"
|
||||
#undef ROSTER
|
||||
#define ROSTER(cabid,name,funcmap...) +1
|
||||
|
||||
const byte RMFT2::rosterNameCount=0
|
||||
#include "myAutomation.h"
|
||||
;
|
||||
|
||||
// Pass 6: Roster names emitter
|
||||
#include "RMFT2MacroReset.h"
|
||||
#include "myAutomation.h"
|
||||
;
|
||||
|
||||
// Pass 6: Roster IDs
|
||||
#include "EXRAIL2MacroReset.h"
|
||||
#undef ROSTER
|
||||
#define ROSTER(cabid,name,funcmap...) StringFormatter::send(stream,(FSH *)format,F(name),cabid,cabid<128?'S':'L');
|
||||
void RMFT2::emitWithrottleRoster(Print * stream) {
|
||||
static const char format[] FLASH ="]\\[%S}|{%d}|{%c";
|
||||
(void)format;
|
||||
StringFormatter::send(stream,F("RL%d"), rosterNameCount);
|
||||
#include "myAutomation.h"
|
||||
stream->write('\n');
|
||||
}
|
||||
#define ROSTER(cabid,name,funcmap...) cabid,
|
||||
const int16_t FLASH RMFT2::rosterIdList[]={
|
||||
#include "myAutomation.h"
|
||||
0};
|
||||
|
||||
// Pass 7: functions getter
|
||||
#include "RMFT2MacroReset.h"
|
||||
// Pass 7: Roster names getter
|
||||
#include "EXRAIL2MacroReset.h"
|
||||
#undef ROSTER
|
||||
#define ROSTER(cabid,name,funcmap...) case cabid: return F(name);
|
||||
const FSH * RMFT2::getRosterName(int16_t id) {
|
||||
switch(id) {
|
||||
#include "myAutomation.h"
|
||||
default: break;
|
||||
}
|
||||
return F("");
|
||||
}
|
||||
|
||||
// Pass to get roster functions
|
||||
#undef ROSTER
|
||||
#define ROSTER(cabid,name,funcmap...) case cabid: return F("" funcmap);
|
||||
const FSH * RMFT2::getRosterFunctions(int16_t cabid) {
|
||||
switch(cabid) {
|
||||
const FSH * RMFT2::getRosterFunctions(int16_t id) {
|
||||
switch(id) {
|
||||
#include "myAutomation.h"
|
||||
default: return NULL;
|
||||
}
|
||||
}
|
||||
default: break;
|
||||
}
|
||||
return F("");
|
||||
}
|
||||
|
||||
// Pass 8 Signal definitions
|
||||
#include "RMFT2MacroReset.h"
|
||||
#include "EXRAIL2MacroReset.h"
|
||||
#undef SIGNAL
|
||||
#define SIGNAL(redpin,amberpin,greenpin) redpin,amberpin,greenpin,
|
||||
#define SIGNAL(redpin,amberpin,greenpin) redpin,redpin,amberpin,greenpin,
|
||||
#undef SIGNALH
|
||||
#define SIGNALH(redpin,amberpin,greenpin) redpin | RMFT2::ACTIVE_HIGH_SIGNAL_FLAG,redpin,amberpin,greenpin,
|
||||
#undef SERVO_SIGNAL
|
||||
#define SERVO_SIGNAL(vpin,redval,amberval,greenval) vpin | RMFT2::SERVO_SIGNAL_FLAG,redval,amberval,greenval,
|
||||
const FLASH int16_t RMFT2::SignalDefinitions[] = {
|
||||
#include "myAutomation.h"
|
||||
0,0,0 };
|
||||
0,0,0,0 };
|
||||
|
||||
// Last Pass : create main routes table
|
||||
// Only undef the macros, not dummy them.
|
||||
#define RMFT2_UNDEF_ONLY
|
||||
#include "RMFT2MacroReset.h"
|
||||
#include "EXRAIL2MacroReset.h"
|
||||
// Define internal helper macros.
|
||||
// Everything we generate here has to be compile-time evaluated to
|
||||
// a constant.
|
||||
@@ -164,12 +202,15 @@ const FLASH int16_t RMFT2::SignalDefinitions[] = {
|
||||
#define ACTIVATE(addr,subaddr) OPCODE_DCCACTIVATE,V(addr<<3 | subaddr<<1 | 1),
|
||||
#define ACTIVATEL(addr) OPCODE_DCCACTIVATE,V((addr+3)<<1 | 1),
|
||||
#define AFTER(sensor_id) OPCODE_AT,V(sensor_id),OPCODE_AFTER,V(sensor_id),
|
||||
#define ALIAS(name,value)
|
||||
#define ALIAS(name,value...)
|
||||
#define AMBER(signal_id) OPCODE_AMBER,V(signal_id),
|
||||
#define AT(sensor_id) OPCODE_AT,V(sensor_id),
|
||||
#define ATGTE(sensor_id,value) OPCODE_ATGTE,V(sensor_id),OPCODE_PAD,V(value),
|
||||
#define ATLT(sensor_id,value) OPCODE_ATLT,V(sensor_id),OPCODE_PAD,V(value),
|
||||
#define ATTIMEOUT(sensor_id,timeout) OPCODE_ATTIMEOUT1,0,0,OPCODE_ATTIMEOUT2,V(sensor_id),OPCODE_PAD,V(timeout/100L),
|
||||
#define AUTOMATION(id, description) OPCODE_AUTOMATION, V(id),
|
||||
#define AUTOSTART OPCODE_AUTOSTART,0,0,
|
||||
#define BROADCAST(msg) PRINT(msg)
|
||||
#define CALL(route) OPCODE_CALL,V(route),
|
||||
#define CLOSE(id) OPCODE_CLOSE,V(id),
|
||||
#define DEACTIVATE(addr,subaddr) OPCODE_DCCACTIVATE,V(addr<<3 | subaddr<<1),
|
||||
@@ -189,20 +230,25 @@ const FLASH int16_t RMFT2::SignalDefinitions[] = {
|
||||
#define FOFF(func) OPCODE_FOFF,V(func),
|
||||
#define FOLLOW(route) OPCODE_FOLLOW,V(route),
|
||||
#define FON(func) OPCODE_FON,V(func),
|
||||
#define FORGET OPCODE_FORGET,0,0,
|
||||
#define FREE(blockid) OPCODE_FREE,V(blockid),
|
||||
#define FWD(speed) OPCODE_FWD,V(speed),
|
||||
#define GREEN(signal_id) OPCODE_GREEN,V(signal_id),
|
||||
#define IF(sensor_id) OPCODE_IF,V(sensor_id),
|
||||
#define IFAMBER(signal_id) OPCODE_IFAMBER,V(signal_id),
|
||||
#define IFCLOSED(turnout_id) OPCODE_IFCLOSED,V(turnout_id),
|
||||
#define IFGREEN(signal_id) OPCODE_IFGREEN,V(signal_id),
|
||||
#define IFGTE(sensor_id,value) OPCODE_IFGTE,V(sensor_id),OPCODE_PAD,V(value),
|
||||
#define IFLT(sensor_id,value) OPCODE_IFLT,V(sensor_id),OPCODE_PAD,V(value),
|
||||
#define IFNOT(sensor_id) OPCODE_IFNOT,V(sensor_id),
|
||||
#define IFRANDOM(percent) OPCODE_IFRANDOM,V(percent),
|
||||
#define IFRED(signal_id) OPCODE_IFRED,V(signal_id),
|
||||
#define IFRESERVE(block) OPCODE_IFRESERVE,V(block),
|
||||
#define IFTHROWN(turnout_id) OPCODE_IFTHROWN,V(turnout_id),
|
||||
#define IFTIMEOUT OPCODE_IFTIMEOUT,0,0,
|
||||
#define INVERT_DIRECTION OPCODE_INVERT_DIRECTION,0,0,
|
||||
#define JOIN OPCODE_JOIN,0,0,
|
||||
#define KILLALL OPCODE_KILLALL,0,0,
|
||||
#define LATCH(sensor_id) OPCODE_LATCH,V(sensor_id),
|
||||
#define LCD(id,msg) PRINT(msg)
|
||||
#define LCN(msg) PRINT(msg)
|
||||
@@ -216,7 +262,9 @@ const FLASH int16_t RMFT2::SignalDefinitions[] = {
|
||||
#define PIN_TURNOUT(id,pin,description...) OPCODE_PINTURNOUT,V(id),OPCODE_PAD,V(pin),
|
||||
#define POM(cv,value) OPCODE_POM,V(cv),OPCODE_PAD,V(value),
|
||||
#define POWEROFF OPCODE_POWEROFF,0,0,
|
||||
#define POWERON OPCODE_POWERON,0,0,
|
||||
#define PRINT(msg) OPCODE_PRINT,V(__COUNTER__ - StringMacroTracker2),
|
||||
#define PARSE(msg) PRINT(msg)
|
||||
#define READ_LOCO OPCODE_READ_LOCO1,0,0,OPCODE_READ_LOCO2,0,0,
|
||||
#define RED(signal_id) OPCODE_RED,V(signal_id),
|
||||
#define RESERVE(blockid) OPCODE_RESERVE,V(blockid),
|
||||
@@ -234,10 +282,12 @@ const FLASH int16_t RMFT2::SignalDefinitions[] = {
|
||||
#define SERIAL3(msg) PRINT(msg)
|
||||
#define SERVO(id,position,profile) OPCODE_SERVO,V(id),OPCODE_PAD,V(position),OPCODE_PAD,V(PCA9685::profile),OPCODE_PAD,V(0),
|
||||
#define SERVO2(id,position,ms) OPCODE_SERVO,V(id),OPCODE_PAD,V(position),OPCODE_PAD,V(PCA9685::Instant),OPCODE_PAD,V(ms/100L),
|
||||
#define SERVO_SIGNAL(vpin,redpos,amberpos,greenpos)
|
||||
#define SERVO_TURNOUT(id,pin,activeAngle,inactiveAngle,profile,description...) OPCODE_SERVOTURNOUT,V(id),OPCODE_PAD,V(pin),OPCODE_PAD,V(activeAngle),OPCODE_PAD,V(inactiveAngle),OPCODE_PAD,V(PCA9685::ProfileType::profile),
|
||||
#define SET(pin) OPCODE_SET,V(pin),
|
||||
#define SETLOCO(loco) OPCODE_SETLOCO,V(loco),
|
||||
#define SIGNAL(redpin,amberpin,greenpin)
|
||||
#define SIGNALH(redpin,amberpin,greenpin)
|
||||
#define SPEED(speed) OPCODE_SPEED,V(speed),
|
||||
#define START(route) OPCODE_START,V(route),
|
||||
#define STOP OPCODE_SPEED,V(0),
|
||||
@@ -245,6 +295,7 @@ const FLASH int16_t RMFT2::SignalDefinitions[] = {
|
||||
#define TURNOUT(id,addr,subaddr,description...) OPCODE_TURNOUT,V(id),OPCODE_PAD,V(addr),OPCODE_PAD,V(subaddr),
|
||||
#define UNJOIN OPCODE_UNJOIN,0,0,
|
||||
#define UNLATCH(sensor_id) OPCODE_UNLATCH,V(sensor_id),
|
||||
#define VIRTUAL_TURNOUT(id,description...) OPCODE_PINTURNOUT,V(id),OPCODE_PAD,V(0),
|
||||
#define WAITFOR(pin) OPCODE_WAITFOR,V(pin),
|
||||
#define XFOFF(cab,func) OPCODE_XFOFF,V(cab),OPCODE_PAD,V(func),
|
||||
#define XFON(cab,func) OPCODE_XFON,V(cab),OPCODE_PAD,V(func),
|
@@ -1,6 +1,7 @@
|
||||
/*
|
||||
* © 2022 Bruno Sanches
|
||||
* © 2021 Fred Decker
|
||||
* © 2020-2021 Harald Barth
|
||||
* © 2020-2022 Harald Barth
|
||||
* © 2020-2021 Chris Harlow
|
||||
* © 2020 Gregor Baues
|
||||
* All rights reserved.
|
||||
@@ -35,8 +36,13 @@ EthernetInterface * EthernetInterface::singleton=NULL;
|
||||
*/
|
||||
void EthernetInterface::setup()
|
||||
{
|
||||
singleton=new EthernetInterface();
|
||||
if (!singleton->connected) singleton=NULL;
|
||||
if (singleton!=NULL) {
|
||||
DIAG(F("Prog Error!"));
|
||||
return;
|
||||
}
|
||||
if ((singleton=new EthernetInterface()))
|
||||
return;
|
||||
DIAG(F("Ethernet not initialized"));
|
||||
};
|
||||
|
||||
|
||||
@@ -60,73 +66,94 @@ EthernetInterface::EthernetInterface()
|
||||
DIAG(F("Ethernet.begin FAILED"));
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
DIAG(F("begin OK."));
|
||||
if (Ethernet.hardwareStatus() == EthernetNoHardware) {
|
||||
DIAG(F("Ethernet shield not found"));
|
||||
return;
|
||||
}
|
||||
|
||||
#endif
|
||||
if (Ethernet.hardwareStatus() == EthernetNoHardware)
|
||||
DIAG(F("Ethernet shield not detected or is a W5100"));
|
||||
|
||||
unsigned long startmilli = millis();
|
||||
while ((millis() - startmilli) < 5500) // Loop to give time to check for cable connection
|
||||
{
|
||||
if (Ethernet.linkStatus() == LinkON)
|
||||
break;
|
||||
DIAG(F("Ethernet waiting for link (1sec) "));
|
||||
delay(1000);
|
||||
while ((millis() - startmilli) < 5500) { // Loop to give time to check for cable connection
|
||||
if (Ethernet.linkStatus() == LinkON)
|
||||
break;
|
||||
DIAG(F("Ethernet waiting for link (1sec) "));
|
||||
delay(1000);
|
||||
}
|
||||
}
|
||||
|
||||
if (Ethernet.linkStatus() == LinkOFF) {
|
||||
DIAG(F("Ethernet cable not connected"));
|
||||
return;
|
||||
}
|
||||
|
||||
connected=true;
|
||||
|
||||
IPAddress ip = Ethernet.localIP(); // reassign the obtained ip address
|
||||
|
||||
server = new EthernetServer(IP_PORT); // Ethernet Server listening on default port IP_PORT
|
||||
server->begin();
|
||||
|
||||
LCD(4,F("IP: %d.%d.%d.%d"), ip[0], ip[1], ip[2], ip[3]);
|
||||
LCD(5,F("Port:%d"), IP_PORT);
|
||||
|
||||
outboundRing=new RingStream(OUTBOUND_RING_SIZE);
|
||||
/**
|
||||
* @brief Cleanup any resources
|
||||
*
|
||||
* @return none
|
||||
*/
|
||||
EthernetInterface::~EthernetInterface() {
|
||||
delete server;
|
||||
delete outboundRing;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Main loop for the EthernetInterface
|
||||
*
|
||||
*/
|
||||
void EthernetInterface::loop()
|
||||
{
|
||||
if (!singleton) return;
|
||||
|
||||
switch (Ethernet.maintain())
|
||||
{
|
||||
case 1:
|
||||
//renewed fail
|
||||
DIAG(F("Ethernet Error: renewed fail"));
|
||||
singleton=NULL;
|
||||
return;
|
||||
|
||||
case 3:
|
||||
//rebind fail
|
||||
DIAG(F("Ethernet Error: rebind fail"));
|
||||
singleton=NULL;
|
||||
return;
|
||||
|
||||
default:
|
||||
//nothing happened
|
||||
break;
|
||||
}
|
||||
|
||||
singleton->loop2();
|
||||
void EthernetInterface::loop() {
|
||||
if(!singleton || (!singleton->checkLink()))
|
||||
return;
|
||||
|
||||
switch (Ethernet.maintain()) {
|
||||
case 1:
|
||||
//renewed fail
|
||||
DIAG(F("Ethernet Error: renewed fail"));
|
||||
singleton=NULL;
|
||||
return;
|
||||
case 3:
|
||||
//rebind fail
|
||||
DIAG(F("Ethernet Error: rebind fail"));
|
||||
singleton=NULL;
|
||||
return;
|
||||
default:
|
||||
//nothing happened
|
||||
break;
|
||||
}
|
||||
singleton->loop2();
|
||||
}
|
||||
|
||||
void EthernetInterface::loop2()
|
||||
{
|
||||
/**
|
||||
* @brief Checks ethernet link cable status and detects when it connects / disconnects
|
||||
*
|
||||
* @return true when cable is connected, false otherwise
|
||||
*/
|
||||
bool EthernetInterface::checkLink() {
|
||||
if (Ethernet.linkStatus() != LinkOFF) { // check for not linkOFF instead of linkON as the W5100 does return LinkUnknown
|
||||
//if we are not connected yet, setup a new server
|
||||
if(!connected) {
|
||||
DIAG(F("Ethernet cable connected"));
|
||||
connected=true;
|
||||
IPAddress ip = Ethernet.localIP(); // reassign the obtained ip address
|
||||
server = new EthernetServer(IP_PORT); // Ethernet Server listening on default port IP_PORT
|
||||
server->begin();
|
||||
LCD(4,F("IP: %d.%d.%d.%d"), ip[0], ip[1], ip[2], ip[3]);
|
||||
LCD(5,F("Port:%d"), IP_PORT);
|
||||
// only create a outboundRing it none exists, this may happen if the cable
|
||||
// gets disconnected and connected again
|
||||
if(!outboundRing)
|
||||
outboundRing=new RingStream(OUTBOUND_RING_SIZE);
|
||||
}
|
||||
return true;
|
||||
} else { // connected
|
||||
DIAG(F("Ethernet cable disconnected"));
|
||||
connected=false;
|
||||
//clean up any client
|
||||
for (byte socket = 0; socket < MAX_SOCK_NUM; socket++) {
|
||||
if(clients[socket].connected())
|
||||
clients[socket].stop();
|
||||
}
|
||||
// tear down server
|
||||
delete server;
|
||||
server = nullptr;
|
||||
LCD(4,F("IP: None"));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void EthernetInterface::loop2() {
|
||||
// get client from the server
|
||||
EthernetClient client = server->accept();
|
||||
|
||||
|
@@ -50,21 +50,23 @@
|
||||
|
||||
class EthernetInterface {
|
||||
|
||||
public:
|
||||
|
||||
static void setup();
|
||||
static void loop();
|
||||
|
||||
private:
|
||||
static EthernetInterface * singleton;
|
||||
bool connected;
|
||||
EthernetInterface();
|
||||
void loop2();
|
||||
EthernetServer * server;
|
||||
EthernetClient clients[MAX_SOCK_NUM]; // accept up to MAX_SOCK_NUM client connections at the same time; This depends on the chipset used on the Shield
|
||||
uint8_t buffer[MAX_ETH_BUFFER+1]; // buffer used by TCP for the recv
|
||||
RingStream * outboundRing;
|
||||
public:
|
||||
static void setup();
|
||||
static void loop();
|
||||
|
||||
private:
|
||||
static EthernetInterface * singleton;
|
||||
bool connected;
|
||||
EthernetInterface();
|
||||
~EthernetInterface();
|
||||
void loop2();
|
||||
bool checkLink();
|
||||
|
||||
EthernetServer *server = nullptr;
|
||||
EthernetClient clients[MAX_SOCK_NUM]; // accept up to MAX_SOCK_NUM client connections at the same time
|
||||
// This depends on the chipset used on the Shield
|
||||
uint8_t buffer[MAX_ETH_BUFFER+1]; // buffer used by TCP for the recv
|
||||
RingStream * outboundRing = nullptr;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@@ -1 +1 @@
|
||||
#define GITHUB_SHA "35f7ac3"
|
||||
#define GITHUB_SHA "a26d988"
|
||||
|
@@ -72,7 +72,7 @@ void I2CManagerClass::I2C_sendStart() {
|
||||
bytesToReceive = currentRequest->readLen;
|
||||
|
||||
// If anything to send, initiate write. Otherwise initiate read.
|
||||
if (operation == OPERATION_READ || ((operation == OPERATION_REQUEST) & !bytesToSend))
|
||||
if (operation == OPERATION_READ || ((operation == OPERATION_REQUEST) && !bytesToSend))
|
||||
TWI0.MADDR = (currentRequest->i2cAddress << 1) | 1;
|
||||
else
|
||||
TWI0.MADDR = (currentRequest->i2cAddress << 1) | 0;
|
||||
|
@@ -94,22 +94,24 @@ uint8_t I2CManagerClass::read(uint8_t address, uint8_t readBuffer[], uint8_t rea
|
||||
/***************************************************************************
|
||||
* Function to queue a request block and initiate operations.
|
||||
*
|
||||
* For the Wire version, this executes synchronously, but the status is
|
||||
* returned in the I2CRB as for the asynchronous version.
|
||||
* For the Wire version, this executes synchronously.
|
||||
* The read/write/write_P functions return I2C_STATUS_OK always, and the
|
||||
* completion status of the operation is in the request block, as for
|
||||
* the non-blocking version.
|
||||
***************************************************************************/
|
||||
void I2CManagerClass::queueRequest(I2CRB *req) {
|
||||
switch (req->operation) {
|
||||
case OPERATION_READ:
|
||||
req->status = read(req->i2cAddress, req->readBuffer, req->readLen, NULL, 0, req);
|
||||
read(req->i2cAddress, req->readBuffer, req->readLen, NULL, 0, req);
|
||||
break;
|
||||
case OPERATION_SEND:
|
||||
req->status = write(req->i2cAddress, req->writeBuffer, req->writeLen, req);
|
||||
write(req->i2cAddress, req->writeBuffer, req->writeLen, req);
|
||||
break;
|
||||
case OPERATION_SEND_P:
|
||||
req->status = write_P(req->i2cAddress, req->writeBuffer, req->writeLen, req);
|
||||
write_P(req->i2cAddress, req->writeBuffer, req->writeLen, req);
|
||||
break;
|
||||
case OPERATION_REQUEST:
|
||||
req->status = read(req->i2cAddress, req->readBuffer, req->readLen, req->writeBuffer, req->writeLen, req);
|
||||
read(req->i2cAddress, req->readBuffer, req->readLen, req->writeBuffer, req->writeLen, req);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@@ -114,7 +114,6 @@ void PCA9685::_begin() {
|
||||
// Device-specific write function, invoked from IODevice::write().
|
||||
// For this function, the configured profile is used.
|
||||
void PCA9685::_write(VPIN vpin, int value) {
|
||||
if (_deviceState == DEVSTATE_FAILED) return;
|
||||
#ifdef DIAG_IO
|
||||
DIAG(F("PCA9685 Write Vpin:%d Value:%d"), vpin, value);
|
||||
#endif
|
||||
@@ -125,7 +124,10 @@ void PCA9685::_write(VPIN vpin, int value) {
|
||||
if (s != NULL) {
|
||||
// Use configured parameters
|
||||
_writeAnalogue(vpin, value ? s->activePosition : s->inactivePosition, s->profile, s->duration);
|
||||
} // else { /* ignorethe request */ }
|
||||
} else {
|
||||
/* simulate digital pin on PWM */
|
||||
_writeAnalogue(vpin, value ? 4095 : 0, Instant | NoPowerOff, 0);
|
||||
}
|
||||
}
|
||||
|
||||
// Device-specific writeAnalogue function, invoked from IODevice::writeAnalogue().
|
||||
@@ -139,11 +141,11 @@ void PCA9685::_write(VPIN vpin, int value) {
|
||||
// 4 (Bounce) Servo 'bounces' at extremes.
|
||||
//
|
||||
void PCA9685::_writeAnalogue(VPIN vpin, int value, uint8_t profile, uint16_t duration) {
|
||||
if (_deviceState == DEVSTATE_FAILED) return;
|
||||
#ifdef DIAG_IO
|
||||
DIAG(F("PCA9685 WriteAnalogue Vpin:%d Value:%d Profile:%d Duration:%d"),
|
||||
vpin, value, profile, duration);
|
||||
DIAG(F("PCA9685 WriteAnalogue Vpin:%d Value:%d Profile:%d Duration:%d %S"),
|
||||
vpin, value, profile, duration, _deviceState == DEVSTATE_FAILED?F("DEVSTATE_FAILED"):F(""));
|
||||
#endif
|
||||
if (_deviceState == DEVSTATE_FAILED) return;
|
||||
int pin = vpin - _firstVpin;
|
||||
if (value > 4095) value = 4095;
|
||||
else if (value < 0) value = 0;
|
||||
@@ -153,10 +155,10 @@ void PCA9685::_writeAnalogue(VPIN vpin, int value, uint8_t profile, uint16_t dur
|
||||
// Servo pin not configured, so configure now using defaults
|
||||
s = _servoData[pin] = (struct ServoData *) calloc(sizeof(struct ServoData), 1);
|
||||
if (s == NULL) return; // Check for memory allocation failure
|
||||
s->activePosition = 0;
|
||||
s->activePosition = 4095;
|
||||
s->inactivePosition = 0;
|
||||
s->currentPosition = value;
|
||||
s->profile = Instant; // Use instant profile (but not this time)
|
||||
s->profile = Instant | NoPowerOff; // Use instant profile (but not this time)
|
||||
}
|
||||
|
||||
// Animated profile. Initiate the appropriate action.
|
||||
|
346
IO_VCNL4040.h
Normal file
346
IO_VCNL4040.h
Normal file
@@ -0,0 +1,346 @@
|
||||
/*
|
||||
* © 2023, Fred Decker. All rights reserved.
|
||||
*
|
||||
* This file is part of DCC++EX API
|
||||
*
|
||||
* This is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* It is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with CommandStation. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The VCNL4040 is a combination IR proximity sensor (PS) and ambient light sensor
|
||||
* (ALS) with a distance sensing range limit of 20cm (about 7.5 inches) and an
|
||||
* ambient light sensing range of 0.0125 to 6553 lux. For object (train) detection
|
||||
* purposes, we are only supporting the proximity features of the sensor.
|
||||
*
|
||||
* Can set:
|
||||
*
|
||||
* led duty cycle: 40, 80, 160, 320ms (???)
|
||||
* led drive current: 200 (Affects led brightness, therefore distance and sensitivity)
|
||||
* persistence: (higher values reduce false triggers)
|
||||
*
|
||||
* The basic PS function settings, such as duty ratio, integration time,interrupt,
|
||||
* and PS enable / disable, and persistence, are handled by the register: PS_CONF1.
|
||||
* Duty ratio controls the PS response time. Integration time represents the duration
|
||||
* of the energy being received. The interrupt is triggered when the PS detection
|
||||
* levels over the high threshold level setting (register: PS_THDH) or lower than
|
||||
* low threshold (register: PS_THDL). If the interrupt function is enabled, the host
|
||||
* can react to the interrupt pin, instead of polling the PS data registers. The INT
|
||||
* flag (register:INT_Flag) indicates the type of interrupt that has been triggered,
|
||||
* depending on the interrupt settings in the configuration registers. PS persistence
|
||||
* (PS_PERS) sets up the PS INT trigger conditions, defining the amount of consecutive
|
||||
* hits required before an interrupt event occurs. The intelligent cancellation level
|
||||
* can be set on register: PS_CANC to reduce the cross talk phenomenon.
|
||||
* VCNL4040 also supports an easy to use proximity detection logic mode, that triggers
|
||||
* when the PS high threshold is exceeded and automatically resets the interrupt pin
|
||||
* when the proximity reading falls beneath the PS low threshold. This functionality
|
||||
* can be set in the register: PS_MS. A smart persistence is provided to be able to
|
||||
* prevent false PS interrupt trigger events. Descriptions of each of these parameters
|
||||
* are shown in table 1.
|
||||
*
|
||||
* REGISTER: PS_CONF1 COMMAND CODE: 0x03_L (0x03 DATA BYTE LOW)
|
||||
* Command Bit Description
|
||||
* PS_Duty 7 : 6 (0 : 0) = 1/40, (0 : 1) = 1/80, (1 : 0) = 1/160, (1 : 1) = 1/320
|
||||
* PS IRED on / off duty ratio setting
|
||||
* PS_PERS 5 : 4 (0 : 0) = 1, (0 : 1) = 2, (1 : 0) = 3, (1 : 1) = 4
|
||||
* PS interrupt persistence setting
|
||||
* PS_ IT 3 : 1 (0 : 0 : 0) = 1T, (0 : 0 : 1) = 1.5T, (0 : 1 : 0) = 2T, (0 : 1 : 1) = 2.5T
|
||||
* (1 : 0 : 0) = 3T, (1 : 0 : 1) = 3.5T, (1 : 1 : 0) = 4T, (1 : 1 : 1) = 8T
|
||||
* PS integration time setting
|
||||
* PS_SD 0 0 = PS power on, 1 = PS shut down, default = 1
|
||||
*
|
||||
* REGISTER: PS_CONF2 COMMAND CODE: 0x03_H (0x03 DATA BYTE HIGH)
|
||||
* PS_HD 3 0 = PS output is 12 bits; 1 = PS output is 16 bits
|
||||
* Reserved 2 Default = 0
|
||||
* PS_INT 1 : 0 (0 : 0) = interrupt disable, (0 : 1) = trigger when close,
|
||||
* (1 : 0)= trigger when away, (1 : 1)= trigger when close or away
|
||||
*
|
||||
* NOTE: fnd stopped here
|
||||
* the reflection of the pulse. The time between the pulse and the receipt of reflections
|
||||
* is measured and used to determine the distance to the reflecting object.
|
||||
*
|
||||
* For economy of memory and processing time, this driver includes only part of the code
|
||||
* that ST provide in their API. Also, the API code isn't very clear and it is not easy
|
||||
* to identify what operations are useful and what are not.
|
||||
* The operation shown here doesn't include any calibration, so is probably not as accurate
|
||||
* as using the full driver, but it's probably accurate enough for the purpose.
|
||||
*
|
||||
* The device driver allocates up to 3 vpins to the device. A digital read on the first pin
|
||||
* will return a value that indicates whether the object is within the threshold range (1)
|
||||
* or not (0). An analogue read on the first pin returns the last measured distance (in mm),
|
||||
* the second pin returns the signal strength, and the third pin returns detected
|
||||
* ambient light level. By default the device takes around 60ms to complete a ranging
|
||||
* operation, so we do a 100ms cycle (10 samples per second).
|
||||
*
|
||||
* The VL53L0X is initially set to respond to I2C address 0x29. If you only have one module,
|
||||
* you can use this address. However, the address can be modified by software. If
|
||||
* you select another address, that address will be written to the device and used until the device is reset.
|
||||
*
|
||||
* If you have more than one module, then you will need to specify a digital VPIN (Arduino
|
||||
* digital output or I/O extender pin) which you connect to the module's XSHUT pin. Now,
|
||||
* when the device driver starts, the XSHUT pin is set LOW to turn the module off. Once
|
||||
* all VL53L0X modules are turned off, the driver works through each module in turn by
|
||||
* setting XSHUT to HIGH to turn the module on,, then writing the module's desired I2C address.
|
||||
* In this way, many VL53L0X modules can be connected to the one I2C bus, each one
|
||||
* using a distinct I2C address.
|
||||
*
|
||||
* WARNING: If the device's XSHUT pin is not connected, then it is very prone to noise,
|
||||
* and the device may even reset when handled. If you're not using XSHUT, then it's
|
||||
* best to tie it to +5V.
|
||||
*
|
||||
* The driver is configured as follows:
|
||||
*
|
||||
* Single VL53L0X module:
|
||||
* VL53L0X::create(firstVpin, nPins, i2cAddress, lowThreshold, highThreshold);
|
||||
* Where firstVpin is the first vpin reserved for reading the device,
|
||||
* nPins is 1, 2 or 3,
|
||||
* i2cAddress is the address of the device (normally 0x29),
|
||||
* lowThreshold is the distance at which the digital vpin state is set to 1 (in mm),
|
||||
* and highThreshold is the distance at which the digital vpin state is set to 0 (in mm).
|
||||
*
|
||||
* Multiple VL53L0X modules:
|
||||
* VL53L0X::create(firstVpin, nPins, i2cAddress, lowThreshold, highThreshold, xshutPin);
|
||||
* ...
|
||||
* Where firstVpin is the first vpin reserved for reading the device,
|
||||
* nPins is 1, 2 or 3,
|
||||
* i2cAddress is the address of the device (any valid address except 0x29),
|
||||
* lowThreshold is the distance at which the digital vpin state is set to 1 (in mm),
|
||||
* highThreshold is the distance at which the digital vpin state is set to 0 (in mm),
|
||||
* and xshutPin is the VPIN number corresponding to a digital output that is connected to the
|
||||
* XSHUT terminal on the module.
|
||||
*
|
||||
* Example:
|
||||
* In mySetup function within mySetup.cpp:
|
||||
* VL53L0X::create(4000, 3, 0x29, 200, 250);
|
||||
* Sensor::create(4000, 4000, 0); // Create a sensor
|
||||
*
|
||||
* When an object comes within 200mm of the sensor, a message
|
||||
* <Q 4000>
|
||||
* will be sent over the serial USB, and when the object moves more than 250mm from the sensor,
|
||||
* a message
|
||||
* <q 4000>
|
||||
* will be sent.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef IO_VCNL4040_h
|
||||
#define IO_VCNL4040_h
|
||||
|
||||
#include "IODevice.h"
|
||||
|
||||
class VCNL4040 : public IODevice {
|
||||
private:
|
||||
uint8_t _i2cAddress;
|
||||
uint16_t _ambient;
|
||||
uint16_t _distance;
|
||||
uint16_t _signal;
|
||||
uint16_t _onThreshold;
|
||||
uint16_t _offThreshold;
|
||||
VPIN _xshutPin;
|
||||
bool _value;
|
||||
uint8_t _nextState = 0;
|
||||
I2CRB _rb;
|
||||
uint8_t _inBuffer[12];
|
||||
uint8_t _outBuffer[2];
|
||||
// State machine states.
|
||||
enum : uint8_t {
|
||||
STATE_INIT = 0,
|
||||
STATE_CONFIGUREADDRESS = 1,
|
||||
STATE_SKIP = 2,
|
||||
STATE_CONFIGUREDEVICE = 3,
|
||||
STATE_INITIATESCAN = 4,
|
||||
STATE_CHECKSTATUS = 5,
|
||||
STATE_GETRESULTS = 6,
|
||||
STATE_DECODERESULTS = 7,
|
||||
};
|
||||
|
||||
// Register addresses
|
||||
enum : uint8_t {
|
||||
VL53L0X_REG_SYSRANGE_START=0x00,
|
||||
VL53L0X_REG_RESULT_INTERRUPT_STATUS=0x13,
|
||||
VL53L0X_REG_RESULT_RANGE_STATUS=0x14,
|
||||
VL53L0X_CONFIG_PAD_SCL_SDA__EXTSUP_HV=0x89,
|
||||
VL53L0X_REG_I2C_SLAVE_DEVICE_ADDRESS=0x8A,
|
||||
};
|
||||
const uint8_t VL53L0X_I2C_DEFAULT_ADDRESS=0x29;
|
||||
|
||||
public:
|
||||
VL53L0X(VPIN firstVpin, int nPins, uint8_t i2cAddress, uint16_t onThreshold, uint16_t offThreshold, VPIN xshutPin = VPIN_NONE) {
|
||||
_firstVpin = firstVpin;
|
||||
_nPins = min(nPins, 3);
|
||||
_i2cAddress = i2cAddress;
|
||||
_onThreshold = onThreshold;
|
||||
_offThreshold = offThreshold;
|
||||
_xshutPin = xshutPin;
|
||||
_value = 0;
|
||||
addDevice(this);
|
||||
}
|
||||
static void create(VPIN firstVpin, int nPins, uint8_t i2cAddress, uint16_t onThreshold, uint16_t offThreshold, VPIN xshutPin = VPIN_NONE) {
|
||||
new VL53L0X(firstVpin, nPins, i2cAddress, onThreshold, offThreshold, xshutPin);
|
||||
}
|
||||
|
||||
protected:
|
||||
void _begin() override {
|
||||
if (_xshutPin == VPIN_NONE) {
|
||||
// Check if device is already responding on the nominated address.
|
||||
if (I2CManager.exists(_i2cAddress)) {
|
||||
// Yes, it's already on this address, so skip the address initialisation.
|
||||
_nextState = STATE_CONFIGUREDEVICE;
|
||||
} else {
|
||||
_nextState = STATE_INIT;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void _loop(unsigned long currentMicros) override {
|
||||
uint8_t status;
|
||||
switch (_nextState) {
|
||||
case STATE_INIT:
|
||||
// On first entry to loop, reset this module by pulling XSHUT low. All modules
|
||||
// will be reset in turn.
|
||||
if (_xshutPin != VPIN_NONE) IODevice::write(_xshutPin, 0);
|
||||
_nextState = STATE_CONFIGUREADDRESS;
|
||||
break;
|
||||
case STATE_CONFIGUREADDRESS:
|
||||
// On second entry, set XSHUT pin high to allow the module to restart.
|
||||
// On the module, there is a diode in series with the XSHUT pin to
|
||||
// protect the low-voltage pin against +5V.
|
||||
if (_xshutPin != VPIN_NONE) IODevice::write(_xshutPin, 1);
|
||||
// Allow the module time to restart
|
||||
delay(10);
|
||||
// Then write the desired I2C address to the device, while this is the only
|
||||
// module responding to the default address.
|
||||
I2CManager.write(VL53L0X_I2C_DEFAULT_ADDRESS, 2, VL53L0X_REG_I2C_SLAVE_DEVICE_ADDRESS, _i2cAddress);
|
||||
_nextState = STATE_SKIP;
|
||||
break;
|
||||
case STATE_SKIP:
|
||||
// Do nothing on the third entry.
|
||||
_nextState = STATE_CONFIGUREDEVICE;
|
||||
break;
|
||||
case STATE_CONFIGUREDEVICE:
|
||||
// On next entry, check if device address has been set.
|
||||
if (I2CManager.exists(_i2cAddress)) {
|
||||
#ifdef DIAG_IO
|
||||
_display();
|
||||
#endif
|
||||
// Set 2.8V mode
|
||||
write_reg(VL53L0X_CONFIG_PAD_SCL_SDA__EXTSUP_HV,
|
||||
read_reg(VL53L0X_CONFIG_PAD_SCL_SDA__EXTSUP_HV) | 0x01);
|
||||
} else {
|
||||
DIAG(F("VL53L0X I2C:x%x device not responding"), _i2cAddress);
|
||||
_deviceState = DEVSTATE_FAILED;
|
||||
}
|
||||
_nextState = STATE_INITIATESCAN;
|
||||
break;
|
||||
case STATE_INITIATESCAN:
|
||||
// Not scanning, so initiate a scan
|
||||
_outBuffer[0] = VL53L0X_REG_SYSRANGE_START;
|
||||
_outBuffer[1] = 0x01;
|
||||
I2CManager.write(_i2cAddress, _outBuffer, 2, &_rb);
|
||||
_nextState = STATE_CHECKSTATUS;
|
||||
break;
|
||||
case STATE_CHECKSTATUS:
|
||||
status = _rb.status;
|
||||
if (status == I2C_STATUS_PENDING) return; // try next time
|
||||
if (status != I2C_STATUS_OK) {
|
||||
DIAG(F("VL53L0X I2C:x%x Error:%d %S"), _i2cAddress, status, I2CManager.getErrorMessage(status));
|
||||
_deviceState = DEVSTATE_FAILED;
|
||||
_value = false;
|
||||
} else
|
||||
_nextState = 2;
|
||||
delayUntil(currentMicros + 95000); // wait for 95 ms before checking.
|
||||
_nextState = STATE_GETRESULTS;
|
||||
break;
|
||||
case STATE_GETRESULTS:
|
||||
// Ranging completed. Request results
|
||||
_outBuffer[0] = VL53L0X_REG_RESULT_RANGE_STATUS;
|
||||
I2CManager.read(_i2cAddress, _inBuffer, 12, _outBuffer, 1, &_rb);
|
||||
_nextState = 3;
|
||||
delayUntil(currentMicros + 5000); // Allow 5ms to get data
|
||||
_nextState = STATE_DECODERESULTS;
|
||||
break;
|
||||
case STATE_DECODERESULTS:
|
||||
// If I2C write still busy, return.
|
||||
status = _rb.status;
|
||||
if (status == I2C_STATUS_PENDING) return; // try again next time
|
||||
if (status == I2C_STATUS_OK) {
|
||||
if (!(_inBuffer[0] & 1)) return; // device still busy
|
||||
uint8_t deviceRangeStatus = ((_inBuffer[0] & 0x78) >> 3);
|
||||
if (deviceRangeStatus == 0x0b) {
|
||||
// Range status OK, so use data
|
||||
_ambient = makeuint16(_inBuffer[7], _inBuffer[6]);
|
||||
_signal = makeuint16(_inBuffer[9], _inBuffer[8]);
|
||||
_distance = makeuint16(_inBuffer[11], _inBuffer[10]);
|
||||
if (_distance <= _onThreshold)
|
||||
_value = true;
|
||||
else if (_distance > _offThreshold)
|
||||
_value = false;
|
||||
}
|
||||
}
|
||||
// Completed. Restart scan on next loop entry.
|
||||
_nextState = STATE_INITIATESCAN;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// For analogue read, first pin returns distance, second pin is signal strength, and third is ambient level.
|
||||
int _readAnalogue(VPIN vpin) override {
|
||||
int pin = vpin - _firstVpin;
|
||||
switch (pin) {
|
||||
case 0:
|
||||
return _distance;
|
||||
case 1:
|
||||
return _signal;
|
||||
case 2:
|
||||
return _ambient;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
// For digital read, return zero for all but first pin.
|
||||
int _read(VPIN vpin) override {
|
||||
if (vpin == _firstVpin)
|
||||
return _value;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
void _display() override {
|
||||
DIAG(F("VL53L0X I2C:x%x Configured on Vpins:%d-%d On:%dmm Off:%dmm %S"),
|
||||
_i2cAddress, _firstVpin, _firstVpin+_nPins-1, _onThreshold, _offThreshold,
|
||||
(_deviceState==DEVSTATE_FAILED) ? F("OFFLINE") : F(""));
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
inline uint16_t makeuint16(byte lsb, byte msb) {
|
||||
return (((uint16_t)msb) << 8) | lsb;
|
||||
}
|
||||
uint8_t write_reg(uint8_t reg, uint8_t data) {
|
||||
// write byte to register
|
||||
uint8_t outBuffer[2];
|
||||
outBuffer[0] = reg;
|
||||
outBuffer[1] = data;
|
||||
return I2CManager.write(_i2cAddress, outBuffer, 2);
|
||||
}
|
||||
uint8_t read_reg(uint8_t reg) {
|
||||
// read byte from register and return value
|
||||
I2CManager.read(_i2cAddress, _inBuffer, 1, ®, 1);
|
||||
return _inBuffer[0];
|
||||
}
|
||||
};
|
||||
|
||||
#endif // IO_VL53L0X_h
|
8
LCN.cpp
8
LCN.cpp
@@ -43,14 +43,18 @@ void LCN::loop() {
|
||||
|
||||
while (stream->available()) {
|
||||
int ch = stream->read();
|
||||
if (ch >= 0 && ch <= '9') { // accumulate id value
|
||||
if (ch >= '0' && ch <= '9') { // accumulate id value
|
||||
id = 10 * id + ch - '0';
|
||||
}
|
||||
else if (ch == 't' || ch == 'T') { // Turnout opcodes
|
||||
if (Diag::LCN) DIAG(F("LCN IN %d%c"),id,(char)ch);
|
||||
if (!Turnout::exists(id)) LCNTurnout::create(id);
|
||||
Turnout::setClosedStateOnly(id,ch=='t');
|
||||
Turnout::turnoutlistHash++; // signals ED update of turnout data
|
||||
id = 0;
|
||||
}
|
||||
else if (ch == 'y' || ch == 'Y') { // Turnout opcodes
|
||||
if (Diag::LCN) DIAG(F("LCN IN %d%c"),id,(char)ch);
|
||||
Turnout::setClosed(id,ch=='y');
|
||||
id = 0;
|
||||
}
|
||||
else if (ch == 'S' || ch == 's') {
|
||||
|
@@ -152,16 +152,16 @@ int MotorDriver::getCurrentRaw() {
|
||||
bool irq = disableInterrupts();
|
||||
current = analogRead(currentPin)-senseOffset;
|
||||
enableInterrupts(irq);
|
||||
#elif defined(ARDUINO_TEENSY32) || defined(ARDUINO_TEENSY35)|| defined(ARDUINO_TEENSY36)
|
||||
#else // Uno, Mega and all the TEENSY3* but not TEENSY4*
|
||||
unsigned char sreg_backup;
|
||||
sreg_backup = SREG; /* save interrupt enable/disable state */
|
||||
cli();
|
||||
current = analogRead(currentPin)-senseOffset;
|
||||
#if defined(ARDUINO_TEENSY32) || defined(ARDUINO_TEENSY35)|| defined(ARDUINO_TEENSY36)
|
||||
overflow_count = 0;
|
||||
SREG = sreg_backup; /* restore interrupt state */
|
||||
#else
|
||||
current = analogRead(currentPin)-senseOffset;
|
||||
#endif
|
||||
if (sreg_backup & 128) sei(); /* restore interrupt state */
|
||||
#endif // outer #
|
||||
if (current<0) current=0-current;
|
||||
if ((faultPin != UNUSED_PIN) && isLOW(fastFaultPin) && isHIGH(fastPowerPin))
|
||||
return (current == 0 ? -1 : -current);
|
||||
|
@@ -50,6 +50,12 @@
|
||||
new MotorDriver(3, 12, UNUSED_PIN, UNUSED_PIN, A0, 2.99, 2000, UNUSED_PIN), \
|
||||
new MotorDriver(11, 13, UNUSED_PIN, UNUSED_PIN, A1, 2.99, 2000, UNUSED_PIN)
|
||||
|
||||
// DCC-EX TI DRV8874 based motor shield
|
||||
// This motor shield has reverse sense fault pins thus the -A4 and -A5 pin values.
|
||||
#define EX8874_SHIELD F("EX8874"), \
|
||||
new MotorDriver( 3, 12, UNUSED_PIN, 9, A0, 4.86, 5000, A4), \
|
||||
new MotorDriver(11, 13, UNUSED_PIN, 8, A1, 4.86, 5000, A5)
|
||||
|
||||
// Pololu Motor Shield
|
||||
#define POLOLU_MOTOR_SHIELD F("POLOLU_MOTOR_SHIELD"), \
|
||||
new MotorDriver( 9, 7, UNUSED_PIN, -4, A0, 18, 3000, 12), \
|
||||
|
@@ -22,7 +22,7 @@ Both CommandStation-EX and BaseStation-Classic support much of the NMRA Digital
|
||||
|
||||
# What’s in this Repository?
|
||||
|
||||
This repository, CommandStation-EX, contains a complete DCC++ EX Commmand Station sketch designed for compiling and uploading into an Arduino Uno, Mega, or Nano. All sketch files are in the folder named CommandStation-EX and its subforlders.
|
||||
This repository, CommandStation-EX, contains a complete DCC++ EX Commmand Station sketch designed for compiling and uploading into an Arduino Uno, Mega, or Nano.
|
||||
|
||||
To utilize this sketch, you can use the following:
|
||||
|
||||
@@ -69,7 +69,7 @@ in config.h.
|
||||
* Automatic slot (register) management
|
||||
* Automation (coming soon)
|
||||
|
||||
NOTE: DCC-EX is a major rewrite to the code. We started over and rebuilt it from the ground up! For what that means to you, click [HERE](notes/rewrite.md).
|
||||
NOTE: DCC-EX is a major rewrite to the code. We started over and rebuilt it from the ground up! For what that means, you can read [HERE](https://dcc-ex.com/about/rewrite.html).
|
||||
|
||||
# More information
|
||||
You can learn more at the [DCC++ EX website](https://dcc-ex.com/)
|
||||
|
77
Release_Notes/ThrottleAssists.md
Normal file
77
Release_Notes/ThrottleAssists.md
Normal file
@@ -0,0 +1,77 @@
|
||||
Throttle Assist updates for versiuon 4.?
|
||||
|
||||
Chris Harlow April 2022
|
||||
|
||||
There are a number of additional throttle information commands that have been implemented to assist throttle authors to obtain information from the Command Station in order to implement turnout, route/automation and roster features which are already found in the Withrottle implementations.
|
||||
These commands are new and not overlapped with the existing commands which are probabaly due to be obsoleted as they are over complex and unfit for purpose.
|
||||
|
||||
# Turnouts
|
||||
|
||||
The conventional turnout definition commands and the ```<H>``` responses do not contain information about the turnout description which may have been provided in an EXRAIL script. A turnout description is much more user friendly than the cryptic "T123", and having a list helps the throttle UI build a suitable set of buttons.
|
||||
|
||||
```<JT>``` command returns a list of turnout ids. The throttle should be uninterested in the turnout technology used but needs to know the ids it can throw/close and monitor the current state.
|
||||
e.g. response ```<jT 1 17 22 19>```
|
||||
|
||||
```<JT 17>``` requests info on turnout 17\
|
||||
e.g. response ```<jT 17 T "Coal yard exit">``` or ```<jT 17 C "Coal yard exit">```\
|
||||
(T=thrown, C=closed)\
|
||||
or ```<jT 17 C "">``` indicating turnout description not given.\
|
||||
or ```<jT 17 X>``` indicating turnout unknown (or possibly hidden.)
|
||||
|
||||
Note: It is still the throttles responsibility to monitor the status broadcasts.\
|
||||
(TBD I'm thinking that the existing broadcast is messy and needs cleaning up)\
|
||||
However, I'm not keen on dynamically created/deleted turnouts so I have no intention of providing a command that indicates the turnout list has been updated since the throttle started.
|
||||
Also note that turnouts marked in EXRAIL with the HIDDEN keyword instead of a "description" will NOT show up in these commands.
|
||||
|
||||
# Automations/Routes
|
||||
|
||||
A throttle need to know which EXRAIL Automations and Routes it can show the user.
|
||||
|
||||
```<JA>``` Returns a list of Automations/Routes\
|
||||
e.g. ```<jA 13 16 23>```\
|
||||
Indicates route/automation ids.\
|
||||
Information on each route needs to be obtained by\
|
||||
```<JA 13>```\
|
||||
returns e.g. ```<jA 13 R "description">``` for a route\
|
||||
or ```<jA 13 A "description">``` for an automation.\
|
||||
or ```<jA 13 X>``` for id not found
|
||||
|
||||
## What's the difference?
|
||||
|
||||
A *Route* is just a call to an **EXRAIL ROUTE**, traditionally to set some turnouts or signals but can be used to perform any kind of EXRAIL function... but its not expecting to know the loco.
|
||||
|
||||
Thus, a route can be triggered by sending in for example ```</START 13>```.
|
||||
|
||||
An *Automation* is a handoff of the last accessed loco id to an EXRAIL AUTOMATION which would typically drive the loco away.
|
||||
|
||||
Thus an Automation expects a start command with a cab id\
|
||||
e.g. ```</START 13 3>```
|
||||
|
||||
### Roster Information
|
||||
|
||||
The ```<JR>``` command requests a list of cab ids from the roster\
|
||||
e.g. responding ```<jR 3 200 6336>```\
|
||||
or <jR> for none.
|
||||
|
||||
Each Roster entry had a name and function map obtained by:\
|
||||
```<JR 200>``` reply like ```<jR 200 "Thomas" "whistle/*bell/squeal/panic">
|
||||
|
||||
Refer to EXRAIL ROSTER command for function map format.
|
||||
|
||||
### Obtaining throttle status
|
||||
|
||||
```<t cabid>``` Requests a deliberate update on the cab speed/functions in the same format as the cab broadcast\
|
||||
```<l cabid slot speedbyte functionMap>```
|
||||
|
||||
Note that a slot of -1 indicates that the cab is not in the reminders table and this comand will not reserve a slot until such time as the cab is throttled.
|
||||
|
||||
# COMMANDS TO AVOID
|
||||
|
||||
```<f cab func1 func2>``` Instead Use ```<F cab function 1/0>```\
|
||||
```<t slot cab speed dir>``` Just drop the slot number\
|
||||
```<T commands>``` other than ```<T id 0/1>```\
|
||||
```<s>```\
|
||||
```<c>```
|
||||
|
||||
|
||||
|
284
Release_Notes/release_notes_v4.0.0.md
Normal file
284
Release_Notes/release_notes_v4.0.0.md
Normal file
@@ -0,0 +1,284 @@
|
||||
Version 4.0 Release Notes
|
||||
*************************
|
||||
|
||||
The DCC-EX Team is pleased to release CommandStation-EX-v4.0.0 as a Production Release. Release v4.0.0 is a Major release that adds significant new product design, plus Automation features and bug fixes. The team continues improving the architecture of DCC++EX to make it more flexible and optimizing the code so as to get more performance from the Arduino (and other) microprocessors. This release includes all of the Point Releases from v3.2.0 to v3.2.0 rc13.
|
||||
|
||||
**Downloads (zip and tar.gz) below. These are named without version number in the folder name to make the Arduino IDE happy.**
|
||||
|
||||
[CommandStation-EX.zip](https://github.com/DCC-EX/CommandStation-EX/releases/download/v4.0.0-Prod/CommandStation-EX.zip)
|
||||
|
||||
|
||||
[CommandStation-EX.tar.gz](https://github.com/DCC-EX/CommandStation-EX/releases/download/v0.0.0-Prod/CommandStation-EX.tar.gz)
|
||||
|
||||
**Known Issues**
|
||||
|
||||
- **Wi-Fi** - Requires sending `<AT>` commands from a serial monitor if you want to switch between AP mode and STA station mode after initial setup
|
||||
- **Pololu Motor Shield** - is supported with this release, but the user may have to adjust timings to enable programming mode due to limitations in its current sensing circuitry
|
||||
|
||||
**All New Major DCC++EX 4.0.0 features**
|
||||
|
||||
- **New HAL Hardware Abstraction Layer API** that automatically detects and greatly simplifies interfacing to many predefined accessory boards for servos, signals & sensors and added I/O (digital and analog inputs and outputs, servos etc).
|
||||
- HAL Support for;
|
||||
- MCP23008, MCP23017 and PCF9584 I2C GPIO Extender modules.
|
||||
- PCA9685 PWM (servo & signal) control modules.
|
||||
- Analogue inputs on Arduino pins and on ADS111x I2C modules.
|
||||
- MP3 sound playback via DFPlayer module.
|
||||
- HC-SR04 Ultrasonic range sensor module.
|
||||
- VL53L0X Laser range sensor module (Time-Of-Flight).
|
||||
- A new `<D HAL SHOW>` command to list the HAL devices attached to the command station
|
||||
|
||||
**New Command Station Broadcast throttle logic**
|
||||
|
||||
- Synchronizes multiple WiThrottles and PC based JMRI Throttles for direction, speed and F-key updates
|
||||
|
||||
**New ‘Discovered Servers’ on WiFi Throttles**
|
||||
|
||||
- Our New multicast Dynamic Network Server (mDNS) enhancement allows us to display the available WiFi server connections to a DCC++EX Command Station. Selecting it allows your WiThrottle App to connect to and load Server Rosters and function keys to your throttle from the new DCC++EX Command Station Server Roster.
|
||||
|
||||
**New DCC++EX 4.0.0 with EX-RAIL Extended Railroad Automation Instruction Language**
|
||||
|
||||
- Use to control your entire layout or as a separate accessory/animation controller
|
||||
- Awesome, cleverly powerful yet simple user friendly scripting language for user built Automation & Routing scripts.
|
||||
- You can control Engines, Sensors, Turnouts, Signals, Outputs and Accessories that are entered into your new myAutomation.h file, then uploaded into the DCC++EX Command Station.
|
||||
- EX-RAIL scripts are automatically displayed as Automation {Handoff} and Route {Set} buttons on supported WiFi Throttle Apps.
|
||||
|
||||
**New EX-RAIL ‘Roster’ Feature**
|
||||
|
||||
- List and store user defined engine roster & function keys inside the command station, and automatically load them in WiFi Throttle Apps.
|
||||
- When choosing “DCC++EX” from discovered servers an Engine Driver or WiThrottle is directly connected to the Command Station.
|
||||
- The EX-RAIL ’ROSTER’ command allows all the engine numbers, names and function keys you’ve listed in your myAutomation.h file to automatically upload the Command Station's ‘Server Roster’ into your Engine Driver and WiThrottle Apps.
|
||||
|
||||
**New JMRI 4.99.2 and above specific DCC++EX 4.0 features**
|
||||
|
||||
- Enhanced JMRI DCC++ Configure Base Station pane for building and maintaining Sensor, Turnout and Output devices, or these can automatically be populated from the DCC++EX Command Station's mySetup.h file into JMRI.
|
||||
|
||||
- JMRI now supports multiple serial connected DCC++EX Command Stations, to display and track separate "Send DCC++ Command" and "DCC++ Traffic" Monitors for each Command Station at the same time.
|
||||
For example: Use an Uno DCC++EX DecoderPro Programming Station {DCC++Prg} on a desktop programming track and a second Mega DCC++EX EX-RAIL Command Station for Operations {DCC++Ops} on the layout with an additional `<JOINED>` programming spur or siding track for acquiring an engine and ‘Drive Away’ onto the mainline (see the DriveAway feature for more information).
|
||||
|
||||
**DCC++EX 4.0.0 additional product enhancements**
|
||||
|
||||
- Additional Motor Shields and Motor Board {boosters) supported
|
||||
- Additional Accessory boards supported for GPIO expansion, Sensors, Servos & Signals
|
||||
- Additional diagnostic commands like ‘D ACK RETRY’ and ‘D EXRAIL ON’ events, ‘D HAL SHOW’ devices and ‘D SERVO’ positions, and ‘D RESET’ the command station while maintaining the serial connection with JMRI
|
||||
- Automatic retry on failed ACK detection to give decoders another chance
|
||||
- New EX-RAIL ’/’ slash command allows JMRI to directly communicate with many EX-RAIL scripts
|
||||
- Turnout class revised to expand turnout capabilities and allow turnout names/descriptors to display in WiThrottle Apps.
|
||||
- Build turnouts through either or both mySetup.h and myAutomation.h files, and have them automatically passed to, and populate, JMRI Turnout Tables
|
||||
- Turnout user names display in Engine Driver & WiThrottles
|
||||
- Output class now allows ID > 255.
|
||||
- Configuration options to globally flip polarity of DCC Accessory states when driven from `<a>` command and `<T>` command.
|
||||
- Increased use of display for showing loco decoder programming information.
|
||||
- Can disable EEPROM memory code to allow room for DCC++EX 4.0 to fit on a Uno Command Station
|
||||
- Can define border between long and short addresses
|
||||
- Native non-blocking I2C drivers for AVR and Nano architectures (fallback to blocking Wire library for other platforms).
|
||||
- EEPROM layout change - deletes EEPROM contents on first start following upgrade.
|
||||
|
||||
**4.0.0 Bug Fixes**
|
||||
|
||||
- Compiles on Nano Every
|
||||
- Diagnostic display of ack pulses >32ms
|
||||
- Current read from wrong ADC during interrupt
|
||||
- AT(+) Command Pass Through
|
||||
- CiDAP WiFi Drop out and the WiThrottle F-key looping error corrected
|
||||
- One-off error in CIPSEND drop
|
||||
- Common Fault Pin Error
|
||||
- Uno Memory Utilization optimized
|
||||
|
||||
#### Summary of Release 3.1.0 key features and/or bug fixes by Point Release
|
||||
|
||||
**Summary of the key new features added to CommandStation-EX V3.0.16**
|
||||
|
||||
- Ignore CV1 bit 7 read if rejected by a non NMRA compliant decoder when identifying loco id
|
||||
|
||||
**Summary of the key new features added to CommandStation-EX V3.0.15**
|
||||
|
||||
- Send function commands just once instead of repeating them 4 times
|
||||
|
||||
**Summary of the key new features added to CommandStation-EX V3.0.14**
|
||||
|
||||
- Add feature to tolerate decoders that incorrectly have gaps in their ACK pulse
|
||||
- Provide proper track power management when joining and unjoining tracks with <1 JOIN>
|
||||
|
||||
**Summary of the key new features added to CommandStation-EX V3.0.13**
|
||||
|
||||
- Fix for CAB Functions greater than 127
|
||||
|
||||
**Summary of the key new features added to CommandStation-EX V3.0.12**
|
||||
|
||||
- Fixed clear screen issue for nanoEvery and nanoWifi
|
||||
|
||||
**Summary of the key new features added to CommandStation-EX V3.0.11**
|
||||
|
||||
- Reorganized files for support of 128 speed steps
|
||||
|
||||
**Summary of the key new features added to CommandStation-EX V3.0.10**
|
||||
|
||||
- Added Support for the Teensy 3.2, 3.5, 3.6, 4.0 and 4.1 MCUs
|
||||
- No functional change just changes to avoid complier warnings for Teensy/nanoEvery
|
||||
|
||||
**Summary of the key new features added to CommandStation-EX V3.0.9**
|
||||
|
||||
- Rearranges serial newlines for the benefit of JMRI
|
||||
- Major update for efficiencies in displays (LCD, OLED)
|
||||
- Add I2C Support functions
|
||||
|
||||
**Summary of the key new features added to CommandStation-EX V3.0.8**
|
||||
|
||||
- Wraps <* *> around DIAGS for the benefit of JMRI
|
||||
|
||||
**Summary of the key new features added to CommandStation-EX V3.0.7**
|
||||
|
||||
- Implemented support for older 28 apeed step decoders - Option to turn on 28 step speed decoders in addition to 128. If set, all locos will use 28 steps.
|
||||
- Improved overload messages with raw values (relative to offset)
|
||||
|
||||
**Summary of the key new features added to CommandStation-EX V3.0.6**
|
||||
|
||||
- Prevent compiler warning about deprecated B constants
|
||||
- Fix Bug that did not let us transmit 5 byte sized packets - 5 Byte commands like PoM (programming on main) were not being sent correctly
|
||||
- Support for Huge function numbers (DCC BinaryStateControl) - Support Functions beyond F28
|
||||
- <!> ESTOP all - New command to emergency stop all locos on the main track
|
||||
- <- [cab]> estop and forget cab/all cabs - Stop and remove loco from the CS. Stops the repeating throttle messages
|
||||
- `<D RESET>` command to reboot Arduino
|
||||
- Automatic sensor offset detect
|
||||
- Improved startup msgs from Motor Drivers (accuracy and auto sense factors)
|
||||
- Drop post-write verify - No need to double check CV writes. Writes are now even faster.
|
||||
- Allow current sense pin set to UNUSED_PIN - No need to ground an unused analog current pin. Produce startup warning and callback -2 for prog track cmds.
|
||||
|
||||
**Summary of the key new features added to CommandStation-EX V3.0.5**
|
||||
|
||||
- Fix Fn Key startup with loco ID and fix state change for F16-28
|
||||
- Removed ethernet mac config and made it automatic
|
||||
- Show wifi ip and port on lcd
|
||||
- Auto load config.example.h with warning
|
||||
- Dropped example .ino files
|
||||
- Corrected .ino comments
|
||||
- Add Pololu fault pin handling
|
||||
- Waveform speed/simplicity improvements
|
||||
- Improved pin speed in waveform
|
||||
- Portability to nanoEvery and UnoWifiRev2 CPUs
|
||||
- Analog read speed improvements
|
||||
- Drop need for DIO2 library
|
||||
- Improved current check code
|
||||
- Linear command
|
||||
- Removed need for ArduinoTimers files
|
||||
- Removed option to choose different timer
|
||||
- Added EX-RAIL hooks for automation in future version
|
||||
- Fixed Turnout list
|
||||
- Allow command keywords in mixed case
|
||||
- Dropped unused memstream
|
||||
- PWM pin accuracy if requirements met
|
||||
|
||||
**Summary of the key new features added to CommandStation-EX V3.0.4**
|
||||
|
||||
- "Drive-Away" Feature - added so that throttles like Engine Driver can allow a loco to be programmed on a usable, electrically isolated programming track and then drive off onto the main track
|
||||
- WiFi Startup Fixes
|
||||
|
||||
**Summary of the key new features added to CommandStation-EX V3.0.3**
|
||||
|
||||
- Command to write loco address and clear consist
|
||||
- Command will allow for consist address
|
||||
- Startup commands implemented
|
||||
|
||||
**Summary of the key new features added to CommandStation-EX V3.0.2:**
|
||||
|
||||
- Create new output for current in mA for `<c>` command - New current response outputs current in mA, overlimit current, and maximum board capable current
|
||||
- Simultaneously update JMRI to handle new current meter
|
||||
|
||||
**Summary of the key new features added to CommandStation-EX V3.0.1:**
|
||||
|
||||
- Add back fix for jitter
|
||||
- Add Turnouts, Outputs and Sensors to `<s>` command output
|
||||
|
||||
**CommandStation-EX V3.0.0:**
|
||||
|
||||
**Release v3.0.0 was a major rewrite if earlier versions of DCC++. The code base was re-architeced and core changes were made to the Waveform generator to reduce overhead and make better use of Arduino.** **Summary of the key new features added in Release v3.0.0 include:**
|
||||
|
||||
- **New USB Browser Based Throttle** - WebThrottle-EX is a full front-end to controller to control the CS to run trains.
|
||||
- **WiFi Support** - AP and station modes supported. Auto-detection of an ESP8266 WiFi module with AT firmware on a Mega's serial port. Connection to JMRI and WiThrottle clients.
|
||||
- **Withrottle Integrations** - Act as a host for up to four WiThrottle clients concurrently.
|
||||
- **Add LCD/OLED support** - OLED supported on Mega only
|
||||
- **Improved CV programming routines** - checks for length of CV pulse, and breaks out of the wait state once it has received an ACK, now reading one CV per second.
|
||||
- **Improved current sensing** - rewrote current sensing routines for safer operation. Current thresholds based on milliamps, not magic numbers
|
||||
- **Individual track power control** - Ability to toggle power on either or both tracks, and to "JOIN" the tracks and make them output the same waveform for multiple power districts.
|
||||
- **Single or Dual-Pin PWM output** - Allows control of H-bridges with PH/EN or dual PWM inputs
|
||||
- **New, simpler function command** - `<F>` command allows setting functions based on their number, not based on a code as in `<f>`
|
||||
- **Function reminders** - Function reminders are sent in addition to speed reminders
|
||||
- **Functions to F28** - All NMRA functions are now supported
|
||||
- **Filters and user functions** - Ability to filter commands in the parser and execute custom code based on them. (ex: Redirect Turnout commands via NRF24)
|
||||
- **Diagnostic `<D>` commands** - See documentation for a full list of new diagnostic commands
|
||||
- **Rewrote DCC++ Parser** - more efficient operation, accepts multi-char input and uses less RAM
|
||||
- **Rewritten waveform generator** - capable of using any pin for DCC waveform out, eliminating the need for jumpers
|
||||
- **Rewritten packet generator** - Simplify and make smaller, remove idea of "registers" from original code
|
||||
- **Add free RAM messages** - Free RAM messages are now printed whenever there is a decerase in available RAM
|
||||
- **Fix EEPROM bugs**
|
||||
- **Number of locos discovery command** - `<#>` command
|
||||
- **Support for more locomotives** - 20 locomotives on an UNO and 50 an a Mega.
|
||||
- **Automatic slot management** - slot variable in throttle/function commands are ignored and slot management is taken care of automatically. `<->` and `<- CAB>` commands added to release locos from memory and stop packets to the track.
|
||||
|
||||
**Key Contributors**
|
||||
|
||||
**Project Lead**
|
||||
|
||||
- Fred Decker - Holly Springs, North Carolina, USA (FlightRisk)
|
||||
|
||||
**CommandStation-EX Developers**
|
||||
|
||||
- Chris Harlow - Bournemouth, UK (UKBloke)
|
||||
- Harald Barth - Stockholm, Sweden (Haba)
|
||||
- Neil McKechnie - Worcestershire, UK (NeilMck)
|
||||
- Fred Decker - Holly Springs, North Carolina, USA (FlightRisk)
|
||||
- Dave Cutting - Logan, Utah, USA (Dave Cutting/ David Cutting)
|
||||
- M Steve Todd - Oregon, USA (MSteveTodd)
|
||||
- Scott Catalano - Pennsylvania
|
||||
- Gregor Baues - Île-de-France, France (grbba)
|
||||
|
||||
**Engine Driver and JMRI Interface**
|
||||
|
||||
- M Steve Todd
|
||||
|
||||
**exInstaller Software**
|
||||
|
||||
- Anthony W - Dayton, Ohio, USA (Dex, Dex++)
|
||||
|
||||
**Website and Documentation**
|
||||
|
||||
- Mani Kumar - Bangalor, India (Mani / Mani Kumar)
|
||||
- Fred Decker - Holly Springs, North Carolina, USA (FlightRisk)
|
||||
- Dave Cutting - Logan, Utah, USA (Dave Cutting/ David Cutting)
|
||||
- Roger Beschizza - Dorset, UK (Roger Beschizza)
|
||||
- Keith Ledbetter - Chicago, Illinois, USA (Keith Ledbetter)
|
||||
- Kevin Smith - Rochester Hills, Michigan USA (KC Smith)
|
||||
- Colin Grabham - Central NSW, Australia (Kebbin)
|
||||
|
||||
**WebThrotle-EX**
|
||||
|
||||
- Fred Decker - Holly Springs, NC (FlightRisk/FrightRisk)
|
||||
- Mani Kumar - Bangalor, India (Mani /Mani Kumar)
|
||||
- Matt H - Somewhere in Europe
|
||||
|
||||
**Beta Testing / Release Management / Support**
|
||||
|
||||
- Larry Dribin - Release Management
|
||||
- Kevin Smith - Rochester Hills, Michigan USA (KC Smith)
|
||||
- Herb Morton - Kingwood Texas, USA (Ash++)
|
||||
- Keith Ledbetter
|
||||
- Brad Van der Elst
|
||||
- Andrew Pye
|
||||
- Mike Bowers
|
||||
- Randy McKenzie
|
||||
- Roberto Bravin
|
||||
- Sam Brigden
|
||||
- Alan Lautenslager
|
||||
- Martin Bafver
|
||||
- Mário André Silva
|
||||
- Anthony Kochevar
|
||||
- Gajanatha Kobbekaduwe
|
||||
- Sumner Patterson
|
||||
- Paul - Virginia, USA
|
||||
|
||||
**Downloads (zip and tar.gz) below. These are named without version number in the folder name to make the Arduino IDE happy.**
|
||||
|
||||
[CommandStation-EX.zip](https://github.com/DCC-EX/CommandStation-EX/releases/download/v4.0.0-Prod/CommandStation-EX.zip)
|
||||
|
||||
|
||||
[CommandStation-EX.tar.gz](https://github.com/DCC-EX/CommandStation-EX/releases/download/v4.0.0-Prod/CommandStation-EX.tar.gz)
|
346
Release_Notes/release_notes_v4.1.1.md
Normal file
346
Release_Notes/release_notes_v4.1.1.md
Normal file
@@ -0,0 +1,346 @@
|
||||
Version 4.1.1 Release Notes
|
||||
*************************
|
||||
|
||||
The DCC-EX Team is pleased to release CommandStation-EX v4.1.1 as a Production Release for the general public.
|
||||
This release is a Minor release with many significant EX-RAIL enhancements and new automation features in addition to some bug fixes.
|
||||
The team continues improving the architecture of DCC++EX to make it more flexible and optimizing the code to get more performance from the Arduino (and other) microprocessors. This release includes all of the Point Releases from v4.0.1 to v4.1.1 rc13.
|
||||
|
||||
**Downloads (zip and tar.gz) below. These are named without version number in the folder name to make the Arduino IDE happy.**
|
||||
|
||||
[CommandStation-EX.zip](https://github.com/DCC-EX/CommandStation-EX/releases/download/v4.1.1-Prod/CommandStation-EX.zip)
|
||||
|
||||
|
||||
|
||||
[CommandStation-EX.tar.gz](https://github.com/DCC-EX/CommandStation-EX/releases/download/v4.1.1-Prod/CommandStation-EX.tar.gz)
|
||||
|
||||
**New Command Station & EX-RAIL Features**
|
||||
- ACK defaults are now set to LIMIT 50mA, MIN 2000uS, MAX 20000uS for more compatibility with non NMRA compliant decoders
|
||||
- Automatically detect and run a myFilter add-on (no need to call setFilter)
|
||||
|
||||
- New Commands for the Arduino IDE Serial Monitor and JMRI DCC++ Traffic Monitor
|
||||
- </RED signal_id> to turn a individual LED Signal On & Off
|
||||
- </AMBER signal_id> "
|
||||
- </GREEN signal_id> "
|
||||
- </KILL ALL> command to stop all tasks, and Diagnostic messages when KILL is used
|
||||
- < t cab> command to obtain current throttle setting
|
||||
|
||||
- Allow WRITE CV on PROG <W CV VALUE>
|
||||
- Updated CV read command <R cv>. Equivalent to <V cv 0>. Uses the verify callback.
|
||||
- Allow WRITE CV on PROG <W CV VALUE)
|
||||
- Change callback parameters are now optional on PROG
|
||||
|
||||
- New JA, JR, JT commands availabe for Throttle Developers to obtain Route, Roster and Turnout descriptions for communications
|
||||
|
||||
- New EX-RAIL Functions to use in Automation(n), ROUTE(N) & SEQUENCE(N) Scripts
|
||||
- ATGTE & ATLT wait for analog value, (At Greater Than or Equal and At Less Than a certain value)
|
||||
- FADE command now works for LEDs connected on PCA9685 Servo/Signal board Output vpins
|
||||
- FORGET Forgets the current loco in DCC reminder tables saving memory and wasted packets sent to the track
|
||||
- "IF" signal detection with IFRED(signal_id), IFAMBER(signal_id), IFGREEN(signal_id)
|
||||
- KILLALL command to stop all tasks, and Diagnostic messages when KILL is used
|
||||
- PARSE <> commands in EXRAIL allows sending of DCC-EX commands from EX-RAIL
|
||||
- SERVO_SIGNAL Servo signals assigned to a specific servo turnout
|
||||
- SIGNALH High-On signal pins (Arduino normally handles active LOW signals. This allows for active HIGH)
|
||||
- HIDDEN turnouts (hide a REAL turnout and create a VIRTUAL turnout to handle actions that happen BEFORE a turnout is thrown)
|
||||
- VIRTUAL_TURNOUT definition
|
||||
|
||||
**EX-RAIL Updates**
|
||||
- EXRAIL BROADCAST("msg") sends any message to all throttles/JMRI via serial and WiFi
|
||||
- EXRAIL POWERON turns on power to both tracks from EX-RAIL (the equivalent of sending the <1> command)
|
||||
|
||||
** Other Enhancements**
|
||||
- UNO Progmem is optimize to allow for small EXRAIL Automation scipts to run within the limited space for testing purposes.
|
||||
- PCA9685 Servo Signal board supports 'Nopoweroffleds', servo pins stay powered on after position reached, otherwise the new FADE would always turn off.
|
||||
- Position servo can use spare servo pin as a GPIO pin.
|
||||
|
||||
**4.1.1 Bug Fixes**
|
||||
|
||||
- Preserve the turnout format
|
||||
- Parse multiple commands in one buffer string currectly
|
||||
- Fix </> command signal status in EX-RAIL
|
||||
- Read long loco addresses in EX-RAIL
|
||||
- FIX negative route IDs in WIthrottle
|
||||
|
||||
See the version.h file for notes about which of the 4.1.1 features were added/changed by point release.
|
||||
|
||||
**Known Issues**
|
||||
|
||||
- **Wi-Fi** - Requires sending `<AT>` commands from a serial monitor if you want to switch between AP mode and STA station mode after initial setup
|
||||
- **Pololu Motor Shield** - is supported with this release, but the user may have to adjust timings to enable programming mode due to limitations in its current sensing circuitry
|
||||
|
||||
**All New Major DCC++EX 4.0.0 features**
|
||||
|
||||
- **New HAL Hardware Abstraction Layer API** that automatically detects and greatly simplifies interfacing to many predefined accessory boards for servos, signals & sensors and added I/O (digital and analog inputs and outputs, servos etc).
|
||||
- HAL Support for;
|
||||
- MCP23008, MCP23017 and PCF9584 I2C GPIO Extender modules.
|
||||
- PCA9685 PWM (servo & signal) control modules.
|
||||
- Analogue inputs on Arduino pins and on ADS111x I2C modules.
|
||||
- MP3 sound playback via DFPlayer module.
|
||||
- HC-SR04 Ultrasonic range sensor module.
|
||||
- VL53L0X Laser range sensor module (Time-Of-Flight).
|
||||
- A new `<D HAL SHOW>` command to list the HAL devices attached to the command station
|
||||
|
||||
**New Command Station Broadcast throttle logic**
|
||||
|
||||
- Synchronizes multiple WiThrottles and PC based JMRI Throttles for direction, speed and F-key updates
|
||||
|
||||
**New ‘Discovered Servers’ on WiFi Throttles**
|
||||
|
||||
- Our New multicast Dynamic Network Server (mDNS) enhancement allows us to display the available WiFi server connections to a DCC++EX Command Station. Selecting it allows your WiThrottle App to connect to and load Server Rosters and function keys to your throttle from the new DCC++EX Command Station Server Roster.
|
||||
|
||||
**New DCC++EX 4.0.0 with EX-RAIL Extended Railroad Automation Instruction Language**
|
||||
|
||||
- Use to control your entire layout or as a separate accessory/animation controller
|
||||
- Awesome, cleverly powerful yet simple user friendly scripting language for user built Automation & Routing scripts.
|
||||
- You can control Engines, Sensors, Turnouts, Signals, Outputs and Accessories that are entered into your new myAutomation.h file, then uploaded into the DCC++EX Command Station.
|
||||
- EX-RAIL scripts are automatically displayed as Automation {Handoff} and Route {Set} buttons on supported WiFi Throttle Apps.
|
||||
|
||||
**New EX-RAIL ‘Roster’ Feature**
|
||||
|
||||
- List and store user defined engine roster & function keys inside the command station, and automatically load them in WiFi Throttle Apps.
|
||||
- When choosing “DCC++EX” from discovered servers an Engine Driver or WiThrottle is directly connected to the Command Station.
|
||||
- The EX-RAIL ’ROSTER’ command allows all the engine numbers, names and function keys you’ve listed in your myAutomation.h file to automatically upload the Command Station's ‘Server Roster’ into your Engine Driver and WiThrottle Apps.
|
||||
|
||||
**New JMRI 4.99.2 and above specific DCC++EX 4.0 features**
|
||||
|
||||
- Enhanced JMRI DCC++ Configure Base Station pane for building and maintaining Sensor, Turnout and Output devices, or these can automatically be populated from the DCC++EX Command Station's mySetup.h file into JMRI.
|
||||
|
||||
- JMRI now supports multiple serial connected DCC++EX Command Stations, to display and track separate "Send DCC++ Command" and "DCC++ Traffic" Monitors for each Command Station at the same time.
|
||||
For example: Use an Uno DCC++EX DecoderPro Programming Station {DCC++Prg} on a desktop programming track and a second Mega DCC++EX EX-RAIL Command Station for Operations {DCC++Ops} on the layout with an additional `<JOINED>` programming spur or siding track for acquiring an engine and ‘Drive Away’ onto the mainline (see the DriveAway feature for more information).
|
||||
|
||||
**DCC++EX 4.0.0 additional product enhancements**
|
||||
|
||||
- Additional Motor Shields and Motor Board {boosters) supported
|
||||
- Additional Accessory boards supported for GPIO expansion, Sensors, Servos & Signals
|
||||
- Additional diagnostic commands like ‘D ACK RETRY’ and ‘D EXRAIL ON’ events, ‘D HAL SHOW’ devices and ‘D SERVO’ positions, and ‘D RESET’ the command station while maintaining the serial connection with JMRI
|
||||
- Automatic retry on failed ACK detection to give decoders another chance
|
||||
- New EX-RAIL ’/’ slash command allows JMRI to directly communicate with many EX-RAIL scripts
|
||||
- Turnout class revised to expand turnout capabilities and allow turnout names/descriptors to display in WiThrottle Apps.
|
||||
- Build turnouts through either or both mySetup.h and myAutomation.h files, and have them automatically passed to, and populate, JMRI Turnout Tables
|
||||
- Turnout user names display in Engine Driver & WiThrottles
|
||||
- Output class now allows ID > 255.
|
||||
- Configuration options to globally flip polarity of DCC Accessory states when driven from `<a>` command and `<T>` command.
|
||||
- Increased use of display for showing loco decoder programming information.
|
||||
- Can disable EEPROM memory code to allow room for DCC++EX 4.0 to fit on a Uno Command Station
|
||||
- Can define border between long and short addresses
|
||||
- Native non-blocking I2C drivers for AVR and Nano architectures (fallback to blocking Wire library for other platforms).
|
||||
- EEPROM layout change - deletes EEPROM contents on first start following upgrade.
|
||||
|
||||
**4.0.0 Bug Fixes**
|
||||
|
||||
- Compiles on Nano Every
|
||||
- Diagnostic display of ack pulses >32ms
|
||||
- Current read from wrong ADC during interrupt
|
||||
- AT(+) Command Pass Through
|
||||
- CiDAP WiFi Drop out and the WiThrottle F-key looping error corrected
|
||||
- One-off error in CIPSEND drop
|
||||
- Common Fault Pin Error
|
||||
- Uno Memory Utilization optimized
|
||||
|
||||
#### Summary of Release 3.1.0 key features and/or bug fixes by Point Release
|
||||
|
||||
**Summary of the key new features added to CommandStation-EX V3.0.16**
|
||||
|
||||
- Ignore CV1 bit 7 read if rejected by a non NMRA compliant decoder when identifying loco id
|
||||
|
||||
**Summary of the key new features added to CommandStation-EX V3.0.15**
|
||||
|
||||
- Send function commands just once instead of repeating them 4 times
|
||||
|
||||
**Summary of the key new features added to CommandStation-EX V3.0.14**
|
||||
|
||||
- Add feature to tolerate decoders that incorrectly have gaps in their ACK pulse
|
||||
- Provide proper track power management when joining and unjoining tracks with <1 JOIN>
|
||||
|
||||
**Summary of the key new features added to CommandStation-EX V3.0.13**
|
||||
|
||||
- Fix for CAB Functions greater than 127
|
||||
|
||||
**Summary of the key new features added to CommandStation-EX V3.0.12**
|
||||
|
||||
- Fixed clear screen issue for nanoEvery and nanoWifi
|
||||
|
||||
**Summary of the key new features added to CommandStation-EX V3.0.11**
|
||||
|
||||
- Reorganized files for support of 128 speed steps
|
||||
|
||||
**Summary of the key new features added to CommandStation-EX V3.0.10**
|
||||
|
||||
- Added Support for the Teensy 3.2, 3.5, 3.6, 4.0 and 4.1 MCUs
|
||||
- No functional change just changes to avoid complier warnings for Teensy/nanoEvery
|
||||
|
||||
**Summary of the key new features added to CommandStation-EX V3.0.9**
|
||||
|
||||
- Rearranges serial newlines for the benefit of JMRI
|
||||
- Major update for efficiencies in displays (LCD, OLED)
|
||||
- Add I2C Support functions
|
||||
|
||||
**Summary of the key new features added to CommandStation-EX V3.0.8**
|
||||
|
||||
- Wraps <* *> around DIAGS for the benefit of JMRI
|
||||
|
||||
**Summary of the key new features added to CommandStation-EX V3.0.7**
|
||||
|
||||
- Implemented support for older 28 apeed step decoders - Option to turn on 28 step speed decoders in addition to 128. If set, all locos will use 28 steps.
|
||||
- Improved overload messages with raw values (relative to offset)
|
||||
|
||||
**Summary of the key new features added to CommandStation-EX V3.0.6**
|
||||
|
||||
- Prevent compiler warning about deprecated B constants
|
||||
- Fix Bug that did not let us transmit 5 byte sized packets - 5 Byte commands like PoM (programming on main) were not being sent correctly
|
||||
- Support for Huge function numbers (DCC BinaryStateControl) - Support Functions beyond F28
|
||||
- <!> ESTOP all - New command to emergency stop all locos on the main track
|
||||
- <- [cab]> estop and forget cab/all cabs - Stop and remove loco from the CS. Stops the repeating throttle messages
|
||||
- `<D RESET>` command to reboot Arduino
|
||||
- Automatic sensor offset detect
|
||||
- Improved startup msgs from Motor Drivers (accuracy and auto sense factors)
|
||||
- Drop post-write verify - No need to double check CV writes. Writes are now even faster.
|
||||
- Allow current sense pin set to UNUSED_PIN - No need to ground an unused analog current pin. Produce startup warning and callback -2 for prog track cmds.
|
||||
|
||||
**Summary of the key new features added to CommandStation-EX V3.0.5**
|
||||
|
||||
- Fix Fn Key startup with loco ID and fix state change for F16-28
|
||||
- Removed ethernet mac config and made it automatic
|
||||
- Show wifi ip and port on lcd
|
||||
- Auto load config.example.h with warning
|
||||
- Dropped example .ino files
|
||||
- Corrected .ino comments
|
||||
- Add Pololu fault pin handling
|
||||
- Waveform speed/simplicity improvements
|
||||
- Improved pin speed in waveform
|
||||
- Portability to nanoEvery and UnoWifiRev2 CPUs
|
||||
- Analog read speed improvements
|
||||
- Drop need for DIO2 library
|
||||
- Improved current check code
|
||||
- Linear command
|
||||
- Removed need for ArduinoTimers files
|
||||
- Removed option to choose different timer
|
||||
- Added EX-RAIL hooks for automation in future version
|
||||
- Fixed Turnout list
|
||||
- Allow command keywords in mixed case
|
||||
- Dropped unused memstream
|
||||
- PWM pin accuracy if requirements met
|
||||
|
||||
**Summary of the key new features added to CommandStation-EX V3.0.4**
|
||||
|
||||
- "Drive-Away" Feature - added so that throttles like Engine Driver can allow a loco to be programmed on a usable, electrically isolated programming track and then drive off onto the main track
|
||||
- WiFi Startup Fixes
|
||||
|
||||
**Summary of the key new features added to CommandStation-EX V3.0.3**
|
||||
|
||||
- Command to write loco address and clear consist
|
||||
- Command will allow for consist address
|
||||
- Startup commands implemented
|
||||
|
||||
**Summary of the key new features added to CommandStation-EX V3.0.2:**
|
||||
|
||||
- Create new output for current in mA for `<c>` command - New current response outputs current in mA, overlimit current, and maximum board capable current
|
||||
- Simultaneously update JMRI to handle new current meter
|
||||
|
||||
**Summary of the key new features added to CommandStation-EX V3.0.1:**
|
||||
|
||||
- Add back fix for jitter
|
||||
- Add Turnouts, Outputs and Sensors to `<s>` command output
|
||||
|
||||
**CommandStation-EX V3.0.0:**
|
||||
|
||||
**Release v3.0.0 was a major rewrite if earlier versions of DCC++. The code base was re-architeced and core changes were made to the Waveform generator to reduce overhead and make better use of Arduino.** **Summary of the key new features added in Release v3.0.0 include:**
|
||||
|
||||
- **New USB Browser Based Throttle** - WebThrottle-EX is a full front-end to controller to control the CS to run trains.
|
||||
- **WiFi Support** - AP and station modes supported. Auto-detection of an ESP8266 WiFi module with AT firmware on a Mega's serial port. Connection to JMRI and WiThrottle clients.
|
||||
- **Withrottle Integrations** - Act as a host for up to four WiThrottle clients concurrently.
|
||||
- **Add LCD/OLED support** - OLED supported on Mega only
|
||||
- **Improved CV programming routines** - checks for length of CV pulse, and breaks out of the wait state once it has received an ACK, now reading one CV per second.
|
||||
- **Improved current sensing** - rewrote current sensing routines for safer operation. Current thresholds based on milliamps, not magic numbers
|
||||
- **Individual track power control** - Ability to toggle power on either or both tracks, and to "JOIN" the tracks and make them output the same waveform for multiple power districts.
|
||||
- **Single or Dual-Pin PWM output** - Allows control of H-bridges with PH/EN or dual PWM inputs
|
||||
- **New, simpler function command** - `<F>` command allows setting functions based on their number, not based on a code as in `<f>`
|
||||
- **Function reminders** - Function reminders are sent in addition to speed reminders
|
||||
- **Functions to F28** - All NMRA functions are now supported
|
||||
- **Filters and user functions** - Ability to filter commands in the parser and execute custom code based on them. (ex: Redirect Turnout commands via NRF24)
|
||||
- **Diagnostic `<D>` commands** - See documentation for a full list of new diagnostic commands
|
||||
- **Rewrote DCC++ Parser** - more efficient operation, accepts multi-char input and uses less RAM
|
||||
- **Rewritten waveform generator** - capable of using any pin for DCC waveform out, eliminating the need for jumpers
|
||||
- **Rewritten packet generator** - Simplify and make smaller, remove idea of "registers" from original code
|
||||
- **Add free RAM messages** - Free RAM messages are now printed whenever there is a decerase in available RAM
|
||||
- **Fix EEPROM bugs**
|
||||
- **Number of locos discovery command** - `<#>` command
|
||||
- **Support for more locomotives** - 20 locomotives on an UNO and 50 an a Mega.
|
||||
- **Automatic slot management** - slot variable in throttle/function commands are ignored and slot management is taken care of automatically. `<->` and `<- CAB>` commands added to release locos from memory and stop packets to the track.
|
||||
|
||||
**Key Contributors**
|
||||
|
||||
**Project Lead**
|
||||
|
||||
- Fred Decker - Holly Springs, North Carolina, USA (FlightRisk)
|
||||
|
||||
**EX-CommandStation Developers**
|
||||
|
||||
- Chris Harlow - Bournemouth, UK (UKBloke)
|
||||
- Harald Barth - Stockholm, Sweden (Haba)
|
||||
- Neil McKechnie - Worcestershire, UK (NeilMck)
|
||||
- Fred Decker - Holly Springs, North Carolina, USA (FlightRisk)
|
||||
- Dave Cutting - Logan, Utah, USA (Dave Cutting/ David Cutting)
|
||||
- M Steve Todd - Oregon, USA (MSteveTodd)
|
||||
- Scott Catalano - Pennsylvania
|
||||
- Gregor Baues - Île-de-France, France (grbba)
|
||||
|
||||
**Engine Driver and JMRI Interface**
|
||||
|
||||
- M Steve Todd
|
||||
|
||||
**EX-Installer Software**
|
||||
|
||||
- Anthony W - Dayton, Ohio, USA (Dex, Dex++)
|
||||
|
||||
**Website and Documentation**
|
||||
|
||||
- Mani Kumar - Bangalor, India (Mani / Mani Kumar)
|
||||
- Fred Decker - Holly Springs, North Carolina, USA (FlightRisk)
|
||||
- Dave Cutting - Logan, Utah, USA (Dave Cutting/ David Cutting)
|
||||
- Roger Beschizza - Dorset, UK (Roger Beschizza)
|
||||
- Keith Ledbetter - Chicago, Illinois, USA (Keith Ledbetter)
|
||||
- Kevin Smith - Rochester Hills, Michigan USA (KC Smith)
|
||||
- Colin Grabham - Central NSW, Australia (Kebbin)
|
||||
- Peter Cole - Brisbane, QLD, Australia (peteGSX)
|
||||
- Peter Akers - Brisbane, QLD, Australia (flash62au)
|
||||
|
||||
**EX-WebThrottle**
|
||||
|
||||
- Fred Decker - Holly Springs, NC (FlightRisk/FrightRisk)
|
||||
- Mani Kumar - Bangalor, India (Mani /Mani Kumar)
|
||||
- Matt H - Somewhere in Europe
|
||||
|
||||
**Hardware / Electronics**
|
||||
|
||||
- Harald Barth - Stockholm, Sweden (Haba)
|
||||
- Paul Antoine, Western Australia
|
||||
- Neil McKechnie - Worcestershire, UK
|
||||
- Fred Decker - Holly Springs NC, USA
|
||||
- Herb Morton - Kingwood Texas, USA (Ash++)
|
||||
|
||||
**Beta Testing / Release Management / Support**
|
||||
|
||||
- Larry Dribin - Release Management
|
||||
- Kevin Smith - Rochester Hills, Michigan USA (KC Smith)
|
||||
- Herb Morton - Kingwood Texas, USA (Ash++)
|
||||
- Keith Ledbetter
|
||||
- Brad Van der Elst
|
||||
- Andrew Pye
|
||||
- Mike Bowers
|
||||
- Randy McKenzie
|
||||
- Roberto Bravin
|
||||
- Sam Brigden
|
||||
- Alan Lautenslager
|
||||
- Martin Bafver
|
||||
- Mário André Silva
|
||||
- Anthony Kochevar
|
||||
- Gajanatha Kobbekaduwe
|
||||
- Sumner Patterson
|
||||
- Paul - Virginia, USA
|
||||
|
||||
**Downloads (zip and tar.gz) below. These are named without version number in the folder name to make the Arduino IDE happy.**
|
||||
|
||||
[CommandStation-EX.zip](https://github.com/DCC-EX/CommandStation-EX/releases/download/v4.1.1-Prod/CommandStation-EX.zip)
|
||||
|
||||
|
||||
[CommandStation-EX.tar.gz](https://github.com/DCC-EX/CommandStation-EX/releases/download/v4.1.1-Prod/CommandStation-EX.tar.gz)
|
349
Release_Notes/release_notes_v4.1.2.md
Normal file
349
Release_Notes/release_notes_v4.1.2.md
Normal file
@@ -0,0 +1,349 @@
|
||||
Version 4.1.2 Release Notes
|
||||
*************************
|
||||
|
||||
The DCC-EX Team is pleased to release CommandStation-EX v4.1.2 as a Production Release for the general public.
|
||||
This release is a Bugfix release which fixes support for Ethernet Shields based on the W5100 chip that broke with the release of v4.1.1. This chip does not report HW and link status the way the W5200 and W5500 do, so the check routine needed to be changed.
|
||||
The team continues improving the architecture of DCC++EX to make it more flexible and optimizing the code to get more performance from the Arduino (and other) microprocessors. This release includes all of the Point Releases from v4.0.1 to v4.1.2.
|
||||
|
||||
**Downloads (zip and tar.gz) below. These are named without version number in the folder name to make the Arduino IDE happy.**
|
||||
|
||||
[CommandStation-EX.zip](https://github.com/DCC-EX/CommandStation-EX/releases/download/v4.1.2-Prod/CommandStation-EX.zip)
|
||||
|
||||
|
||||
|
||||
[CommandStation-EX.tar.gz](https://github.com/DCC-EX/CommandStation-EX/releases/download/v4.1.2-Prod/CommandStation-EX.tar.gz)
|
||||
|
||||
**New Command Station & EX-RAIL Features**
|
||||
- ACK defaults are now set to LIMIT 50mA, MIN 2000uS, MAX 20000uS for more compatibility with non NMRA compliant decoders
|
||||
- Automatically detect and run a myFilter add-on (no need to call setFilter)
|
||||
|
||||
- New Commands for the Arduino IDE Serial Monitor and JMRI DCC++ Traffic Monitor
|
||||
- </RED signal_id> to turn a individual LED Signal On & Off
|
||||
- </AMBER signal_id> "
|
||||
- </GREEN signal_id> "
|
||||
- </KILL ALL> command to stop all tasks, and Diagnostic messages when KILL is used
|
||||
- < t cab> command to obtain current throttle setting
|
||||
|
||||
- Allow WRITE CV on PROG <W CV VALUE>
|
||||
- Updated CV read command <R cv>. Equivalent to <V cv 0>. Uses the verify callback.
|
||||
- Allow WRITE CV on PROG <W CV VALUE)
|
||||
- Change callback parameters are now optional on PROG
|
||||
|
||||
- New JA, JR, JT commands availabe for Throttle Developers to obtain Route, Roster and Turnout descriptions for communications
|
||||
|
||||
- New EX-RAIL Functions to use in Automation(n), ROUTE(N) & SEQUENCE(N) Scripts
|
||||
- ATGTE & ATLT wait for analog value, (At Greater Than or Equal and At Less Than a certain value)
|
||||
- FADE command now works for LEDs connected on PCA9685 Servo/Signal board Output vpins
|
||||
- FORGET Forgets the current loco in DCC reminder tables saving memory and wasted packets sent to the track
|
||||
- "IF" signal detection with IFRED(signal_id), IFAMBER(signal_id), IFGREEN(signal_id)
|
||||
- KILLALL command to stop all tasks, and Diagnostic messages when KILL is used
|
||||
- PARSE <> commands in EXRAIL allows sending of DCC-EX commands from EX-RAIL
|
||||
- SERVO_SIGNAL Servo signals assigned to a specific servo turnout
|
||||
- SIGNALH High-On signal pins (Arduino normally handles active LOW signals. This allows for active HIGH)
|
||||
- HIDDEN turnouts (hide a REAL turnout and create a VIRTUAL turnout to handle actions that happen BEFORE a turnout is thrown)
|
||||
- VIRTUAL_TURNOUT definition
|
||||
|
||||
**EX-RAIL Updates**
|
||||
- EXRAIL BROADCAST("msg") sends any message to all throttles/JMRI via serial and WiFi
|
||||
- EXRAIL POWERON turns on power to both tracks from EX-RAIL (the equivalent of sending the <1> command)
|
||||
|
||||
** Other Enhancements**
|
||||
- UNO Progmem is optimize to allow for small EXRAIL Automation scipts to run within the limited space for testing purposes.
|
||||
- PCA9685 Servo Signal board supports 'Nopoweroffleds', servo pins stay powered on after position reached, otherwise the new FADE would always turn off.
|
||||
- Position servo can use spare servo pin as a GPIO pin.
|
||||
|
||||
**4.1.2 Bug Fixes**
|
||||
- Fixed Ethernet shield W5100 support since it does not report HW or link level like the W5200 and W5500 chips.
|
||||
|
||||
**4.1.1 Bug Fixes**
|
||||
|
||||
- Preserve the turnout format
|
||||
- Parse multiple commands in one buffer string currectly
|
||||
- Fix </> command signal status in EX-RAIL
|
||||
- Read long loco addresses in EX-RAIL
|
||||
- FIX negative route IDs in WIthrottle
|
||||
|
||||
See the version.h file for notes about which of the 4.1.2 features were added/changed by point release.
|
||||
|
||||
**Known Issues**
|
||||
|
||||
- **Wi-Fi** - Requires sending `<AT>` commands from a serial monitor if you want to switch between AP mode and STA station mode after initial setup
|
||||
- **Pololu Motor Shield** - is supported with this release, but the user may have to adjust timings to enable programming mode due to limitations in its current sensing circuitry
|
||||
|
||||
**All New Major DCC++EX 4.0.0 features**
|
||||
|
||||
- **New HAL Hardware Abstraction Layer API** that automatically detects and greatly simplifies interfacing to many predefined accessory boards for servos, signals & sensors and added I/O (digital and analog inputs and outputs, servos etc).
|
||||
- HAL Support for;
|
||||
- MCP23008, MCP23017 and PCF9584 I2C GPIO Extender modules.
|
||||
- PCA9685 PWM (servo & signal) control modules.
|
||||
- Analogue inputs on Arduino pins and on ADS111x I2C modules.
|
||||
- MP3 sound playback via DFPlayer module.
|
||||
- HC-SR04 Ultrasonic range sensor module.
|
||||
- VL53L0X Laser range sensor module (Time-Of-Flight).
|
||||
- A new `<D HAL SHOW>` command to list the HAL devices attached to the command station
|
||||
|
||||
**New Command Station Broadcast throttle logic**
|
||||
|
||||
- Synchronizes multiple WiThrottles and PC based JMRI Throttles for direction, speed and F-key updates
|
||||
|
||||
**New ‘Discovered Servers’ on WiFi Throttles**
|
||||
|
||||
- Our New multicast Dynamic Network Server (mDNS) enhancement allows us to display the available WiFi server connections to a DCC++EX Command Station. Selecting it allows your WiThrottle App to connect to and load Server Rosters and function keys to your throttle from the new DCC++EX Command Station Server Roster.
|
||||
|
||||
**New DCC++EX 4.0.0 with EX-RAIL Extended Railroad Automation Instruction Language**
|
||||
|
||||
- Use to control your entire layout or as a separate accessory/animation controller
|
||||
- Awesome, cleverly powerful yet simple user friendly scripting language for user built Automation & Routing scripts.
|
||||
- You can control Engines, Sensors, Turnouts, Signals, Outputs and Accessories that are entered into your new myAutomation.h file, then uploaded into the DCC++EX Command Station.
|
||||
- EX-RAIL scripts are automatically displayed as Automation {Handoff} and Route {Set} buttons on supported WiFi Throttle Apps.
|
||||
|
||||
**New EX-RAIL ‘Roster’ Feature**
|
||||
|
||||
- List and store user defined engine roster & function keys inside the command station, and automatically load them in WiFi Throttle Apps.
|
||||
- When choosing “DCC++EX” from discovered servers an Engine Driver or WiThrottle is directly connected to the Command Station.
|
||||
- The EX-RAIL ’ROSTER’ command allows all the engine numbers, names and function keys you’ve listed in your myAutomation.h file to automatically upload the Command Station's ‘Server Roster’ into your Engine Driver and WiThrottle Apps.
|
||||
|
||||
**New JMRI 4.99.2 and above specific DCC++EX 4.0 features**
|
||||
|
||||
- Enhanced JMRI DCC++ Configure Base Station pane for building and maintaining Sensor, Turnout and Output devices, or these can automatically be populated from the DCC++EX Command Station's mySetup.h file into JMRI.
|
||||
|
||||
- JMRI now supports multiple serial connected DCC++EX Command Stations, to display and track separate "Send DCC++ Command" and "DCC++ Traffic" Monitors for each Command Station at the same time.
|
||||
For example: Use an Uno DCC++EX DecoderPro Programming Station {DCC++Prg} on a desktop programming track and a second Mega DCC++EX EX-RAIL Command Station for Operations {DCC++Ops} on the layout with an additional `<JOINED>` programming spur or siding track for acquiring an engine and ‘Drive Away’ onto the mainline (see the DriveAway feature for more information).
|
||||
|
||||
**DCC++EX 4.0.0 additional product enhancements**
|
||||
|
||||
- Additional Motor Shields and Motor Board {boosters) supported
|
||||
- Additional Accessory boards supported for GPIO expansion, Sensors, Servos & Signals
|
||||
- Additional diagnostic commands like ‘D ACK RETRY’ and ‘D EXRAIL ON’ events, ‘D HAL SHOW’ devices and ‘D SERVO’ positions, and ‘D RESET’ the command station while maintaining the serial connection with JMRI
|
||||
- Automatic retry on failed ACK detection to give decoders another chance
|
||||
- New EX-RAIL ’/’ slash command allows JMRI to directly communicate with many EX-RAIL scripts
|
||||
- Turnout class revised to expand turnout capabilities and allow turnout names/descriptors to display in WiThrottle Apps.
|
||||
- Build turnouts through either or both mySetup.h and myAutomation.h files, and have them automatically passed to, and populate, JMRI Turnout Tables
|
||||
- Turnout user names display in Engine Driver & WiThrottles
|
||||
- Output class now allows ID > 255.
|
||||
- Configuration options to globally flip polarity of DCC Accessory states when driven from `<a>` command and `<T>` command.
|
||||
- Increased use of display for showing loco decoder programming information.
|
||||
- Can disable EEPROM memory code to allow room for DCC++EX 4.0 to fit on a Uno Command Station
|
||||
- Can define border between long and short addresses
|
||||
- Native non-blocking I2C drivers for AVR and Nano architectures (fallback to blocking Wire library for other platforms).
|
||||
- EEPROM layout change - deletes EEPROM contents on first start following upgrade.
|
||||
|
||||
**4.0.0 Bug Fixes**
|
||||
|
||||
- Compiles on Nano Every
|
||||
- Diagnostic display of ack pulses >32ms
|
||||
- Current read from wrong ADC during interrupt
|
||||
- AT(+) Command Pass Through
|
||||
- CiDAP WiFi Drop out and the WiThrottle F-key looping error corrected
|
||||
- One-off error in CIPSEND drop
|
||||
- Common Fault Pin Error
|
||||
- Uno Memory Utilization optimized
|
||||
|
||||
#### Summary of Release 3.1.0 key features and/or bug fixes by Point Release
|
||||
|
||||
**Summary of the key new features added to CommandStation-EX V3.0.16**
|
||||
|
||||
- Ignore CV1 bit 7 read if rejected by a non NMRA compliant decoder when identifying loco id
|
||||
|
||||
**Summary of the key new features added to CommandStation-EX V3.0.15**
|
||||
|
||||
- Send function commands just once instead of repeating them 4 times
|
||||
|
||||
**Summary of the key new features added to CommandStation-EX V3.0.14**
|
||||
|
||||
- Add feature to tolerate decoders that incorrectly have gaps in their ACK pulse
|
||||
- Provide proper track power management when joining and unjoining tracks with <1 JOIN>
|
||||
|
||||
**Summary of the key new features added to CommandStation-EX V3.0.13**
|
||||
|
||||
- Fix for CAB Functions greater than 127
|
||||
|
||||
**Summary of the key new features added to CommandStation-EX V3.0.12**
|
||||
|
||||
- Fixed clear screen issue for nanoEvery and nanoWifi
|
||||
|
||||
**Summary of the key new features added to CommandStation-EX V3.0.11**
|
||||
|
||||
- Reorganized files for support of 128 speed steps
|
||||
|
||||
**Summary of the key new features added to CommandStation-EX V3.0.10**
|
||||
|
||||
- Added Support for the Teensy 3.2, 3.5, 3.6, 4.0 and 4.1 MCUs
|
||||
- No functional change just changes to avoid complier warnings for Teensy/nanoEvery
|
||||
|
||||
**Summary of the key new features added to CommandStation-EX V3.0.9**
|
||||
|
||||
- Rearranges serial newlines for the benefit of JMRI
|
||||
- Major update for efficiencies in displays (LCD, OLED)
|
||||
- Add I2C Support functions
|
||||
|
||||
**Summary of the key new features added to CommandStation-EX V3.0.8**
|
||||
|
||||
- Wraps <* *> around DIAGS for the benefit of JMRI
|
||||
|
||||
**Summary of the key new features added to CommandStation-EX V3.0.7**
|
||||
|
||||
- Implemented support for older 28 apeed step decoders - Option to turn on 28 step speed decoders in addition to 128. If set, all locos will use 28 steps.
|
||||
- Improved overload messages with raw values (relative to offset)
|
||||
|
||||
**Summary of the key new features added to CommandStation-EX V3.0.6**
|
||||
|
||||
- Prevent compiler warning about deprecated B constants
|
||||
- Fix Bug that did not let us transmit 5 byte sized packets - 5 Byte commands like PoM (programming on main) were not being sent correctly
|
||||
- Support for Huge function numbers (DCC BinaryStateControl) - Support Functions beyond F28
|
||||
- <!> ESTOP all - New command to emergency stop all locos on the main track
|
||||
- <- [cab]> estop and forget cab/all cabs - Stop and remove loco from the CS. Stops the repeating throttle messages
|
||||
- `<D RESET>` command to reboot Arduino
|
||||
- Automatic sensor offset detect
|
||||
- Improved startup msgs from Motor Drivers (accuracy and auto sense factors)
|
||||
- Drop post-write verify - No need to double check CV writes. Writes are now even faster.
|
||||
- Allow current sense pin set to UNUSED_PIN - No need to ground an unused analog current pin. Produce startup warning and callback -2 for prog track cmds.
|
||||
|
||||
**Summary of the key new features added to CommandStation-EX V3.0.5**
|
||||
|
||||
- Fix Fn Key startup with loco ID and fix state change for F16-28
|
||||
- Removed ethernet mac config and made it automatic
|
||||
- Show wifi ip and port on lcd
|
||||
- Auto load config.example.h with warning
|
||||
- Dropped example .ino files
|
||||
- Corrected .ino comments
|
||||
- Add Pololu fault pin handling
|
||||
- Waveform speed/simplicity improvements
|
||||
- Improved pin speed in waveform
|
||||
- Portability to nanoEvery and UnoWifiRev2 CPUs
|
||||
- Analog read speed improvements
|
||||
- Drop need for DIO2 library
|
||||
- Improved current check code
|
||||
- Linear command
|
||||
- Removed need for ArduinoTimers files
|
||||
- Removed option to choose different timer
|
||||
- Added EX-RAIL hooks for automation in future version
|
||||
- Fixed Turnout list
|
||||
- Allow command keywords in mixed case
|
||||
- Dropped unused memstream
|
||||
- PWM pin accuracy if requirements met
|
||||
|
||||
**Summary of the key new features added to CommandStation-EX V3.0.4**
|
||||
|
||||
- "Drive-Away" Feature - added so that throttles like Engine Driver can allow a loco to be programmed on a usable, electrically isolated programming track and then drive off onto the main track
|
||||
- WiFi Startup Fixes
|
||||
|
||||
**Summary of the key new features added to CommandStation-EX V3.0.3**
|
||||
|
||||
- Command to write loco address and clear consist
|
||||
- Command will allow for consist address
|
||||
- Startup commands implemented
|
||||
|
||||
**Summary of the key new features added to CommandStation-EX V3.0.2:**
|
||||
|
||||
- Create new output for current in mA for `<c>` command - New current response outputs current in mA, overlimit current, and maximum board capable current
|
||||
- Simultaneously update JMRI to handle new current meter
|
||||
|
||||
**Summary of the key new features added to CommandStation-EX V3.0.1:**
|
||||
|
||||
- Add back fix for jitter
|
||||
- Add Turnouts, Outputs and Sensors to `<s>` command output
|
||||
|
||||
**CommandStation-EX V3.0.0:**
|
||||
|
||||
**Release v3.0.0 was a major rewrite if earlier versions of DCC++. The code base was re-architeced and core changes were made to the Waveform generator to reduce overhead and make better use of Arduino.** **Summary of the key new features added in Release v3.0.0 include:**
|
||||
|
||||
- **New USB Browser Based Throttle** - WebThrottle-EX is a full front-end to controller to control the CS to run trains.
|
||||
- **WiFi Support** - AP and station modes supported. Auto-detection of an ESP8266 WiFi module with AT firmware on a Mega's serial port. Connection to JMRI and WiThrottle clients.
|
||||
- **Withrottle Integrations** - Act as a host for up to four WiThrottle clients concurrently.
|
||||
- **Add LCD/OLED support** - OLED supported on Mega only
|
||||
- **Improved CV programming routines** - checks for length of CV pulse, and breaks out of the wait state once it has received an ACK, now reading one CV per second.
|
||||
- **Improved current sensing** - rewrote current sensing routines for safer operation. Current thresholds based on milliamps, not magic numbers
|
||||
- **Individual track power control** - Ability to toggle power on either or both tracks, and to "JOIN" the tracks and make them output the same waveform for multiple power districts.
|
||||
- **Single or Dual-Pin PWM output** - Allows control of H-bridges with PH/EN or dual PWM inputs
|
||||
- **New, simpler function command** - `<F>` command allows setting functions based on their number, not based on a code as in `<f>`
|
||||
- **Function reminders** - Function reminders are sent in addition to speed reminders
|
||||
- **Functions to F28** - All NMRA functions are now supported
|
||||
- **Filters and user functions** - Ability to filter commands in the parser and execute custom code based on them. (ex: Redirect Turnout commands via NRF24)
|
||||
- **Diagnostic `<D>` commands** - See documentation for a full list of new diagnostic commands
|
||||
- **Rewrote DCC++ Parser** - more efficient operation, accepts multi-char input and uses less RAM
|
||||
- **Rewritten waveform generator** - capable of using any pin for DCC waveform out, eliminating the need for jumpers
|
||||
- **Rewritten packet generator** - Simplify and make smaller, remove idea of "registers" from original code
|
||||
- **Add free RAM messages** - Free RAM messages are now printed whenever there is a decerase in available RAM
|
||||
- **Fix EEPROM bugs**
|
||||
- **Number of locos discovery command** - `<#>` command
|
||||
- **Support for more locomotives** - 20 locomotives on an UNO and 50 an a Mega.
|
||||
- **Automatic slot management** - slot variable in throttle/function commands are ignored and slot management is taken care of automatically. `<->` and `<- CAB>` commands added to release locos from memory and stop packets to the track.
|
||||
|
||||
**Key Contributors**
|
||||
|
||||
**Project Lead**
|
||||
|
||||
- Fred Decker - Holly Springs, North Carolina, USA (FlightRisk)
|
||||
|
||||
**EX-CommandStation Developers**
|
||||
|
||||
- Chris Harlow - Bournemouth, UK (UKBloke)
|
||||
- Harald Barth - Stockholm, Sweden (Haba)
|
||||
- Neil McKechnie - Worcestershire, UK (NeilMck)
|
||||
- Fred Decker - Holly Springs, North Carolina, USA (FlightRisk)
|
||||
- Dave Cutting - Logan, Utah, USA (Dave Cutting/ David Cutting)
|
||||
- M Steve Todd - Oregon, USA (MSteveTodd)
|
||||
- Scott Catalano - Pennsylvania
|
||||
- Gregor Baues - Île-de-France, France (grbba)
|
||||
|
||||
**Engine Driver and JMRI Interface**
|
||||
|
||||
- M Steve Todd
|
||||
|
||||
**EX-Installer Software**
|
||||
|
||||
- Anthony W - Dayton, Ohio, USA (Dex, Dex++)
|
||||
|
||||
**Website and Documentation**
|
||||
|
||||
- Mani Kumar - Bangalor, India (Mani / Mani Kumar)
|
||||
- Fred Decker - Holly Springs, North Carolina, USA (FlightRisk)
|
||||
- Dave Cutting - Logan, Utah, USA (Dave Cutting/ David Cutting)
|
||||
- Roger Beschizza - Dorset, UK (Roger Beschizza)
|
||||
- Keith Ledbetter - Chicago, Illinois, USA (Keith Ledbetter)
|
||||
- Kevin Smith - Rochester Hills, Michigan USA (KC Smith)
|
||||
- Colin Grabham - Central NSW, Australia (Kebbin)
|
||||
- Peter Cole - Brisbane, QLD, Australia (peteGSX)
|
||||
- Peter Akers - Brisbane, QLD, Australia (flash62au)
|
||||
|
||||
**EX-WebThrottle**
|
||||
|
||||
- Fred Decker - Holly Springs, NC (FlightRisk/FrightRisk)
|
||||
- Mani Kumar - Bangalor, India (Mani /Mani Kumar)
|
||||
- Matt H - Somewhere in Europe
|
||||
|
||||
**Hardware / Electronics**
|
||||
|
||||
- Harald Barth - Stockholm, Sweden (Haba)
|
||||
- Paul Antoine, Western Australia
|
||||
- Neil McKechnie - Worcestershire, UK
|
||||
- Fred Decker - Holly Springs NC, USA
|
||||
- Herb Morton - Kingwood Texas, USA (Ash++)
|
||||
|
||||
**Beta Testing / Release Management / Support**
|
||||
|
||||
- Larry Dribin - Release Management
|
||||
- Kevin Smith - Rochester Hills, Michigan USA (KC Smith)
|
||||
- Herb Morton - Kingwood Texas, USA (Ash++)
|
||||
- Keith Ledbetter
|
||||
- Brad Van der Elst
|
||||
- Andrew Pye
|
||||
- Mike Bowers
|
||||
- Randy McKenzie
|
||||
- Roberto Bravin
|
||||
- Sam Brigden
|
||||
- Alan Lautenslager
|
||||
- Martin Bafver
|
||||
- Mário André Silva
|
||||
- Anthony Kochevar
|
||||
- Gajanatha Kobbekaduwe
|
||||
- Sumner Patterson
|
||||
- Paul - Virginia, USA
|
||||
|
||||
**Downloads (zip and tar.gz) below. These are named without version number in the folder name to make the Arduino IDE happy.**
|
||||
|
||||
[CommandStation-EX.zip](https://github.com/DCC-EX/CommandStation-EX/releases/download/v4.1.2-Prod/CommandStation-EX.zip)
|
||||
|
||||
|
||||
[CommandStation-EX.tar.gz](https://github.com/DCC-EX/CommandStation-EX/releases/download/v4.1.2-Prod/CommandStation-EX.tar.gz)
|
@@ -99,6 +99,7 @@ void StringFormatter::send2(Print * stream,const FSH* format, va_list args) {
|
||||
case 'E': printEscapes(stream,(const FSH*)va_arg(args, char*)); break;
|
||||
case 'S': stream->print((const FSH*)va_arg(args, char*)); break;
|
||||
case 'd': printPadded(stream,va_arg(args, int), formatWidth, formatLeft); break;
|
||||
case 'u': printPadded(stream,va_arg(args, unsigned int), formatWidth, formatLeft); break;
|
||||
case 'l': printPadded(stream,va_arg(args, long), formatWidth, formatLeft); break;
|
||||
case 'b': stream->print(va_arg(args, int), BIN); break;
|
||||
case 'o': stream->print(va_arg(args, int), OCT); break;
|
||||
|
@@ -30,7 +30,7 @@
|
||||
#endif
|
||||
#include "StringFormatter.h"
|
||||
#include "CommandDistributor.h"
|
||||
#include "RMFT2.h"
|
||||
#include "EXRAIL2.h"
|
||||
#include "Turnouts.h"
|
||||
#include "DCC.h"
|
||||
#include "LCN.h"
|
||||
@@ -114,7 +114,7 @@
|
||||
|
||||
// I know it says setClosedStateOnly, but we need to tell others
|
||||
// that the state has changed too.
|
||||
#if defined(RMFT_ACTIVE)
|
||||
#if defined(EXRAIL_ACTIVE)
|
||||
RMFT2::turnoutEvent(id, closeFlag);
|
||||
#endif
|
||||
|
||||
@@ -147,7 +147,7 @@
|
||||
EEPROM.put(tt->_eepromAddress, tt->_turnoutData.flags);
|
||||
#endif
|
||||
|
||||
#if defined(RMFT_ACTIVE)
|
||||
#if defined(EXRAIL_ACTIVE)
|
||||
RMFT2::turnoutEvent(id, closeFlag);
|
||||
#endif
|
||||
|
||||
|
12
Turnouts.h
12
Turnouts.h
@@ -3,7 +3,7 @@
|
||||
* © 2021 M Steve Todd
|
||||
* © 2021 Fred Decker
|
||||
* © 2020-2021 Harald Barth
|
||||
* © 2020-2021 Chris Harlow
|
||||
* © 2020-2022 Chris Harlow
|
||||
* © 2013-2016 Gregg E. Berman
|
||||
* All rights reserved.
|
||||
*
|
||||
@@ -60,7 +60,8 @@ protected:
|
||||
union {
|
||||
struct {
|
||||
bool closed : 1;
|
||||
bool _rfu: 2;
|
||||
bool hidden : 1;
|
||||
bool _rfu : 1;
|
||||
uint8_t turnoutType : 5;
|
||||
};
|
||||
uint8_t flags;
|
||||
@@ -83,6 +84,7 @@ protected:
|
||||
_turnoutData.id = id;
|
||||
_turnoutData.turnoutType = turnoutType;
|
||||
_turnoutData.closed = closed;
|
||||
_turnoutData.hidden=false;
|
||||
add(this);
|
||||
}
|
||||
|
||||
@@ -104,11 +106,11 @@ protected:
|
||||
* Static functions
|
||||
*/
|
||||
|
||||
static Turnout *get(uint16_t id);
|
||||
|
||||
static void add(Turnout *tt);
|
||||
|
||||
public:
|
||||
static Turnout *get(uint16_t id);
|
||||
/*
|
||||
* Static data
|
||||
*/
|
||||
@@ -120,6 +122,8 @@ public:
|
||||
*/
|
||||
inline bool isClosed() { return _turnoutData.closed; };
|
||||
inline bool isThrown() { return !_turnoutData.closed; }
|
||||
inline bool isHidden() { return _turnoutData.hidden; }
|
||||
inline void setHidden(bool h) { _turnoutData.hidden=h; }
|
||||
inline bool isType(uint8_t type) { return _turnoutData.turnoutType == type; }
|
||||
inline uint16_t getId() { return _turnoutData.id; }
|
||||
inline Turnout *next() { return _nextTurnout; }
|
||||
@@ -169,7 +173,7 @@ public:
|
||||
#endif
|
||||
static void printAll(Print *stream) {
|
||||
for (Turnout *tt = _firstTurnout; tt != 0; tt = tt->_nextTurnout)
|
||||
StringFormatter::send(stream, F("<H %d %d>\n"),tt->getId(), tt->isThrown());
|
||||
if (!tt->isHidden()) StringFormatter::send(stream, F("<H %d %d>\n"),tt->getId(), tt->isThrown());
|
||||
}
|
||||
|
||||
|
||||
|
104
WiThrottle.cpp
104
WiThrottle.cpp
@@ -53,7 +53,7 @@
|
||||
#include "DIAG.h"
|
||||
#include "GITHUB_SHA.h"
|
||||
#include "version.h"
|
||||
#include "RMFT2.h"
|
||||
#include "EXRAIL2.h"
|
||||
#include "CommandDistributor.h"
|
||||
|
||||
#define LOOPLOCOS(THROTTLECHAR, CAB) for (int loco=0;loco<MAX_MY_LOCO;loco++) \
|
||||
@@ -119,24 +119,38 @@ void WiThrottle::parse(RingStream * stream, byte * cmdx) {
|
||||
if (turnoutListHash != Turnout::turnoutlistHash) {
|
||||
StringFormatter::send(stream,F("PTL"));
|
||||
for(Turnout *tt=Turnout::first();tt!=NULL;tt=tt->next()){
|
||||
if (tt->isHidden()) continue;
|
||||
int id=tt->getId();
|
||||
StringFormatter::send(stream,F("]\\[%d}|{"), id);
|
||||
#ifdef RMFT_ACTIVE
|
||||
RMFT2::emitTurnoutDescription(stream,id);
|
||||
#else
|
||||
StringFormatter::send(stream,F("%d"), id);
|
||||
#endif
|
||||
StringFormatter::send(stream,F("}|{%c"), Turnout::isClosed(id)?'2':'4');
|
||||
const FSH * tdesc=NULL;
|
||||
#ifdef EXRAIL_ACTIVE
|
||||
tdesc=RMFT2::getTurnoutDescription(id);
|
||||
#endif
|
||||
char tchar=Turnout::isClosed(id)?'2':'4';
|
||||
if (tdesc==NULL) // turnout with no description
|
||||
StringFormatter::send(stream,F("]\\[%d}|{T%d}|{%c"), id,id,tchar);
|
||||
else
|
||||
StringFormatter::send(stream,F("]\\[%d}|{%S}|{%c"), id,tdesc,tchar);
|
||||
}
|
||||
StringFormatter::send(stream,F("\n"));
|
||||
turnoutListHash = Turnout::turnoutlistHash; // keep a copy of hash for later comparison
|
||||
}
|
||||
|
||||
else if (!exRailSent) {
|
||||
// Send ExRail routes list if not already sent (but not at same time as turnouts above)
|
||||
// Send EX-RAIL routes list if not already sent (but not at same time as turnouts above)
|
||||
exRailSent=true;
|
||||
#ifdef RMFT_ACTIVE
|
||||
RMFT2::emitWithrottleRouteList(stream);
|
||||
#ifdef EXRAIL_ACTIVE
|
||||
StringFormatter::send(stream,F("PRT]\\[Routes}|{Route]\\[Set}|{2]\\[Handoff}|{4\nPRL"));
|
||||
for (byte pass=0;pass<2;pass++) {
|
||||
// first pass automations, second pass routes.
|
||||
for (int ix=0;;ix++) {
|
||||
int16_t id=GETFLASHW((pass?RMFT2::automationIdList:RMFT2::routeIdList)+ix);
|
||||
if (id==0) break;
|
||||
const FSH * desc=RMFT2::getRouteDescription(id);
|
||||
StringFormatter::send(stream,F("]\\[%c%d}|{%S}|{%c"),
|
||||
pass?'A':'R',id,desc, pass?'4':'2');
|
||||
}
|
||||
}
|
||||
StringFormatter::send(stream,F("\n"));
|
||||
#endif
|
||||
// allow heartbeat to slow down once all metadata sent
|
||||
StringFormatter::send(stream,F("*%d\n"),HEARTBEAT_SECONDS);
|
||||
@@ -156,7 +170,7 @@ void WiThrottle::parse(RingStream * stream, byte * cmdx) {
|
||||
DCCWaveform::progTrack.setPowerMode(cmd[3]=='1'?POWERMODE::ON:POWERMODE::OFF);
|
||||
CommandDistributor::broadcastPower();
|
||||
}
|
||||
#if defined(RMFT_ACTIVE)
|
||||
#if defined(EXRAIL_ACTIVE)
|
||||
else if (cmd[1]=='R' && cmd[2]=='A' && cmd[3]=='2' ) { // Route activate
|
||||
// exrail routes are RA2Rn , Animations are RA2An
|
||||
int route=getInt(cmd+5);
|
||||
@@ -205,9 +219,19 @@ void WiThrottle::parse(RingStream * stream, byte * cmdx) {
|
||||
StringFormatter::send(stream,F("HtDCC-EX v%S, %S, %S, %S\n"), F(VERSION), F(ARDUINO_TYPE), DCC::getMotorShieldName(), F(GITHUB_SHA));
|
||||
StringFormatter::send(stream,F("PTT]\\[Turnouts}|{Turnout]\\[THROW}|{2]\\[CLOSE}|{4\n"));
|
||||
StringFormatter::send(stream,F("PPA%x\n"),DCCWaveform::mainTrack.getPowerMode()==POWERMODE::ON);
|
||||
#ifdef RMFT_ACTIVE
|
||||
RMFT2::emitWithrottleRoster(stream);
|
||||
#endif
|
||||
|
||||
// Send the roster
|
||||
#ifdef EXRAIL_ACTIVE
|
||||
StringFormatter::send(stream,F("RL%d"), RMFT2::rosterNameCount);
|
||||
for (int16_t r=0;r<RMFT2::rosterNameCount;r++) {
|
||||
int16_t cabid=GETFLASHW(RMFT2::rosterIdList+r);
|
||||
StringFormatter::send(stream,F("]\\[%S}|{%d}|{%c"),
|
||||
RMFT2::getRosterName(cabid),cabid,cabid<128?'S':'L');
|
||||
}
|
||||
stream->write('\n'); // end roster
|
||||
#endif
|
||||
|
||||
|
||||
// set heartbeat to 1 second because we need to sync the metadata
|
||||
StringFormatter::send(stream,F("*1\n"));
|
||||
initSent = true;
|
||||
@@ -231,11 +255,14 @@ void WiThrottle::parse(RingStream * stream, byte * cmdx) {
|
||||
|
||||
int WiThrottle::getInt(byte * cmd) {
|
||||
int i=0;
|
||||
bool negate=cmd[0]=='-';
|
||||
if (negate) cmd++;
|
||||
while (cmd[0]>='0' && cmd[0]<='9') {
|
||||
i=i*10 + (cmd[0]-'0');
|
||||
cmd++;
|
||||
}
|
||||
return i;
|
||||
if (negate) i=0-i;
|
||||
return i ;
|
||||
}
|
||||
|
||||
int WiThrottle::getLocoId(byte * cmd) {
|
||||
@@ -287,7 +314,7 @@ void WiThrottle::multithrottle(RingStream * stream, byte * cmd){
|
||||
int fkeys=29;
|
||||
myLocos[loco].functionToggles=1<<2; // F2 (HORN) is a non-toggle
|
||||
|
||||
#ifdef RMFT_ACTIVE
|
||||
#ifdef EXRAIL_ACTIVE
|
||||
const char * functionNames=(char *) RMFT2::getRosterFunctions(locoid);
|
||||
if (!functionNames) {
|
||||
// no roster, use presets as above
|
||||
@@ -514,25 +541,32 @@ char WiThrottle::stashThrottleChar;
|
||||
void WiThrottle::getLocoCallback(int16_t locoid) {
|
||||
stashStream->mark(stashClient);
|
||||
|
||||
if (locoid<=0)
|
||||
if (locoid<=0) {
|
||||
StringFormatter::send(stashStream,F("HMNo loco found on prog track\n"));
|
||||
else {
|
||||
// short or long
|
||||
char addrchar;
|
||||
if (locoid & LONG_ADDR_MARKER) { // long addr
|
||||
locoid = locoid ^ LONG_ADDR_MARKER;
|
||||
addrchar = 'L';
|
||||
} else
|
||||
addrchar = 'S';
|
||||
if (addrchar == 'L' && locoid <= HIGHEST_SHORT_ADDR )
|
||||
StringFormatter::send(stashStream,F("HMLong addr %d <= %d not supported\n"), locoid,HIGHEST_SHORT_ADDR);
|
||||
else {
|
||||
char addcmd[20]={'M',stashThrottleChar,'+', addrchar};
|
||||
itoa(locoid,addcmd+4,10);
|
||||
stashInstance->multithrottle(stashStream, (byte *)addcmd);
|
||||
DCCWaveform::progTrack.setPowerMode(POWERMODE::ON);
|
||||
DCC::setProgTrackSyncMain(true); // <1 JOIN> so we can drive loco away
|
||||
}
|
||||
stashStream->commit(); // done here, commit and return
|
||||
return;
|
||||
}
|
||||
|
||||
// short or long
|
||||
char addrchar;
|
||||
if (locoid & LONG_ADDR_MARKER) { // maker bit indicates long addr
|
||||
locoid = locoid ^ LONG_ADDR_MARKER; // remove marker bit to get real long addr
|
||||
if (locoid <= HIGHEST_SHORT_ADDR ) { // out of range for long addr
|
||||
StringFormatter::send(stashStream,F("HMLong addr %d <= %d unsupported\n"), locoid, HIGHEST_SHORT_ADDR);
|
||||
stashStream->commit(); // done here, commit and return
|
||||
return;
|
||||
}
|
||||
addrchar = 'L';
|
||||
} else {
|
||||
addrchar = 'S';
|
||||
}
|
||||
|
||||
char addcmd[20]={'M',stashThrottleChar,'+', addrchar};
|
||||
itoa(locoid,addcmd+4,10);
|
||||
stashInstance->multithrottle(stashStream, (byte *)addcmd);
|
||||
DCCWaveform::progTrack.setPowerMode(POWERMODE::ON);
|
||||
DCC::setProgTrackSyncMain(true); // <1 JOIN> so we can drive loco away
|
||||
stashStream->commit();
|
||||
CommandDistributor::broadcastPower();
|
||||
|
||||
}
|
||||
|
@@ -276,6 +276,7 @@ wifiSerialState WifiInterface::setup2(const FSH* SSid, const FSH* password,
|
||||
checkForOK(2000, true);
|
||||
}
|
||||
}
|
||||
#endif //DONT_TOUCH_WIFI_CONF
|
||||
|
||||
StringFormatter::send(wifiStream, F("AT+CIPSERVER=0\r\n")); // turn off tcp server (to clean connections before CIPMUX=1)
|
||||
checkForOK(1000, true); // ignore result in case it already was off
|
||||
@@ -291,7 +292,6 @@ wifiSerialState WifiInterface::setup2(const FSH* SSid, const FSH* password,
|
||||
|
||||
StringFormatter::send(wifiStream, F("AT+CIPSERVER=1,%d\r\n"), port); // turn on server on port
|
||||
if (!checkForOK(1000, true)) return WIFI_DISCONNECTED;
|
||||
#endif //DONT_TOUCH_WIFI_CONF
|
||||
|
||||
StringFormatter::send(wifiStream, F("AT+CIFSR\r\n")); // Display ip addresses to the DIAG
|
||||
if (!checkForOK(1000, F("IP,\"") , true, false)) return WIFI_DISCONNECTED;
|
||||
|
@@ -29,7 +29,7 @@ The configuration file for DCC-EX Command Station
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
// NOTE: Before connecting these boards and selecting one in this software
|
||||
// check the quick install guides!!! Some of these boards require a voltage
|
||||
// generating resitor on the current sense pin of the device. Failure to select
|
||||
// generating resistor on the current sense pin of the device. Failure to select
|
||||
// the correct resistor could damage the sense pin on your Arduino or destroy
|
||||
// the device.
|
||||
//
|
||||
@@ -41,6 +41,7 @@ The configuration file for DCC-EX Command Station
|
||||
// FIREBOX_MK1 : The Firebox MK1
|
||||
// FIREBOX_MK1S : The Firebox MK1S
|
||||
// IBT_2_WITH_ARDUINO : Arduino Motor Shield for PROG and IBT-2 for MAIN
|
||||
// EX8874_SHIELD : DCC-EX TI DRV8874 based motor shield
|
||||
// |
|
||||
// +-----------------------v
|
||||
//
|
||||
@@ -85,7 +86,7 @@ The configuration file for DCC-EX Command Station
|
||||
// WIFI_PASSWORD is the network password for your home network or if
|
||||
// you want to change the password from default AP mode password
|
||||
// to the AP password you want.
|
||||
// Your password may not conain ``"'' (double quote, ASCII 0x22).
|
||||
// Your password may not contain ``"'' (double quote, ASCII 0x22).
|
||||
#define WIFI_PASSWORD "Your network passwd"
|
||||
//
|
||||
// WIFI_HOSTNAME: You probably don't need to change this
|
||||
@@ -125,10 +126,13 @@ The configuration file for DCC-EX Command Station
|
||||
|
||||
//OR define OLED_DRIVER width,height in pixels (address auto detected)
|
||||
// 128x32 or 128x64 I2C SSD1306-based devices are supported.
|
||||
// Also 132x64 I2C SH1106 devices
|
||||
// Use 132,64 for a SH1106-based I2C device with a 128x64 display.
|
||||
// #define OLED_DRIVER 128,32
|
||||
|
||||
// Define scroll mode as 0, 1 or 2
|
||||
// * #define SCROLLMODE 0 is scroll continuous (fill screen if poss),
|
||||
// * #define SCROLLMODE 1 is by page (alternate between pages),
|
||||
// * #define SCROLLMODE 2 is by row (move up 1 row at a time).
|
||||
#define SCROLLMODE 1
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -137,7 +141,7 @@ The configuration file for DCC-EX Command Station
|
||||
// If you do not need the EEPROM at all, you can disable all the code that saves
|
||||
// data in the EEPROM. You might want to do that if you are in a Arduino UNO
|
||||
// and want to use the EX-RAIL automation. Otherwise you do not have enough RAM
|
||||
// to do that. Of course, then none of the EEPROM related commands works.
|
||||
// to do that. Of course, then none of the EEPROM related commands work.
|
||||
//
|
||||
// #define DISABLE_EEPROM
|
||||
|
||||
@@ -174,7 +178,7 @@ The configuration file for DCC-EX Command Station
|
||||
|
||||
// If you have issues with that the direction of the accessory commands is
|
||||
// reversed (for example when converting from another CS to DCC-EX) then
|
||||
// you can use this to revese the sense of all accessory commmands sent
|
||||
// you can use this to reverse the sense of all accessory commmands sent
|
||||
// over DCC++. This #define likewise inverts the behaviour of the <a> command
|
||||
// for triggering DCC Accessory Decoders, so that <a addr subaddr 0> generates a
|
||||
// DCC packet with D=1 (close turnout) and <a addr subaddr 1> generates D=0
|
||||
@@ -189,8 +193,8 @@ The configuration file for DCC-EX Command Station
|
||||
// To monitor a throttle on one or more serial ports, uncomment the defines below.
|
||||
// NOTE: do not define here the WiFi shield serial port or your wifi will not work.
|
||||
//
|
||||
//#define SERIAL1_COMMAND
|
||||
//#define SERIAL2_COMMAND
|
||||
//#define SERIAL3_COMMAND
|
||||
//#define SERIAL1_COMMANDS
|
||||
//#define SERIAL2_COMMANDS
|
||||
//#define SERIAL3_COMMANDS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@@ -81,7 +81,7 @@
|
||||
|
||||
#if __has_include ( "myAutomation.h")
|
||||
#if defined(BIG_RAM) || defined(DISABLE_EEPROM)
|
||||
#define RMFT_ACTIVE
|
||||
#define EXRAIL_ACTIVE
|
||||
#else
|
||||
#define EXRAIL_WARNING
|
||||
#endif
|
||||
|
270
installer.json
Normal file
270
installer.json
Normal file
@@ -0,0 +1,270 @@
|
||||
[
|
||||
{
|
||||
"Name": "BaseStationClassic",
|
||||
"Git": "DCC-EX/BaseStation-Classic",
|
||||
"Libraries": [
|
||||
{
|
||||
"Name": "Ethernet",
|
||||
"Repo": "arduino-libraries/Ethernet",
|
||||
"Location": "libraries/Ethernet",
|
||||
"LibraryDownloadAvailable": true
|
||||
}
|
||||
],
|
||||
"SupportedBoards": [
|
||||
{
|
||||
"Name": "Uno",
|
||||
"FQBN": "arduino:avr:uno",
|
||||
"Platforms": [
|
||||
{
|
||||
"Architecture": "avr",
|
||||
"Package": "arduino"
|
||||
}
|
||||
],
|
||||
"SupportedMotoShields": [
|
||||
{
|
||||
"Name": "Arduino Motor Shield",
|
||||
"Declaration": "STANDARD_MOTOR_SHIELD"
|
||||
},
|
||||
{
|
||||
"Name": "Pololu MC33926 Motor Shield",
|
||||
"Declaration": "POLOLU_MOTOR_SHIELD"
|
||||
}
|
||||
],
|
||||
"ExtraLibraries": []
|
||||
},
|
||||
{
|
||||
"Name": "Mega",
|
||||
"FQBN": "arduino:avr:mega",
|
||||
"Platforms": [
|
||||
{
|
||||
"Architecture": "avr",
|
||||
"Package": "arduino"
|
||||
}
|
||||
],
|
||||
"SupportedMotoShields": [
|
||||
{
|
||||
"Name": "Arduino Motor Shield",
|
||||
"Declaration": "STANDARD_MOTOR_SHIELD"
|
||||
},
|
||||
{
|
||||
"Name": "Pololu MC33926 Motor Shield",
|
||||
"Declaration": "POLOLU_MOTOR_SHIELD"
|
||||
}
|
||||
],
|
||||
"ExtraLibraries": []
|
||||
}
|
||||
],
|
||||
"DisplayName": "Base Station Classic",
|
||||
"InputFileLocation": "DCCpp",
|
||||
"AllowAdvanced": false,
|
||||
"ConfigFile": "DCCpp/Config.h"
|
||||
},
|
||||
{
|
||||
"Name": "CommandStation-EX",
|
||||
"Git": "DCC-EX/CommandStation-EX",
|
||||
"Libraries": [
|
||||
{
|
||||
"Name": "Ethernet",
|
||||
"Repo": "arduino-libraries/Ethernet",
|
||||
"Location": "libraries/Ethernet",
|
||||
"LibraryDownloadAvailable": true
|
||||
},
|
||||
{
|
||||
"Name": "DIO2",
|
||||
"Repo": "",
|
||||
"Location": "libraries/DIO2",
|
||||
"LibraryDownloadAvailable": true
|
||||
}
|
||||
],
|
||||
"SupportedBoards": [
|
||||
{
|
||||
"Name": "Uno",
|
||||
"FQBN": "arduino:avr:uno",
|
||||
"Platforms": [
|
||||
{
|
||||
"Architecture": "avr",
|
||||
"Package": "arduino"
|
||||
}
|
||||
],
|
||||
"SupportedMotoShields": [
|
||||
{
|
||||
"Name": "Arduino Motor Shield",
|
||||
"Declaration": "STANDARD_MOTOR_SHIELD"
|
||||
},
|
||||
{
|
||||
"Name": "Pololu MC33926 Motor Shield",
|
||||
"Declaration": "POLOLU_MOTOR_SHIELD"
|
||||
}
|
||||
],
|
||||
"ExtraLibraries": []
|
||||
},
|
||||
{
|
||||
"Name": "Mega",
|
||||
"FQBN": "arduino:avr:mega",
|
||||
"Platforms": [
|
||||
{
|
||||
"Architecture": "avr",
|
||||
"Package": "arduino"
|
||||
}
|
||||
],
|
||||
"SupportedMotoShields": [
|
||||
{
|
||||
"Name": "Arduino Motor Shield",
|
||||
"Declaration": "STANDARD_MOTOR_SHIELD"
|
||||
},
|
||||
{
|
||||
"Name": "Pololu MC33926 Motor Shield",
|
||||
"Declaration": "POLOLU_MOTOR_SHIELD"
|
||||
}
|
||||
],
|
||||
"ExtraLibraries": []
|
||||
},
|
||||
{
|
||||
"Name": "Mega Wifi",
|
||||
"FQBN": "arduino:avr:mega",
|
||||
"Platforms": [
|
||||
{
|
||||
"Architecture": "avr",
|
||||
"Package": "arduino"
|
||||
}
|
||||
],
|
||||
"SupportedMotoShields": [
|
||||
{
|
||||
"Name": "Arduino Motor Shield",
|
||||
"Declaration": "STANDARD_MOTOR_SHIELD"
|
||||
},
|
||||
{
|
||||
"Name": "Pololu MC33926 Motor Shield",
|
||||
"Declaration": "POLOLU_MOTOR_SHIELD"
|
||||
}
|
||||
],
|
||||
"ExtraLibraries": []
|
||||
},
|
||||
{
|
||||
"Name": "Nano",
|
||||
"FQBN": "arduino:avr:nano",
|
||||
"Platforms": [
|
||||
{
|
||||
"Architecture": "avr",
|
||||
"Package": "arduino"
|
||||
}
|
||||
],
|
||||
"SupportedMotoShields": [
|
||||
{
|
||||
"Name": "Arduino Motor Shield",
|
||||
"Declaration": "STANDARD_MOTOR_SHIELD"
|
||||
},
|
||||
{
|
||||
"Name": "Pololu MC33926 Motor Shield",
|
||||
"Declaration": "POLOLU_MOTOR_SHIELD"
|
||||
}
|
||||
],
|
||||
"ExtraLibraries": []
|
||||
},
|
||||
{
|
||||
"Name": "Nano Every",
|
||||
"FQBN": "arduino:megaavr:nanoevery",
|
||||
"Platforms": [
|
||||
{
|
||||
"Architecture": "megaavr",
|
||||
"Package": "arduino"
|
||||
}
|
||||
],
|
||||
"SupportedMotoShields": [
|
||||
{
|
||||
"Name": "Arduino Motor Shield",
|
||||
"Declaration": "STANDARD_MOTOR_SHIELD"
|
||||
},
|
||||
{
|
||||
"Name": "Pololu MC33926 Motor Shield",
|
||||
"Declaration": "POLOLU_MOTOR_SHIELD"
|
||||
}
|
||||
],
|
||||
"ExtraLibraries": []
|
||||
},
|
||||
{
|
||||
"Name": "Teensy 3.x",
|
||||
"FQBN": "teensy:avr:teensy31",
|
||||
"Platforms": [
|
||||
{
|
||||
"Architecture": "teensy",
|
||||
"Package": "arduino"
|
||||
}
|
||||
],
|
||||
"SupportedMotoShields": [
|
||||
{
|
||||
"Name": "Arduino Motor Shield",
|
||||
"Declaration": "STANDARD_MOTOR_SHIELD"
|
||||
},
|
||||
{
|
||||
"Name": "Pololu MC33926 Motor Shield",
|
||||
"Declaration": "POLOLU_MOTOR_SHIELD"
|
||||
}
|
||||
],
|
||||
"ExtraLibraries": []
|
||||
},
|
||||
{
|
||||
"Name": "Teensy 4.x",
|
||||
"FQBN": "teensy:avr:teensy41",
|
||||
"Platforms": [
|
||||
{
|
||||
"Architecture": "teensy",
|
||||
"Package": "arduino"
|
||||
}
|
||||
],
|
||||
"SupportedMotoShields": [
|
||||
{
|
||||
"Name": "Arduino Motor Shield",
|
||||
"Declaration": "STANDARD_MOTOR_SHIELD"
|
||||
},
|
||||
{
|
||||
"Name": "Pololu MC33926 Motor Shield",
|
||||
"Declaration": "POLOLU_MOTOR_SHIELD"
|
||||
}
|
||||
],
|
||||
"ExtraLibraries": []
|
||||
},
|
||||
{
|
||||
"Name": "SAMD21",
|
||||
"FQBN": "SparkFun:samd",
|
||||
"Platforms": [
|
||||
{
|
||||
"Architecture": "avr",
|
||||
"Package": "arduino"
|
||||
},
|
||||
{
|
||||
"Architecture": "samd",
|
||||
"Package": "arduino"
|
||||
},
|
||||
{
|
||||
"Architecture": "samd",
|
||||
"Package": "SparkFun"
|
||||
}
|
||||
],
|
||||
"SupportedMotoShields": [
|
||||
{
|
||||
"Name": "Arduino Motor Shield",
|
||||
"Declaration": "STANDARD_MOTOR_SHIELD"
|
||||
},
|
||||
{
|
||||
"Name": "Pololu MC33926 Motor Shield",
|
||||
"Declaration": "POLOLU_MOTOR_SHIELD"
|
||||
},
|
||||
{
|
||||
"Name": "FireBox MK1",
|
||||
"Declaration": "FIREBOX_MK1"
|
||||
},
|
||||
{
|
||||
"Name": "FireBox MK1S",
|
||||
"Declaration": "FIREBOX_MK1S"
|
||||
}
|
||||
],
|
||||
"ExtraLibraries": []
|
||||
}
|
||||
],
|
||||
"DisplayName": "CommandStation EX",
|
||||
"InputFileLocation": "",
|
||||
"AllowAdvanced": true,
|
||||
"ConfigFile": "config.h"
|
||||
}
|
||||
]
|
62
log2lrc.py
Executable file
62
log2lrc.py
Executable file
@@ -0,0 +1,62 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# Copyright 2022 Harald Barth
|
||||
#
|
||||
# This converts serial logs with timestamps from the
|
||||
# Arduino IDE to LRC format.
|
||||
#
|
||||
# This is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# It is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with CommandStation. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# Usage: log2lrc.py HH:MM:SS HH:MM:SS filename
|
||||
# logtime videotime
|
||||
# The resulting timestamps will be adjusted by logtime - videotime.
|
||||
# logtime > videotime
|
||||
|
||||
import sys
|
||||
import datetime
|
||||
import fileinput
|
||||
import re
|
||||
|
||||
timediff = datetime.datetime.strptime('00:00:00','%H:%M:%S')
|
||||
|
||||
def convert(timestr):
|
||||
times=timestr.split('.',1) # remove fractions of second
|
||||
timestamp_obj=datetime.datetime.strptime(times[0],'%H:%M:%S')
|
||||
timestamp_obj=timestamp_obj-timediff # calculate offset
|
||||
timestr='{0:%M:%S}'.format(timestamp_obj)
|
||||
timestr='%s.%s' % (timestr, times[1][0:2]) # add fractions of second, 2 digits
|
||||
return timestr
|
||||
|
||||
def main(argv):
|
||||
global timediff
|
||||
fromtime_str=sys.argv[1]
|
||||
fromtime_obj=datetime.datetime.strptime(fromtime_str,'%H:%M:%S')
|
||||
totime_str=sys.argv[2]
|
||||
totime_obj=datetime.datetime.strptime(totime_str,'%H:%M:%S')
|
||||
sys.argv=sys.argv[2:]
|
||||
|
||||
|
||||
timediff = fromtime_obj - totime_obj
|
||||
|
||||
for line in fileinput.input():
|
||||
line = re.split('\s+', line, 1)
|
||||
if (len(line) > 1 and len(line[1]) > 1):
|
||||
l = line[1].replace('\n','')
|
||||
l = l.replace('\r','')
|
||||
l = re.sub('^-> ','',l)
|
||||
print("[%s]%s" % (convert(line[0]),l))
|
||||
|
||||
if __name__ == "__main__":
|
||||
main(sys.argv)
|
||||
|
@@ -1,19 +1,18 @@
|
||||
/* This is an automation example file.
|
||||
* The presence of a file calle "myAutomation.h" brings EX-RAIL code into
|
||||
* The presence of a file called "myAutomation.h" brings EX-RAIL code into
|
||||
* the command station.
|
||||
* The auotomation may have multiple concurrent tasks.
|
||||
* The automation may have multiple concurrent tasks.
|
||||
* A task may
|
||||
* - Act as a ROUTE setup macro for a user to drive over
|
||||
* - drive a loco through an AUTOMATION
|
||||
* - automate some cosmetic part of the layout without any loco.
|
||||
*
|
||||
* At startup, a single task is created to execute the first
|
||||
* instruction after E$XRAIL.
|
||||
* At startup, a single task is created to execute the startup sequence.
|
||||
* This task may simply follow a route, or may START
|
||||
* further tasks (thats is.. send a loco out along a route).
|
||||
* further tasks (that is.. send a loco out along a route).
|
||||
*
|
||||
* Where the loco id is not known at compile time, a new task
|
||||
* can be creatd with the command:
|
||||
* can be created with the command:
|
||||
* </ START [cab] route>
|
||||
*
|
||||
* A ROUTE, AUTOMATION or SEQUENCE are internally identical in ExRail terms
|
||||
@@ -24,11 +23,10 @@
|
||||
*
|
||||
*/
|
||||
|
||||
EXRAIL // myAutomation must start with the EXRAIL instruction
|
||||
// This is the default starting route, AKA SEQUENCE(0)
|
||||
SENDLOCO(3,1) // send loco 3 off along route 1
|
||||
SENDLOCO(10,2) // send loco 10 off along route 2
|
||||
DONE // This just ends the startup thread, leaving 2 others running.
|
||||
// This is the startup sequence, AKA SEQUENCE(0)
|
||||
SENDLOCO(3,1) // send loco 3 off along route 1
|
||||
SENDLOCO(10,2) // send loco 10 off along route 2
|
||||
DONE // This just ends the startup thread, leaving 2 others running.
|
||||
|
||||
/* SEQUENCE(1) is a simple shuttle between 2 sensors
|
||||
* S20 and S21 are sensors on arduino pins 20 and 21
|
||||
@@ -78,7 +76,3 @@ EXRAIL // myAutomation must start with the EXRAIL instruction
|
||||
AT(33) STOP
|
||||
DELAY(20000) // wait 20 seconds
|
||||
FOLLOW(2) // follow sequence 2... ie repeat the process
|
||||
|
||||
ENDEXRAIL // marks the end of the EXRAIL program.
|
||||
|
||||
|
||||
|
192
myAutomation2.h
192
myAutomation2.h
@@ -1,192 +0,0 @@
|
||||
|
||||
/* This is an automation example file.
|
||||
* The presence of a file calle "myAutomation.h" brings EX-RAIL code into
|
||||
* the command station.
|
||||
* The auotomation may have multiple concurrent tasks.
|
||||
* A task may drive one loco through a ROUTE or may simply
|
||||
* automate some other part of the layout without any loco.
|
||||
*
|
||||
* At startup, a single task is created to execute the first
|
||||
* instruction after ROUTES.
|
||||
* This task may simply follow a route, or may SCHEDULE
|
||||
* further tasks (thats is.. send a loco out along a route).
|
||||
*
|
||||
* Where the loco id is not known at compile time, a new task
|
||||
* can be creatd with the command:
|
||||
* </ SCHEDULE [cab] route>
|
||||
*
|
||||
*/
|
||||
|
||||
// Include the name to pin mappings for my layout
|
||||
#include "myLayout.h"
|
||||
|
||||
ALIAS(ROUTE_1,1)
|
||||
ALIAS(UP_MOUNTAIN,8)
|
||||
ALIAS(UP_MOUNTAIN_FROM_PROG,88)
|
||||
ALIAS(INNER_LOOP,7)
|
||||
ALIAS(INNER_FROM_PROG,77)
|
||||
|
||||
//EXRAIL // myAutomation must start with the EXRAIL instruction
|
||||
// This is the default starting route, AKA ROUTE(0)
|
||||
// START(999) // this is just a diagnostic test cycle
|
||||
PRINT("started")
|
||||
LCD(0,"EXRAIL RULES")
|
||||
SERIAL("I had one of them but the leg fell off!")
|
||||
DONE // This just ends the startup thread
|
||||
|
||||
|
||||
/*AUTOSTART*/ ROUTE(ROUTE_1,"Close All")
|
||||
LCD(1,"Bingo")
|
||||
CLOSE(TOP_TURNOUT) DELAY(10)
|
||||
CLOSE(Y_TURNOUT) DELAY(10)
|
||||
CLOSE(MIDDLE_TURNOUT) DELAY(10)
|
||||
CLOSE(JOIN_TURNOUT) DELAY(10)
|
||||
CLOSE(LOWER_TURNOUT) DELAY(10)
|
||||
CLOSE(CROSSOVER_TURNOUT) DELAY(10)
|
||||
CLOSE(PROG_TURNOUT) DELAY(10)
|
||||
PRINT("Close All completed")
|
||||
|
||||
ENDTASK
|
||||
|
||||
|
||||
SEQUENCE(UP_MOUNTAIN) // starting at the lower closed turnout siding and going up the mountain
|
||||
PRINT("Up Mountain started")
|
||||
DELAY(10000) // wait 10 seconds
|
||||
RESERVE(BLOCK_LOWER_MOUNTAIN)
|
||||
CLOSE(LOWER_TURNOUT) CLOSE(JOIN_TURNOUT)
|
||||
FWD(60) AT(Y_LOWER)
|
||||
RESERVE(BLOCK_X_MOUNTAIN)
|
||||
CLOSE(Y_TURNOUT) CLOSE(MIDDLE_TURNOUT)
|
||||
FWD(40) AT(MIDDLE_C_BUFFER) STOP
|
||||
FREE(BLOCK_X_MOUNTAIN) FREE(BLOCK_LOWER_MOUNTAIN)
|
||||
DELAY(10000)
|
||||
RESERVE(BLOCK_UPPER_MOUNTAIN) RESERVE(BLOCK_X_MOUNTAIN)
|
||||
CLOSE(MIDDLE_TURNOUT) THROW(Y_TURNOUT) THROW(TOP_TURNOUT)
|
||||
REV(55)
|
||||
AFTER(Y_UPPER) FREE(BLOCK_X_MOUNTAIN)
|
||||
REV(55) AT(TOP_T_BUFFER) STOP // At top of mountain
|
||||
FREE(BLOCK_UPPER_MOUNTAIN)
|
||||
DELAY(5000)
|
||||
RESERVE(BLOCK_UPPER_MOUNTAIN)
|
||||
THROW(TOP_TURNOUT)
|
||||
FWD(60) AT(Y_UPPER)
|
||||
RESERVE(BLOCK_X_MOUNTAIN)
|
||||
THROW(Y_TURNOUT) CLOSE(MIDDLE_TURNOUT)
|
||||
FWD(40) AT(MIDDLE_C_BUFFER) STOP
|
||||
FREE(BLOCK_UPPER_MOUNTAIN) FREE(BLOCK_X_MOUNTAIN)
|
||||
DELAY(6000)
|
||||
RESERVE(BLOCK_LOWER_MOUNTAIN) RESERVE(BLOCK_X_MOUNTAIN)
|
||||
CLOSE(MIDDLE_TURNOUT) CLOSE(Y_TURNOUT) CLOSE(JOIN_TURNOUT) CLOSE(LOWER_TURNOUT)
|
||||
REV(60)
|
||||
AFTER(Y_LOWER) FREE(BLOCK_X_MOUNTAIN)
|
||||
AT(LOWER_C_BUFFER) STOP
|
||||
FREE(BLOCK_LOWER_MOUNTAIN)
|
||||
FOLLOW(UP_MOUNTAIN)
|
||||
|
||||
AUTOMATION(UP_MOUNTAIN_FROM_PROG,"Send up mountain from prog")
|
||||
JOIN
|
||||
RESERVE(BLOCK_LOWER_MOUNTAIN)
|
||||
RESERVE(BLOCK_X_INNER)
|
||||
RESERVE(BLOCK_X_OUTER)
|
||||
// safe to cross
|
||||
THROW(PROG_TURNOUT) THROW(CROSSOVER_TURNOUT) THROW(JOIN_TURNOUT)
|
||||
FWD(45)
|
||||
AFTER(JOIN_AFTER) STOP
|
||||
CLOSE(PROG_TURNOUT) CLOSE(CROSSOVER_TURNOUT) CLOSE(JOIN_TURNOUT)
|
||||
FREE(BLOCK_X_OUTER) FREE(BLOCK_X_INNER)
|
||||
CLOSE(LOWER_TURNOUT)
|
||||
REV(40) AT(LOWER_C_BUFFER) STOP
|
||||
FREE(BLOCK_LOWER_MOUNTAIN)
|
||||
FOLLOW(UP_MOUNTAIN)
|
||||
|
||||
SEQUENCE(INNER_LOOP)
|
||||
FWD(50)
|
||||
AT(CROSSOVER_INNER_BEFORE)
|
||||
RESERVE(BLOCK_X_INNER)
|
||||
CLOSE(CROSSOVER_TURNOUT)
|
||||
FWD(50)
|
||||
AFTER(CROSSOVER_INNER_AFTER)
|
||||
FREE(BLOCK_X_INNER)
|
||||
FOLLOW(INNER_LOOP)
|
||||
|
||||
|
||||
// Turnout definitions
|
||||
TURNOUT(TOP_TURNOUT, TOP_TURNOUT,0,"Top Station")
|
||||
TURNOUT(Y_TURNOUT, Y_TURNOUT,0,"Mountain join")
|
||||
TURNOUT(MIDDLE_TURNOUT, MIDDLE_TURNOUT,0,"Middle Station")
|
||||
TURNOUT(JOIN_TURNOUT,JOIN_TURNOUT,0)
|
||||
TURNOUT(LOWER_TURNOUT,LOWER_TURNOUT,0)
|
||||
TURNOUT(CROSSOVER_TURNOUT,CROSSOVER_TURNOUT,0)
|
||||
TURNOUT(PROG_TURNOUT,PROG_TURNOUT,0)
|
||||
|
||||
// Single slip protection
|
||||
ONTHROW(2)
|
||||
THROW(1)
|
||||
DONE
|
||||
ONCLOSE(1)
|
||||
CLOSE(2)
|
||||
DONE
|
||||
|
||||
|
||||
ROUTE(61,"Call return test")
|
||||
PRINT("In 61 test 1")
|
||||
CALL(62)
|
||||
PRINT("In 61 test 2")
|
||||
CALL(62)
|
||||
PRINT("In 61 test 3")
|
||||
ACTIVATE(100,2)
|
||||
DEACTIVATE(100,2)
|
||||
DONE
|
||||
|
||||
SEQUENCE(62)
|
||||
PRINT("In seq 62")
|
||||
RETURN
|
||||
|
||||
ROUTE(63,"Signal test 40,41,42")
|
||||
SIGNAL(40,41,42)
|
||||
DELAY(2000)
|
||||
RED(40)
|
||||
DELAY(2000)
|
||||
AMBER(40)
|
||||
DELAY(2000)
|
||||
GREEN(40)
|
||||
FOLLOW(63)
|
||||
|
||||
|
||||
ROUTE(64,"Func test 6772")
|
||||
XFON(6772,1)
|
||||
DELAY(5000)
|
||||
XFOFF(6772,1)
|
||||
DELAY(5000)
|
||||
FOLLOW(64)
|
||||
|
||||
ROUTE(65,"Negative sensor test")
|
||||
PRINT(" WAIT for -176")
|
||||
AT(-176)
|
||||
PRINT(" WAIT for 176")
|
||||
AT(176)
|
||||
PRINT("done")
|
||||
DONE
|
||||
|
||||
ROUTE(123,"Activate stuff")
|
||||
ACTIVATEL(5)
|
||||
ACTIVATE(7,2)
|
||||
DEACTIVATE(3,2)
|
||||
DEACTIVATEL(6)
|
||||
DONE
|
||||
|
||||
ONACTIVATEL(5)
|
||||
PRINT("ACT 5")
|
||||
DONE
|
||||
ONACTIVATE(7,2)
|
||||
PRINT("ACT 7,2")
|
||||
DONE
|
||||
ONDEACTIVATE(7,2)
|
||||
PRINT("DEACT 7,2")
|
||||
DONE
|
||||
ONDEACTIVATEL(5)
|
||||
PRINT("DEACT 5")
|
||||
DONE
|
||||
|
||||
|
||||
|
171
release_notes.md
171
release_notes.md
@@ -1,16 +1,145 @@
|
||||
The DCC-EX Team is pleased to release CommandStation-EX-v3.1.0 as a Production Release. Release v3.1.0 is a minor release that adds additional features and fixes a number of bugs. With the number of new features, this could have easily been a major release. The team is continually improving the architecture of DCC++EX to make it more flexible and optimizing the code so as to get more performance from the Arduino (and other) microprocessors. This release includes all of the Point Releases from v3.0.1 to v3.0.16.
|
||||
Version 4.0 Release Notes
|
||||
*************************
|
||||
|
||||
The DCC-EX Team is pleased to release CommandStation-EX v4.1.2 as a Production Release for the general public.
|
||||
This release is a Minor release with many significant EX-RAIL enhancements and new automation features in addition to some bug fixes.
|
||||
The team continues improving the architecture of DCC++EX to make it more flexible and optimizing the code to get more performance from the Arduino (and other) microprocessors. This release includes all of the Point Releases from v4.0.1 to v4.1.2.
|
||||
|
||||
**Downloads (zip and tar.gz) below. These are named without version number in the folder name to make the Arduino IDE happy.**
|
||||
|
||||
[CommandStation-EX.zip](https://github.com/DCC-EX/CommandStation-EX/releases/download/v3.1.0-Prod/CommandStation-EX.zip)
|
||||
[CommandStation-EX.tar.gz](https://github.com/DCC-EX/CommandStation-EX/releases/download/v3.1.0-Prod/CommandStation-EX.tar.gz)
|
||||
[CommandStation-EX.zip](https://github.com/DCC-EX/CommandStation-EX/releases/download/v4.1.2-Prod/CommandStation-EX.zip)
|
||||
|
||||
|
||||
|
||||
[CommandStation-EX.tar.gz](https://github.com/DCC-EX/CommandStation-EX/releases/download/v4.1.2-Prod/CommandStation-EX.tar.gz)
|
||||
|
||||
**New Command Station & EX-RAIL Features**
|
||||
- ACK defaults are now set to LIMIT 50mA, MIN 2000uS, MAX 20000uS for more compatibility with non NMRA compliant decoders
|
||||
- Automatically detect and run a myFilter add-on (no need to call setFilter)
|
||||
|
||||
- New Commands for the Arduino IDE Serial Monitor and JMRI DCC++ Traffic Monitor
|
||||
- </RED signal_id> to turn a individual LED Signal On & Off
|
||||
- </AMBER signal_id> "
|
||||
- </GREEN signal_id> "
|
||||
- </KILL ALL> command to stop all tasks, and Diagnostic messages when KILL is used
|
||||
- < t cab> command to obtain current throttle setting
|
||||
|
||||
- Allow WRITE CV on PROG <W CV VALUE>
|
||||
- Updated CV read command <R cv>. Equivalent to <V cv 0>. Uses the verify callback.
|
||||
- Allow WRITE CV on PROG <W CV VALUE)
|
||||
- Change callback parameters are now optional on PROG
|
||||
|
||||
- New JA, JR, JT commands availabe for Throttle Developers to obtain Route, Roster and Turnout descriptions for communications
|
||||
|
||||
- New EX-RAIL Functions to use in Automation(n), ROUTE(N) & SEQUENCE(N) Scripts
|
||||
- ATGTE & ATLT wait for analog value, (At Greater Than or Equal and At Less Than a certain value)
|
||||
- FADE command now works for LEDs connected on PCA9685 Servo/Signal board Output vpins
|
||||
- FORGET Forgets the current loco in DCC reminder tables saving memory and wasted packets sent to the track
|
||||
- "IF" signal detection with IFRED(signal_id), IFAMBER(signal_id), IFGREEN(signal_id)
|
||||
- KILLALL command to stop all tasks, and Diagnostic messages when KILL is used
|
||||
- PARSE <> commands in EXRAIL allows sending of DCC-EX commands from EX-RAIL
|
||||
- SERVO_SIGNAL Servo signals assigned to a specific servo turnout
|
||||
- SIGNALH High-On signal pins (Arduino normally handles active LOW signals. This allows for active HIGH)
|
||||
- HIDDEN turnouts (hide a REAL turnout and create a VIRTUAL turnout to handle actions that happen BEFORE a turnout is thrown)
|
||||
- VIRTUAL_TURNOUT definition
|
||||
|
||||
**EX-RAIL Updates**
|
||||
- EXRAIL BROADCAST("msg") sends any message to all throttles/JMRI via serial and WiFi
|
||||
- EXRAIL POWERON turns on power to both tracks from EX-RAIL (the equivalent of sending the <1> command)
|
||||
|
||||
** Other Enhancements**
|
||||
- UNO Progmem is optimize to allow for small EXRAIL Automation scipts to run within the limited space for testing purposes.
|
||||
- PCA9685 Servo Signal board supports 'Nopoweroffleds', servo pins stay powered on after position reached, otherwise the new FADE would always turn off.
|
||||
- Position servo can use spare servo pin as a GPIO pin.
|
||||
|
||||
**4.1.2 Bug Fixes**
|
||||
- Fixed Ethernet shield W5100 support since it does not report HW or link level like the W5200 and W5500 chips.
|
||||
|
||||
**4.1.1 Bug Fixes**
|
||||
|
||||
- Preserve the turnout format
|
||||
- Parse multiple commands in one buffer string currectly
|
||||
- Fix </> command signal status in EX-RAIL
|
||||
- Read long loco addresses in EX-RAIL
|
||||
- FIX negative route IDs in WIthrottle
|
||||
|
||||
See the version.h file for notes about which of the 4.1.2 features were added/changed by point release.
|
||||
|
||||
**Known Issues**
|
||||
|
||||
- **Wi-Fi** - works, but requires sending <AT> commands from a serial monitor if you want to switch between AP mode and STA station mode after initial setup
|
||||
- **Pololu Motor Shield** - is supported with this release, but the user may have to adjust timings to enable programming mode due to limitation in its current sensing circuitry
|
||||
- **Wi-Fi** - Requires sending `<AT>` commands from a serial monitor if you want to switch between AP mode and STA station mode after initial setup
|
||||
- **Pololu Motor Shield** - is supported with this release, but the user may have to adjust timings to enable programming mode due to limitations in its current sensing circuitry
|
||||
|
||||
#### Summary of key features and/or bug fixes by Point Release
|
||||
**All New Major DCC++EX 4.0.0 features**
|
||||
|
||||
- **New HAL Hardware Abstraction Layer API** that automatically detects and greatly simplifies interfacing to many predefined accessory boards for servos, signals & sensors and added I/O (digital and analog inputs and outputs, servos etc).
|
||||
- HAL Support for;
|
||||
- MCP23008, MCP23017 and PCF9584 I2C GPIO Extender modules.
|
||||
- PCA9685 PWM (servo & signal) control modules.
|
||||
- Analogue inputs on Arduino pins and on ADS111x I2C modules.
|
||||
- MP3 sound playback via DFPlayer module.
|
||||
- HC-SR04 Ultrasonic range sensor module.
|
||||
- VL53L0X Laser range sensor module (Time-Of-Flight).
|
||||
- A new `<D HAL SHOW>` command to list the HAL devices attached to the command station
|
||||
|
||||
**New Command Station Broadcast throttle logic**
|
||||
|
||||
- Synchronizes multiple WiThrottles and PC based JMRI Throttles for direction, speed and F-key updates
|
||||
|
||||
**New ‘Discovered Servers’ on WiFi Throttles**
|
||||
|
||||
- Our New multicast Dynamic Network Server (mDNS) enhancement allows us to display the available WiFi server connections to a DCC++EX Command Station. Selecting it allows your WiThrottle App to connect to and load Server Rosters and function keys to your throttle from the new DCC++EX Command Station Server Roster.
|
||||
|
||||
**New DCC++EX 4.0.0 with EX-RAIL Extended Railroad Automation Instruction Language**
|
||||
|
||||
- Use to control your entire layout or as a separate accessory/animation controller
|
||||
- Awesome, cleverly powerful yet simple user friendly scripting language for user built Automation & Routing scripts.
|
||||
- You can control Engines, Sensors, Turnouts, Signals, Outputs and Accessories that are entered into your new myAutomation.h file, then uploaded into the DCC++EX Command Station.
|
||||
- EX-RAIL scripts are automatically displayed as Automation {Handoff} and Route {Set} buttons on supported WiFi Throttle Apps.
|
||||
|
||||
**New EX-RAIL ‘Roster’ Feature**
|
||||
|
||||
- List and store user defined engine roster & function keys inside the command station, and automatically load them in WiFi Throttle Apps.
|
||||
- When choosing “DCC++EX” from discovered servers an Engine Driver or WiThrottle is directly connected to the Command Station.
|
||||
- The EX-RAIL ’ROSTER’ command allows all the engine numbers, names and function keys you’ve listed in your myAutomation.h file to automatically upload the Command Station's ‘Server Roster’ into your Engine Driver and WiThrottle Apps.
|
||||
|
||||
**New JMRI 4.99.2 and above specific DCC++EX 4.0 features**
|
||||
|
||||
- Enhanced JMRI DCC++ Configure Base Station pane for building and maintaining Sensor, Turnout and Output devices, or these can automatically be populated from the DCC++EX Command Station's mySetup.h file into JMRI.
|
||||
|
||||
- JMRI now supports multiple serial connected DCC++EX Command Stations, to display and track separate "Send DCC++ Command" and "DCC++ Traffic" Monitors for each Command Station at the same time.
|
||||
For example: Use an Uno DCC++EX DecoderPro Programming Station {DCC++Prg} on a desktop programming track and a second Mega DCC++EX EX-RAIL Command Station for Operations {DCC++Ops} on the layout with an additional `<JOINED>` programming spur or siding track for acquiring an engine and ‘Drive Away’ onto the mainline (see the DriveAway feature for more information).
|
||||
|
||||
**DCC++EX 4.0.0 additional product enhancements**
|
||||
|
||||
- Additional Motor Shields and Motor Board {boosters) supported
|
||||
- Additional Accessory boards supported for GPIO expansion, Sensors, Servos & Signals
|
||||
- Additional diagnostic commands like ‘D ACK RETRY’ and ‘D EXRAIL ON’ events, ‘D HAL SHOW’ devices and ‘D SERVO’ positions, and ‘D RESET’ the command station while maintaining the serial connection with JMRI
|
||||
- Automatic retry on failed ACK detection to give decoders another chance
|
||||
- New EX-RAIL ’/’ slash command allows JMRI to directly communicate with many EX-RAIL scripts
|
||||
- Turnout class revised to expand turnout capabilities and allow turnout names/descriptors to display in WiThrottle Apps.
|
||||
- Build turnouts through either or both mySetup.h and myAutomation.h files, and have them automatically passed to, and populate, JMRI Turnout Tables
|
||||
- Turnout user names display in Engine Driver & WiThrottles
|
||||
- Output class now allows ID > 255.
|
||||
- Configuration options to globally flip polarity of DCC Accessory states when driven from `<a>` command and `<T>` command.
|
||||
- Increased use of display for showing loco decoder programming information.
|
||||
- Can disable EEPROM memory code to allow room for DCC++EX 4.0 to fit on a Uno Command Station
|
||||
- Can define border between long and short addresses
|
||||
- Native non-blocking I2C drivers for AVR and Nano architectures (fallback to blocking Wire library for other platforms).
|
||||
- EEPROM layout change - deletes EEPROM contents on first start following upgrade.
|
||||
|
||||
**4.0.0 Bug Fixes**
|
||||
|
||||
- Compiles on Nano Every
|
||||
- Diagnostic display of ack pulses >32ms
|
||||
- Current read from wrong ADC during interrupt
|
||||
- AT(+) Command Pass Through
|
||||
- CiDAP WiFi Drop out and the WiThrottle F-key looping error corrected
|
||||
- One-off error in CIPSEND drop
|
||||
- Common Fault Pin Error
|
||||
- Uno Memory Utilization optimized
|
||||
|
||||
#### Summary of Release 3.1.0 key features and/or bug fixes by Point Release
|
||||
|
||||
**Summary of the key new features added to CommandStation-EX V3.0.16**
|
||||
|
||||
@@ -147,14 +276,14 @@ The DCC-EX Team is pleased to release CommandStation-EX-v3.1.0 as a Production R
|
||||
|
||||
- Fred Decker - Holly Springs, North Carolina, USA (FlightRisk)
|
||||
|
||||
**CommandStation-EX Developers**
|
||||
**EX-CommandStation Developers**
|
||||
|
||||
- Chris Harlow - Bournemouth, UK (UKBloke)
|
||||
- Harald Barth - Stockholm, Sweden (Haba)
|
||||
- Neil McKechnie - Worcestershire, UK (NeilMck)
|
||||
- Fred Decker - Holly Springs, North Carolina, USA (FlightRisk)
|
||||
- Dave Cutting - Logan, Utah, USA (Dave Cutting/ David Cutting)
|
||||
- M Steve Todd -
|
||||
- M Steve Todd - Oregon, USA (MSteveTodd)
|
||||
- Scott Catalano - Pennsylvania
|
||||
- Gregor Baues - Île-de-France, France (grbba)
|
||||
|
||||
@@ -162,7 +291,7 @@ The DCC-EX Team is pleased to release CommandStation-EX-v3.1.0 as a Production R
|
||||
|
||||
- M Steve Todd
|
||||
|
||||
**exInstaller Software**
|
||||
**EX-Installer Software**
|
||||
|
||||
- Anthony W - Dayton, Ohio, USA (Dex, Dex++)
|
||||
|
||||
@@ -174,24 +303,36 @@ The DCC-EX Team is pleased to release CommandStation-EX-v3.1.0 as a Production R
|
||||
- Roger Beschizza - Dorset, UK (Roger Beschizza)
|
||||
- Keith Ledbetter - Chicago, Illinois, USA (Keith Ledbetter)
|
||||
- Kevin Smith - Rochester Hills, Michigan USA (KC Smith)
|
||||
- Colin Grabham - Central NSW, Australia (Kebbin)
|
||||
- Peter Cole - Brisbane, QLD, Australia (peteGSX)
|
||||
- Peter Akers - Brisbane, QLD, Australia (flash62au)
|
||||
|
||||
**WebThrotle-EX**
|
||||
**EX-WebThrottle**
|
||||
|
||||
- Fred Decker - Holly Springs, NC (FlightRisk/FrightRisk)
|
||||
- Mani Kumar - Bangalor, India (Mani /Mani Kumar)
|
||||
- Matt H - Somewhere in Europe
|
||||
|
||||
**Hardware / Electronics**
|
||||
|
||||
- Harald Barth - Stockholm, Sweden (Haba)
|
||||
- Paul Antoine, Western Australia
|
||||
- Neil McKechnie - Worcestershire, UK
|
||||
- Fred Decker - Holly Springs NC, USA
|
||||
- Herb Morton - Kingwood Texas, USA (Ash++)
|
||||
|
||||
**Beta Testing / Release Management / Support**
|
||||
|
||||
- Larry Dribin - Release Management
|
||||
- Kevin Smith - Rochester Hills, Michigan USA (KC Smith)
|
||||
- Herb Morton - Kingwood Texas, USA (Ash++)
|
||||
- Keith Ledbetter
|
||||
- BradVan der Elst
|
||||
- Brad Van der Elst
|
||||
- Andrew Pye
|
||||
- Mike Bowers
|
||||
- Randy McKenzie
|
||||
- Roberto Bravin
|
||||
- Sim Brigden
|
||||
- Sam Brigden
|
||||
- Alan Lautenslager
|
||||
- Martin Bafver
|
||||
- Mário André Silva
|
||||
@@ -202,5 +343,7 @@ The DCC-EX Team is pleased to release CommandStation-EX-v3.1.0 as a Production R
|
||||
|
||||
**Downloads (zip and tar.gz) below. These are named without version number in the folder name to make the Arduino IDE happy.**
|
||||
|
||||
[CommandStation-EX.zip](https://github.com/DCC-EX/CommandStation-EX/releases/download/v3.1.0-Prod/CommandStation-EX.zip)
|
||||
[CommandStation-EX.tar.gz](https://github.com/DCC-EX/CommandStation-EX/releases/download/v3.1.0-Prod/CommandStation-EX.tar.gz)
|
||||
[CommandStation-EX.zip](https://github.com/DCC-EX/CommandStation-EX/releases/download/v4.1.2-Prod/CommandStation-EX.zip)
|
||||
|
||||
|
||||
[CommandStation-EX.tar.gz](https://github.com/DCC-EX/CommandStation-EX/releases/download/v4.1.2-Prod/CommandStation-EX.tar.gz)
|
||||
|
98
version.h
98
version.h
@@ -3,30 +3,100 @@
|
||||
|
||||
#include "StringFormatter.h"
|
||||
|
||||
#define VERSION "3.2.0 rc12"
|
||||
// 3.2.0 Major functional and non-functional changes.
|
||||
// New HAL added for I/O (digital and analogue inputs and outputs, servos etc).
|
||||
#define VERSION "4.1.6"
|
||||
// 4.1.6 Support DCC-EX shield
|
||||
// 4.1.5 Bugfix LCN number parsing
|
||||
// 4.1.4 Bugfix for issue #299 TurnoutDescription NULL
|
||||
// 4.1.3 Bugfix: Ethernet init order
|
||||
// 4.1.2 Bugfix: Ethernet shield W5100 does not report HW or link level
|
||||
// 4.1.1 Bugfix: preserve turnout format
|
||||
// Bugfix: parse multiple commands in one buffer string correctly (ex: <s><Q>)
|
||||
// Bugfix: </> command signal status of EX-RAIL tasks or threads
|
||||
// Bugfix: EX-RAIL read long loco addr
|
||||
// Bugfix: Add space character after version string 4.1.1 for JMRI parsing.
|
||||
// Improved display and loop time for signals make service start to be outside the DONT_TOUCH_WIFI_CONF area
|
||||
// Improve WiFi startup by making service start to be outside the DONT_TOUCH_WIFI_CONF area
|
||||
// 4.1.0 ...
|
||||
// UNO Progmem optimized to allow for small EXRAIL Automation scipts
|
||||
// 4.0.2 Command Station and EX-RAIL Ehancements & Additions:
|
||||
// New JA, JR, JT commands availabe for Throttle Developers to obtain Route, Roster and Turnout descriptions for communications
|
||||
// Change ACK defaults now set to LIMIT 50mA, MIN 2000uS, MAX 20000uS for more compatibility with non NMRA compliant decoders
|
||||
// New Commands for the Arduino IDE Serial Monitor and JMRI DCC++ Traffic Monitor
|
||||
// </RED signal_id> to turn a individual LED Signal On & Off
|
||||
// </AMBER signal_id> "
|
||||
// </GREEN signal_id> "
|
||||
// </KILL ALL> command to stop all tasks, and Diagnostic messages when KILL is used
|
||||
// <t cab> command to obtain current throttle settings
|
||||
// Allow WRITE CV on PROG <W CV VALUE>
|
||||
// Updated CV read command <R cv>. Equivalent to <V cv 0>. Uses the verify callback.
|
||||
// Change callback parameters are now optional on PROG
|
||||
// Code: Fix weak reference to myFilter
|
||||
// myFilter automatic detection (no need to call setFilter)
|
||||
// Improved SIGNALs startup and diagnostics
|
||||
// Incoming LCN turnout throw
|
||||
// Allow turnout ID of "0"
|
||||
// Code: struct TurnoutData to enable EEPROM in v 4.0 format
|
||||
// Broadcast jopin after DriveAway
|
||||
// Corrections to I2C code:
|
||||
// 1) I2CManager_Mega4809.h: Correct bitwise 'and' to logical 'and' - no impact.
|
||||
// 2) I2CManager_Wire.h: Ensure that error codes from Wire subsystem are passed back to caller in queueRequest().
|
||||
// New EX-RAIL Functions to use in Automation(n), ROUTE(N) & SEQUENCE(N) scripts
|
||||
// Automatically assign a name with ALIAS(name) without having to define it first
|
||||
// ALIAS now has the aility to use Low underscore in keywords e.g., MY_KEYWORD
|
||||
// ATGTE & ATLT wait for analog value, (At Greater Than or Equal and At Less Than a certain value)
|
||||
// FADE command now works for LEDs connected on PCA9685 Servo/Signal board Output vpins
|
||||
// FORGET Forgets the current loco in DCC reminder tables saving memory and wasted packets sent to the track
|
||||
// "IF" signal detection with IFRED(signal_id), IFAMBER(signal_id), IFGREEN(signal_id)
|
||||
// KILLALL command to stop all tasks, and Diagnostic messages when KILL is used
|
||||
// PARSE <> commands in EXRAIL allows sending of DCC-EX commands from EX-RAIL
|
||||
// SERVO_SIGNAL Servo signals assigned to a specific servo turnout
|
||||
// SIGNALH High-On signal pins (Arduino normally handles active LOW signals. This allows for active HIGH)
|
||||
// HIDDEN turnouts (hide a REAL turnout and create a VIRTUAL turnout to handle actions that happen BEFORE a turnout is thrown)
|
||||
// VIRTUAL_TURNOUT definition
|
||||
// README.md: removed misleading "folder/subforlders" (#218)
|
||||
// README.md: fix dead link to rewrite (#217) in notes/rewrite.md
|
||||
// 4.0.1 Additional EXRAIL updates
|
||||
// EXRAIL BROADCAST("msg")
|
||||
// EXRAIL POWERON (only turns on MAIN)
|
||||
// Remove optional EXRAIL/ENDEXRAIL from myAutomation.example.h (#215)
|
||||
// Use "startup sequence" to describe the initial instructions
|
||||
// Add description of display scroll modes
|
||||
// GetLocoCallback() restructured for better readability and put broadcastPower() at right place
|
||||
// 4.0.0 Major Production Release with New Functional and non-functional changes.
|
||||
// Engine Driver "DriveAway" feature enhancement
|
||||
// 'Discovered Server' multicast Dynamic Network Server (mDNS) displays available WiFi connections to a DCC++EX Command Station
|
||||
// New EX-RAIL "Extended Railroad Automation Instruction Language" automation capability.
|
||||
// EX-Rail Function commands for creating Automation, Route & Sequence Scripts
|
||||
// EX-RAIL “ROSTER” Engines Id & Function key layout on Engine Driver or WiThrottle
|
||||
// EX-RAIL DCC++EX Commands to Control EX-RAIL via JMRI Send pane and IDE Serial monitors
|
||||
// New JMRI feature enhancements;
|
||||
// Reads DCC++EX EEPROM & automatically uploades any Signals, DCC Turnouts, Servo Turnouts, Vpin Turnouts , & Output pane
|
||||
// Turnout class revised to expand turnout capabilities, new commands added.
|
||||
// Provides for multiple additional DCC++EX WiFi connections as accessory controllers or CS for a programming track when Motor Shields are added
|
||||
// Supports Multiple Command Station connections and individual tracking of Send DCC++ Command panes and DCC++ Traffic Monitor panes
|
||||
// New HAL added for I/O (digital and analogue inputs and outputs, servos etc)
|
||||
// Automatically detects & connects to supported devices included in your config.h file
|
||||
// Support for MCP23008, MCP23017 and PCF9584 I2C GPIO Extender modules.
|
||||
// Support for PCA9685 PWM (servo) control modules.
|
||||
// Support for analogue inputs on Arduino pins and on ADS111x I2C modules.
|
||||
// Support for MP3 sound playback via DFPlayer module.
|
||||
// Support for HC-SR04 Ultrasonic range sensor module.
|
||||
// Support for VL53L0X Laser range sensor module (Time-Of-Flight).
|
||||
// Native non-blocking I2C drivers for AVR and Nano architectures (fallback
|
||||
// to blocking Wire library for other platforms).
|
||||
// EEPROM layout change - deletes EEPROM contents on first start following upgrade.
|
||||
// New EX-RAIL automation capability.
|
||||
// Turnout class revised to expand turnout capabilities, new commands added.
|
||||
// Output class now allows ID > 255.
|
||||
// Configuration options to globally flip polarity of DCC Accessory states when driven
|
||||
// from <a> command and <T> command.
|
||||
// Increased use of display for showing loco decoder programming information.
|
||||
// Added <D HAL SHOW> diagnostic command to show configured devices
|
||||
// New Processor Support added
|
||||
// Compiles on Nano Every and Teensy
|
||||
// Native non-blocking I2C drivers for AVR and Nano architectures (fallback to blocking Wire library for other platforms).
|
||||
// Can disable EEPROM code
|
||||
// EEPROM layout change - deletes EEPROM contents on first start following upgrade.
|
||||
// Output class now allows ID > 255.
|
||||
// Configuration options to globally flip polarity of DCC Accessory states when driven from <a> command and <T> command.
|
||||
// Increased use of display for showing loco decoder programming information.
|
||||
// Can define border between long and short addresses
|
||||
// Turnout and accessory states (thrown/closed = 0/1 or 1/0) can be set to match RCN-213
|
||||
// Bugfix: one-off error in CIPSEND drop
|
||||
// Compiles on Nano Every
|
||||
// ...
|
||||
// Bugfix: disgnostic display of ack pulses >32kus
|
||||
// Bugfix: Current read from wrong ADC during interrupt
|
||||
// 3.2.0 Development Release Includes all of 3.1.1 thru 3.1.7 enhancements
|
||||
// 3.1.7 Bugfix: Unknown locos should have speed forward
|
||||
// 3.1.6 Make output ID two bytes and guess format/size of registered outputs found in EEPROM
|
||||
// 3.1.5 Fix LCD corruption on power-up
|
||||
|
Reference in New Issue
Block a user