Replies: 20 comments 6 replies
-
Assuming you have enabled WiFi, the CS code will try to find the wifi chip by sending AT commands to serial1, 2, 3 in turn. |
Beta Was this translation helpful? Give feedback.
-
In addition you mustensure thattheexpressnet library contains no blocking delays, does not interfere with timer1, does not interfere with any pins used by the motor shields . Bear in mind this restriction list may be expanded in future dccex versions so if you wish to add expressnet support to our code in the long term it might be necessary to rewrite the library to be a fully configurable and portable part of dcc-ex. |
Beta Was this translation helpful? Give feedback.
-
I'd encourage you to join our discord and get some help there how to start that project. You can enable an additional serial port to parse commands by defining for example SERIAL3_COMMANDS. That will enable the port so that incoming messages are sent to the parser selector CommandDistributor. Then your can look at CommandDistributor.cpp on the devel branch to see how clients are registered and parsed. If you can somehow identify the incoming type you can add a new type and then hopefully hand off the parsing to the library, with a shim class if necessary. If it can not be determined from the first packet if it is expressnet then you need to tie a port to a type but it would be great if the CommandDistributor would work for this. Today both withrottle and DCCEX protocol parsers are called from there. Check that the code you take from pghatow is GPL compatible, the licenses found there vary. Nice to see new coding efforts, |
Beta Was this translation helpful? Give feedback.
-
Is this an obstacle? Technical part: What is a bit of an inconvenience is that the library has it's own instance of a Serial ISR. If I want to use Serial port 0 I cannot type
Xnet needs to use 9 databits. The default arduino library do not support this AFAIK. Only for sending IIRC I downloaded discord and made an acount. I have a side question. I came accross
I cannot find a definition for |
Beta Was this translation helpful? Give feedback.
-
Firstly, it is completely unacceptable to interfere with the vendor supplied runtime library as this would compromise all of a users sketches, would need to be edited into multiple device support files for different targets and would make our code un-compilable. Serial is used throughout dcc-ex and that isn't going to change. LCN_SERIAL is something that might be defined in config.h for a specific commercial hook. You can ignore that as the code won't use it if it's not defined. |
Beta Was this translation helpful? Give feedback.
-
If it requires a config file, it's no longer suitable to be a "library" so you will need to bring the code into our sketch where it has access to the users config.h values and various cpu type support functions.. and can be omitted entirely if the user does not define the relevant serial etc. |
Beta Was this translation helpful? Give feedback.
-
Bear in mind, from your prev post, you probably already know this... |
Beta Was this translation helpful? Give feedback.
-
It does not but I ment the same as what you suggest.
I simply wanted to add a line with
Ok! I had not figured that out yet. Does this mean that no Xnet device may issue turnout commands at all or ? This library comes with callback functions. From void loop() I normally call
I can stuff all these functions in |
Beta Was this translation helpful? Give feedback.
-
Yes, the absence of a license is a problem. (There is only a copyright notice and no license). Things you can NOT do: Copy code from that project into any other project (like DCC-EX) and then publish. As I understand the legal bits: The only thing you might do is to download from pghatow seperately and build something together "in your private corner" and then not share that further. So I see what is found at pghatow more as an example what can be done. And the code is not that cool that I would want to copy it anyway. As is we can not copy code from there into DCC-EX. On the tech side: Is this doing RS485 in software? In that case, would it not be much better to just convert to 8-bit serial with a cheap converter and then use the UART(s) on the Arduino in the usual way? Harald. |
Beta Was this translation helpful? Give feedback.
-
Turnouts are OK but to throw or close them you must call the relevant functions in the Turnout class. This is because we handle many kinds of turnout hardware at the same time and we have automations that may be listening for turnout changes or broadcasting them to other throttles. |
Beta Was this translation helpful? Give feedback.
-
Explicit permission is not enough due to that we don't want to handle DCC-EX as two parts (which would be necessary if the other part is not GPL). On the RS485 9-bit issue I wonder if it would not be smart to let some dedicated HW handle the filtering (if I understad the 9 bit messages correct then these are used to identify addresses to make an easier select "this is for me") and then hand over the 8-bit data to DCC-EX when it has been clear that the data is for this device. I don't know much about RS485 but feel that there should be such adapters. Harald. |
Beta Was this translation helpful? Give feedback.
-
Maybe this helps https://forum.arduino.cc/t/how-to-read-rs485-data-in-arduino/673285 |
Beta Was this translation helpful? Give feedback.
-
Another example of using RS485 is CMRI. fwiw In 2020, I used JMRI/RS485/CMRI for accessories connected to I2C modules. |
Beta Was this translation helpful? Give feedback.
-
The 9th bit... On RX when the code has figured out "this is for me" then there the 9th is not needed any more. Harald. |
Beta Was this translation helpful? Give feedback.
-
I also do lots of hardware development. I have made an XpressNet PCB with an RJ12 connector (Xnet connector), max485 and a breakout for 5V, GND, Rx and TX. You can plug or solder this PCB with 4 jumper cables in an arduino. If any of you has like a brilliant idea about this, please share it with me so I can make something betters ;) I have increased my efforts in completely rewriting and rebuiling the library. It will propably take me atleast a month or so. But I will release it under GPL flag :-D It is not a copy paste + reformatting I am truly rewriting the entire thing complete with a different structure. It gives me a better insight in how XpressNet precisely works. |
Beta Was this translation helpful? Give feedback.
-
query: If an Xnet device issues a command, can I just simply call Also If an Xnet device requests information, how do I obtain data from the other files? Isn't there a short manual for developers for how to interface with the DCC system and sensors n such? |
Beta Was this translation helpful? Give feedback.
-
Turnout::isClosed(id) |
Beta Was this translation helpful? Give feedback.
-
Did you manage to get some progress @bask185 ? I'm also interested in such a setup where I could add a LokMaus with an Xpressnet interface to DCC-EX |
Beta Was this translation helpful? Give feedback.
-
Not yet. I was about half way. I have been more been busy making a line of Open Source DCC decoders. They do lack an english translation though... And I am busy with Loconet products. Among others I made a DCC - Lnet command station which is supposed to cost people around €15 (PSU not including) but It need more software work. So far I have tested the accessory commands with succes though. You can however use the code base of Gathow and make an Xnet interface and use SoftwareSerial to relay the commands in that DCC-EX protocol. You can use an extra arduino nano or uno for this purpose. I do not know if the lok maus also works well with it? The lok maus, being quite old, seems to give problems on some command stations. Multimaus does work great. I done a bucket load of projects with it. PWM contollers, eavesdroppening devices which can remember routes. And you get to use loco functions to set turnouts and such. I also have a bare minimum Xnet interface for an arduino. Look for Xnet.png to see what it is. Gerbers are there too. Is there already an easy to use library to use the DCC ex protocol? Idealy one with software serial possibility. Than I can fix you atleast some code. |
Beta Was this translation helpful? Give feedback.
-
Everyone writing their own XpressNet parser is not effective. Have a look at how XpressNet over UDP is parsed in the DCC-EX branches that deal with connections from the Z21 app. |
Beta Was this translation helpful? Give feedback.
-
I am trying to add XpressNet to DCC++ EX. I am using the XpressNetMasterClass of Phillip Gathow. The job itself is not that hard but I would like to know which Serial Port I should use and why. I tried Serial port 1 and 3, but I keep getting interrupt conflicts.
I have some difficulties understanding all of the code since it is quite alot. I am guessing that all 4 are in use, how I can I easily disable one of them? And which port should I use?
Beta Was this translation helpful? Give feedback.
All reactions