-
Notifications
You must be signed in to change notification settings - Fork 31
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
Conversation
balazsracz
commented
Jan 6, 2024
- 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) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Actually it should read 1..2048 for user facing. 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) |
There was a problem hiding this comment.
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). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(1 to 2048).
There was a problem hiding this comment.
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)
src/dcc/Packet.cxxtest
Outdated
Defs::accy_address_binary_to_user( | ||
Defs::accy_address_user_to_binary(user))); | ||
} | ||
for (unsigned binary = 0; binary < 2048; ++binary) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
* master: Accessory packet refactoring and POM support (#764)
* bracz-accy-packet-with-pom: Accessory packet refactoring and POM support (#764)
* 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.
* 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.
* 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.
* 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)