Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accessory packet refactoring and POM support #764

Merged
merged 9 commits into from
Feb 1, 2024

Conversation

balazsracz
Copy link
Collaborator

  • Adds support for Accessory packet POM. This works by combining a new call add_accy_address() with the already existing add_pom_write1(...)
  • Refactors the basic accessory packet generator to use some constants and the new accy address call.
  • Adds helper functions to translate user-visible accessory addresses to binary accessory addresses and reverse.
  • Updates the DccDebug code to print the user-visible accessory addresses for those packets.

This uses user address 1..2047, with skipping the former broadcast address.
Adds "add_accy_address" helper to allow accy POM commands as well.
Refactors the basic accy function to make use of the new code.

Unit tests are not changed by this refactoring.
* master:
  Fix test flakiness.
  Fix compile error on FdUtils under freertos.
Adjusts the dccdebug for the new RCN-213 and DCC 9.2.1 standard encoding.
Adds an example dcc basic accy POM packet to the test.
src/dcc/Defs.hxx Outdated
@@ -50,6 +50,11 @@ enum class TrainAddressType : uint8_t
DCC_LONG_ADDRESS,
/// Marklin-motorola packets. Addresses 1..80 are supported.
MM,
/// Per-output addressing of DCC basic accessories. (user facing is 1 to
/// 2047, internal is 0 to 2047)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2048 for user facing? Should a note be added on 2045-2048 being reserved?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2048 for user facing. No note is required. 2045 to 2048 are not special anymore. This is a change in the RailCommunity standards which the NMRA also intends to adopt. See the table starting on page 16: https://www.nmra.org/sites/default/files/standards/sandrp/pdf/s-9.2.1_dcc_extended_packet_formats_draft5-12-2023.pdf

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@balazsracz
Copy link
Collaborator Author

balazsracz commented Jan 8, 2024 via email

@atanisoft
Copy link
Collaborator

There is nothing reserved, 2045 to 2048 are also valid. This is a relatively new addition / change to the DCC standard. See RCN-213 and the 2023-05 draft of the NMRA S-9.2.1.

Good to know, there is a note in DccAccyConsumer/Producer that indicates the address is limited to 1-2044.

The most recent draft of 9.2.1 is a great improvement and simplifies most of the details greatly.

src/dcc/Defs.hxx Outdated
@@ -50,6 +50,11 @@ enum class TrainAddressType : uint8_t
DCC_LONG_ADDRESS,
/// Marklin-motorola packets. Addresses 1..80 are supported.
MM,
/// Per-output addressing of DCC basic accessories. (user facing is 1 to
/// 2047, internal is 0 to 2047)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2048 for user facing. No note is required. 2045 to 2048 are not special anymore. This is a change in the RailCommunity standards which the NMRA also intends to adopt. See the table starting on page 16: https://www.nmra.org/sites/default/files/standards/sandrp/pdf/s-9.2.1_dcc_extended_packet_formats_draft5-12-2023.pdf

src/dcc/Defs.hxx Outdated
/// Per-output addressing of DCC basic accessories. (user facing is 1 to
/// 2047, internal is 0 to 2047)
DCC_ACCY_BASIC_OUTPUT,
/// DCC 11-bit extended accessory decoder address (1 to 2047).
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(1 to 2048).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I replaced this with the text from basic accy:

(user facing is 1 to 2048, internal is 0 to 2047)

Defs::accy_address_binary_to_user(
Defs::accy_address_user_to_binary(user)));
}
for (unsigned binary = 0; binary < 2048; ++binary)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be clearer to use <= 2047 to be consistent with the previous for loop?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@balazsracz balazsracz merged commit d547864 into master Feb 1, 2024
4 checks passed
@balazsracz balazsracz deleted the bracz-accy-packet-with-pom branch February 1, 2024 11:52
balazsracz added a commit that referenced this pull request Feb 1, 2024
* master:
  Accessory packet refactoring and POM support (#764)
balazsracz added a commit that referenced this pull request Feb 1, 2024
* bracz-accy-packet-with-pom:
  Accessory packet refactoring and POM support (#764)
balazsracz added a commit that referenced this pull request Feb 2, 2024
* master:
  Fixes file comment.
  Adds an application (hub_test) for testing the throughput of a hub or a CAN-bus (#762)
  Adds a helper function to decode a 14-bit 9.2.1.1 address into address type and raw address. (#766)
  Fix broken test.
  Accessory packet refactoring and POM support (#764)
  Adds support for Offset(n) attribute in the CDI  (#765)
  Adds local loopback to TractionThrottle. (#756)
  Fix test flakiness.
  Fix compile error on FdUtils under freertos.
balazsracz added a commit that referenced this pull request Feb 4, 2024
* master:
  Upintegrate changes from the OpenMRNIDF repository (#771)
  Adds support for DCC extended accessories  (#769)
  Fix incorrect consumer identified message being emitted by dcc accy producer. (#768)
  Avoids rendering hidden segments. (#767)
  Adds trailing zero to the cdi XML file written to the filesystem. (#777)
  Fix target subdirectory name (#775)
  Fixes file comment.
  Adds an application (hub_test) for testing the throughput of a hub or a CAN-bus (#762)
  Adds a helper function to decode a 14-bit 9.2.1.1 address into address type and raw address. (#766)
  Fix broken test.
  Accessory packet refactoring and POM support (#764)
  Adds support for Offset(n) attribute in the CDI  (#765)
  Adds local loopback to TractionThrottle. (#756)
  Fix test flakiness.
  Fix compile error on FdUtils under freertos.
balazsracz added a commit that referenced this pull request Feb 4, 2024
* bracz-idf-downintegrate:
  Upintegrate changes from the OpenMRNIDF repository (#771)
  Fix comments.
  Adds support for DCC extended accessories  (#769)
  Fix incorrect consumer identified message being emitted by dcc accy producer. (#768)
  Avoids rendering hidden segments. (#767)
  Adds trailing zero to the cdi XML file written to the filesystem. (#777)
  Fix target subdirectory name (#775)
  Fixes file comment.
  Adds an application (hub_test) for testing the throughput of a hub or a CAN-bus (#762)
  Adds a helper function to decode a 14-bit 9.2.1.1 address into address type and raw address. (#766)
  Fix broken test.
  Accessory packet refactoring and POM support (#764)
  Adds support for Offset(n) attribute in the CDI  (#765)
  Adds local loopback to TractionThrottle. (#756)
  Fix test flakiness.
  Fix compile error on FdUtils under freertos.
balazsracz added a commit that referenced this pull request Feb 5, 2024
* master:
  Fix esp32 select race conditions. (#780)
  Latency test with maximum stats and custom process evaluation (#773)
  Fix compiler warnings in openmrn when using new GCC's. (#772)
  Upintegrate changes from the OpenMRNIDF repository (#771)
  Adds support for DCC extended accessories  (#769)
  Fix incorrect consumer identified message being emitted by dcc accy producer. (#768)
  Avoids rendering hidden segments. (#767)
  Adds trailing zero to the cdi XML file written to the filesystem. (#777)
  Fix target subdirectory name (#775)
  Fixes file comment.
  Adds an application (hub_test) for testing the throughput of a hub or a CAN-bus (#762)
  Adds a helper function to decode a 14-bit 9.2.1.1 address into address type and raw address. (#766)
  Fix broken test.
  Accessory packet refactoring and POM support (#764)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants