Keyboard Shortcuts
Likes
- Jmriusers
- Messages
Search
On Sun, Apr 30, 2023 at 12:22 PM, <stephenjohnson500@...> wrote:
MRFC522, Uno, Ethernet Steve, // Import Libraries
#include <SPI.h>? ? ? ? ? ?// SPI library for communicating with the MFRC522 reader
#include <MFRC522.h>? ? ? ?// MFRC522 library for reading RFID cards
#include <Ethernet.h>? ? ? // Ethernet library for the Ethernet shield
?
// Ethernet configuration
byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
IPAddress ip(192, 168, 1, 177);
unsigned int serverPort = 8888;? // Replace with the desired port number
EthernetServer server(serverPort);
?
// Define the SS (Slave Select) and RST (Reset) pins for each reader
#if defined(ARDUINO_AVR_UNO) || defined(ARDUINO_AVR_NANO)
const uint8_t ssPins[] = {5, 6, 7, A0, A1, A2};
const uint8_t rstPins[] = {4, 8, 9, A3, A4, A5};
const uint8_t readerAssignment[] = {1, 2, 3, 4, 5, 6}; // Assign reader numbers based on SS and RST pins
#elif defined(ARDUINO_AVR_MEGA2560)
const uint8_t ssPins[] = {5, 6, 7, 8, 9, A0, A1, A2};
const uint8_t rstPins[] = {22, 23, 24, 25, 26, 27, 28, 29};
const uint8_t readerAssignment[] = {1, 2, 3, 4, 5, 6, 7, 8}; // Assign reader numbers based on SS and RST pins
#endif
?
const int numReaders = sizeof(ssPins) / sizeof(ssPins[0]);
const char readerID[] = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H'};
?
struct RFIDReader {
? char id;
? uint8_t ssPin;
? uint8_t rstPin;
? MFRC522 mfrc522;
? byte nuid[7];
?
? RFIDReader() : id(0), ssPin(0), rstPin(0), mfrc522(MFRC522(0, 0)) {}
};
?
RFIDReader readers[numReaders];
EthernetClient client;
?
void setup() {
? Serial.begin(9600);
? SPI.begin();
? pinMode(10, OUTPUT);
? digitalWrite(10, HIGH);
?
? // Set pin 53 as OUTPUT for the Arduino Mega 2560
? #if defined(ARDUINO_AVR_MEGA2560)
? ? pinMode(53, OUTPUT);
? #endif
?
? pinMode(4, OUTPUT);
? digitalWrite(4, HIGH);
?
? Ethernet.begin(mac, ip);
? delay(1000);
?
? uint8_t detectedReaders = 0; // Add a counter for detected readers
?
? for (uint8_t i = 0; i < numReaders; i++) {
? ? readers[i].ssPin = ssPins[i];
? ? readers[i].rstPin = rstPins[i];
? ? readers[i].id = readerID[readerAssignment[i] - 1];
? ? readers[i].mfrc522 = MFRC522(readers[i].ssPin, readers[i].rstPin);
? ? readers[i].mfrc522.PCD_Init();
? ? readers[i].mfrc522.PCD_SetAntennaGain(readers[i].mfrc522.RxGain_max);
?
? ? // Check if a reader is connected
? ? if (readers[i].mfrc522.PCD_PerformSelfTest()) {
? ? ? // Print debugging information
? ? ? Serial.print("Reader ");
? ? ? Serial.print(readers[i].id);
? ? ? Serial.print(" detected on SS pin ");
? ? ? Serial.println(readers[i].ssPin);
?
? ? ? // Increment the counter for detected readers
? ? ? detectedReaders++;
? ? }
? }
?
? // Blink the built-in LED to match the number of detected readers
? pinMode(LED_BUILTIN, OUTPUT);
? delay(1000);
? for (uint8_t i = 0; i < detectedReaders; i++) {
? ? digitalWrite(LED_BUILTIN, HIGH);
? ? delay(250);
? ? digitalWrite(LED_BUILTIN, LOW);
? ? delay(1000);
? }
?
? server.begin();
}
?
void loop() {
? if (!client.connected()) {
? ? client.stop();
? ? client = server.accept();
? ? if (client) {
? ? ? Serial.println("Client connected");
? ? }
? }
?
? if (client.connected()) {
? ? for (uint8_t i = 0; i < numReaders; i++) {
? ? ? if (readers[i].mfrc522.PICC_IsNewCardPresent() && readers[i].mfrc522.PICC_ReadCardSerial()) {
? ? ? ? for (uint8_t j = 0; j < readers[i].mfrc522.uid.size; j++) {
? ? ? ? ? readers[i].nuid[j] = readers[i].mfrc522.uid.uidByte[j];
? ? ? ? }
?
? ? ? ? byte checksum = readers[i].nuid[0];
? ? ? ? for (uint8_t j = 1; j < 5; j++) {
? ? ? ? ? checksum ^= readers[i].nuid[j];
? ? ? ? }
?
? ? ? ? // Send output to Serial connection
? ? ? ? Serial.write(readers[i].id);
?
? ? ? ? // Send output to Ethernet client
? ? ? ? client.write(readers[i].id);
?
? ? ? ? for (uint8_t j = 0; j < 5; j++) {
? ? ? ? ? // Send output to Serial connection
? ? ? ? ? Serial.print(readers[i].nuid[j] < 0x10 ? "0" : "");
? ? ? ? ? Serial.print(readers[i].nuid[j], HEX);
?
? ? ? ? ? // Send output to Ethernet client
? ? ? ? ? client.print(readers[i].nuid[j] < 0x10 ? "0" : "");
? ? ? ? ? client.print(readers[i].nuid[j], HEX);
? ? ? ? }
?
? ? ? ? // Send output to Serial connection
? ? ? ? Serial.print(checksum < 0x10 ? "0" : "");
? ? ? ? Serial.print(checksum, HEX);
?
? ? ? ? // Send output to Ethernet client
? ? ? ? client.print(checksum < 0x10 ? "0" : "");
? ? ? ? client.print(checksum, HEX);
?
? ? ? ? // Send output to Serial connection
? ? ? ? Serial.write(0x0D);
? ? ? ? Serial.write(0x0A);
? ? ? ? Serial.write('>');
?
? ? ? ? // Send output to Ethernet client
? ? ? ? client.write(0x0D); // CR
? ? ? ? client.write(0x0A); // LF
? ? ? ? client.write('>');? // ETX replaced by '>'
?
? ? ? ? readers[i].mfrc522.PICC_HaltA();
? ? ? ? readers[i].mfrc522.PCD_StopCrypto1();
? ? ? }
? ? }
? }
} Tom |
开云体育Helpful as this is I’m wondering whether Zimo decoders are the best place to start learning decoder definitions??There are many (many) advanced JMRI techniques in there…..
Is there something simpler the OP could start with?
Phil G On 30 Apr 2023, at 16:47, Nigel Cliffe via groups.io <nigel.cliffe@...> wrote:
|
Locked
Jmri 4.99 and above with Fedora 38
开云体育
Well the problem was the update to Fedora 38 specifically the version of gnome ( window manager) they distributed with the release of 38 had a bug in it.? Be sure if you upgrade to Fedora 38 on your host that you apply the latest upgrade to the os ( released
this week) otherwise DecoderPro will crash the gnome-- the window manager ( sometimes PanelPro? will as well). Symptom of the crash is that you are starting DecoderPro -- see the splash screen then the screen goes blank and you are back at the login window
for Fedora.
Jmri 4.99 to current version exhibited this problem, below 4.99 it runs fine without the upgrade released this week.? I have dug into the gnome source code, but still not sure why it crashed, just that it does.? Since redhat has fixed the problem saw no sense
in looking farther into the code.
Bob |
MRFC522, Uno, Ethernet
Tom Thanks for the latest version of the sketch (which I'm calling v5! Lol!). Much better having the reader detection and debugging script, I like to see what's going on! One curious thing though, when booted up, the sketch cycles through all six readers (checked on Uno), A to F and lists the pins they are connected to, even if there is only one reader actually attached! Readers D, E and F come up as pins 14, 15 and 16 respectively, is that normal? I'll have a go with the latest WeMos sketch, but looking online, it seems to be a tricky beast to get working. As a result, I have found an Uno WiFi board that I thought might be easier? Steve |
On Sun, Apr 30, 2023 at 03:43 AM, miktrain wrote:
Blair wrote,Hi Tony, Good to hear from you. BTW, it was actually me that wrote that and not Blair. Anyway thanks for your very useful input there. Having a think about a possible configuration, I also came to the conclusion that some jumpers were going to be needed. I was thinking of the little jumper plugs that plug into headers rather than solder pads. My reason was so that anyone wanting to reconfigure a board just had to move a few jumpers rather than get the soldering iron out! What would your preference be? Steve |
Locked
Re: Which Dapol Imperium do I pick from the JMRI list?
#definitions
开云体育CV105 and CV106 are of no relevance.? They are for end-user notes, so their values are “whatever the end user stored there”.? ? The Dapol Imperiums are not very common.? Dapol are a niche supplier to the UK, using rebadged from elsewhere decoders, and very limited documentation (long running threads on UK forums about lack of documentation for various Dapol decoders).?? ??Its only going to get updated on JMRI if an end user is interested in adding it.? ?Otherwise, pick the nearest and it will be OK. ? ?
? ? ? ? From: [email protected] <[email protected]>
On Behalf Of Mick Moignard
Sent: 30 April 2023 15:47 To: [email protected] Subject: Re: [jmriusers] Which Dapol Imperium do I pick from the JMRI list? ? Duncan ? If it doesn’t show up when you do a New Loco, it means that particular decoder hasn’t been defined to JMRI. To be blunt, that’s because none of the wonderful people who maintain and develop it have seen fit to add this decoder to JMRI. ? What values do you get for CVs 8,7,105 and 106? ?8 and 7 are the manufacturer and versions types, with 105 and 106 also reserved for ID values. ? Mick ________________________________ Mick Moignard m: +44 7774 652504 Skype: mickmoignard ? The week may start M,T but it always ends WTF. ? |
Locked
Re: Loco moving only during sensing decoder type | Decoder Pro
I?
Going by the picture you submitted on another thread, it is a dcc no sound decoder. It is probably an E-Z decoder by what JMRI returns. The highlited decoders are what you have, they all have the same programming, you just pick 1 of them and that is what you will have in your roster when you save it. Now, the next step is to program it. Each page (the tabs at the top) lets you pick whatever you are doing. There are very few pages to consider doing. When you do the address page, put the road number in, and everything else should read correctly.? data. Now hit save. Now remove the loco from the program track and put it on a regular tack powered up and it should respond. Dave Hastings |
Locked
Re: Which Dapol Imperium do I pick from the JMRI list?
#definitions
Egads. I said "Duncan" and now I don't know if it was Mick? My point was not to anger anyone. Just to say how much I appreciate JMRI volunteers.
Morgan Bilbo, Digitrax DCS50, UT4d, UR93, SPROGIIv4, JMRI 5.0, Model PRR 1952. |
Locked
Re: Which Dapol Imperium do I pick from the JMRI list?
#definitions
Duncan: I think you need to rephrase your comment. How long does it take for a volunteer to gather the correct data to add a new decoder to JMRI? You make it sound like "the wonderful people" are too slow. Your statement "seen fit to add" is not very nice!
I think we owe a great deal of thanks to all those who do the work on JMRI. And have the decency to wait until someone has the time and correct data to do the work to add a new decoder. Patience is a virtue! Morgan Bilbo, Digitrax DCS50, UT4d, UR93, SPROGIIv4, JMRI 5.0, Model PRR 1952. |
开云体育Read these pages carefully:
? and
? You also need a text editor, ideally one which does a decent job with XML.? I use “Notepad++” on Windows.? ? Then start looking at the decoder files.? You can construct locally held decoder files in the “preferences” area where settings are stored, typically on a Windows machine that’s in: C:\users\[yourname]\JMRI\[systemconnection]\decoders ? The main files are in the “program” area, under xml/decoders ? Zimo files are moderately complex.? There’s a large “zimo” sub-folder of components used in the files, and then a number of files which reflect the decoder versions. ? Suggest as a starting point, pickup the v39 file for the MX640-660 decoders, putting a copy in your locally held area, renaming it to cover the MX690-699 decoders, and opening it for editing.??? Remove most of the decoders in your copy of the file, and try to create something for one of the MX690-series. ?(I’d do it almost a line or element at a time, to keep errors to a minimum). There’s a tool inside JMRI to “validate XML” which will spot many syntax errors in XML (and you can correct them!).? Then load this file into JMRI (recompile decoder index, which can take ages, will report errors on the system console if you’ve made a mistake).??? IF it works, you’ll have the new file in your decoder list.??? ? From there start making changes, such as getting the right number of function outputs.? ? ? Next, look at various CV’s in decoder files, and investigate the zimo sub-component files. ?This gets a bit more complex, but that’s perhaps lesson-2.? ? ? I recommend you get someone to go over your changes and make comments before they are submitted to JMRI as a change request.? ? - Nigel ? ? From: [email protected] <[email protected]>
On Behalf Of Michael Carney
Sent: 29 April 2023 15:17 To: [email protected] Subject: Re: [jmriusers] Zimo Decoder MS950 and MS990 Definitions #zimo ? I would like to learn how to make the changes. ?How do I get started. |
Locked
Re: Which Dapol Imperium do I pick from the JMRI list?
#definitions
开云体育DuncanIf it doesn’t show up when you do a New Loco, it means that particular decoder hasn’t been defined to JMRI. To be blunt, that’s because none of the wonderful people who maintain and develop it have seen fit to add this decoder to JMRI. What values do you get for CVs 8,7,105 and 106? ?8 and 7 are the manufacturer and versions types, with 105 and 106 also reserved for ID values. Mick ________________________________ Mick Moignard m: +44 7774 652504 Skype: mickmoignard The week may start M,T but it always ends WTF. |
Ah, my mistake on diesel vs steam. The correct file is 'xml/decoders/TCS_WOW_steam04.xml’. The reset sections in the files are the same.
JMRI’s CV="T2CV.5.0" default=“8” does exactly what you expect, and what you’re seeing: CV201 = 5 / CV202 = 0 / CV203 = 0 / CV204 = 8 Bob On Apr 30, 2023, at 10:22 AM, Tim Kelley <tim.kelley@...> wrote:— Bob Jacobsen rgj1927@... |
Tim Kelley
Bob,
#1.) We are using TCS Steam WOW-121. Your prior post references diesel.....which is incorrect. #2.) I don't know what " <factReset label="User Preset 1" CV="T2CV.5.0" default="8"/> " T2CV.5.0 is......???? The CORRECT way to do a USER PRESET 1 reset is CV201 = 5 / CV202 = 0 / CV203 = 0 / CV204 = 8 Thanks, Tim |
The decoder file (xml/decoders/TCS_WOW_Diesel04.xml) has this for its reset definitions:
<resets> <mode>PAGEMODE</mode> <mode>DIRECTMODE</mode> <mode>OPSBYTEMODE</mode> <factReset label="Entire decoder (except speed table)" CV="8" default="2"/> <factReset label="Entire decoder (except address and speed table)" CV="T2CV.5.0" default="2"/> <factReset label="All sound settings" CV="T2CV.5.0" default="3"/> <factReset label="Sound Function mappings" CV="T2CV.5.0" default="4"/> <factReset label="Sound CV's" CV="T2CV.5.0" default="6"/> <factReset label="Sound type volumes" CV="T2CV.5.0" default="7"/> <factReset label="User Preset 1" CV="T2CV.5.0" default="8"/> <factReset label="User Preset 2" CV="T2CV.5.0" default="9"/> <factReset label="User Preset 3" CV="T2CV.5.0" default="10"/> <factReset label="Quick Lighting Preset: Standard Ditch Lights" CV="8" default="10"/> <factReset label="Quick Lighting Preset: Standard Trolley" CV="8" default="11"/> <factReset label="Quick Lighting Preset: Modified Trilley" CV="8" default="12"/> </resets> That means it prefers paged mode, if the command station currently has that available (not all do). If you want to try doing the reset in direct mode you can remove the “PAGEMODE” line from the file. Alternately, as an experiment, you could try sending those CV operations using the “Single CV programmer” which lets you set the mode directly. Although it’s worthwhile to try these, I don’t expect that changing the programming mode will change the behavior of the decoder. If it’s accepting the writes (which it sounds like it is, as there’s no error indication), the write mode shouldn’t matter. Bob On Apr 30, 2023, at 10:07 AM, Tim Kelley <tim.kelley@...> wrote:— Bob Jacobsen rgj1927@... |
Tim Kelley
Good morning Bob,
I've been through many of those documents. "Reset / Factory Reset / USER PRESET 1" is what TCS calls their "Nuclear Reset". It is my understanding that if you have NEVER saved to USER PRESET 1, then doing a Reset / Factory Reset / USER PRESET 1 will load the factory default settings which is what I am trying to accomplish. My question is if I am programming in Direct Byte Mode on the programming track then why is DecoderPro writing the reset sequences in Paged Mode. That's what I was seeing in LocoNet Monitor. That doesn't seem correct to me. -Tim |
Is this related to the TCS-Users thread at /g/TCS-Users/topic/98477162 ?
It sounds like the decoder isn’t executing the reset, at least not in the way you’re expecting. The are some documents for the decoder (I think) at The “Programming Guide” (WOWDiesel Sound Manual V4.pdf) says that reset sequence “Loads Preset #1” . On page 21 that says “you can call up one of 3 User Presets that you may have saved using (Audio Assist). Have you saved one of those for Preset #1? Bob On Apr 30, 2023, at 9:44 AM, Tim Kelley <tim.kelley@...> wrote:— Bob Jacobsen rgj1927@... |
Locked
Re: Loco moving only during sensing decoder type | Decoder Pro
Thomas
Just because you have the roster entry created, you are missing the second step of roster creation. Read all sheets. WHen you first create a toster entry, the data is filled with default data. This is usually from the Mfg documents on how decoders come from the factory. (or OEM for Loks) If you buy the decoder new, this is reasonable. IF you buy used (or loksound) the default can be wildly different. You need to one simple step to fix this, 'Read all sheets". Or open the CV pane and read full sheet. This populates the roster with the settings actually in the decoder, not some theoretical default. ? -- --- Thomas DeSoto, TX |
JMRI has a bunch of WOW 121 models:
WOWDiesel V5 121 WOW Diesel 121 SS2 WOW Diesel 121 SS3 WOW Diesel 121 SS4 WOW Diesel 121 SS4 Prime WOW Diesel 121 EMD WOW Sound 121 WOW Steam 121 SS4 Could you say which you’re using please? Bob On Apr 30, 2023, at 9:19 AM, Tim Kelley <tim.kelley@...> wrote:— Bob Jacobsen rgj1927@... |
Tim Kelley
Good morning,
I believe there may be a possible bug in JMRI / DecoderPro when using a TCS WOW-121 Steam Decoder. I have the latest test release of JMRI running (5.3.5). I have a Digitrax DCS240+ command station and a SoundTraxx PTB-100 Programming track booster. I have a dedicated programming track with a Broadway Limited Imports HO Steam Locomotive. This locomotive has a TCS B-MB4 motherboard and a TCS WOW-121 Steam decoder installed in it. So far it seems to be working well. I am on the programming track / LocoNet / Mode = Direct Byte. I started up a LocoNet monitor window so I could see what was going on. When I attempted to do a Reset / Factory Reset / USER PRESET 1, the LocoNet Monitor window indicated that it was doing a "Write Byte in Paged Mode on Service Track". Shouldn't that have been "Write Byte in Direct Mode on Service Track"??? I also noticed that when doing a Reset / Factory Reset / "Entire Decoder (except speed table)" it also did a "Write Byte in?Paged?Mode on Service Track". The "reset entire decoder" DOES seem to reset the decoder. The USER PRESET 1 factory reset does NOT appear to be working. However it is writing the correct values to the correct CVs in the correct order. (CV201=5, CV202=0, CVC203=0, CV204=8). I believe I am doing these things correctly. However I'm kind of a newbie so I may not be understanding things correctly. Is there a process for reporting a possible JMRI / DecoderPro bug? Thanks, have a good day! Tim |