positron96/LocoNetControlStation

Loconet switch

conaito opened this issue · 18 comments

I attached the Uhlenbrock IB Switch but it seems to not work. Looks like it wait for some switch settings from command station:

I][WiThrottle.cpp:91] begin(): WiThrottleServer::begin
*WM: [3] unloading
onPacket: SW_STATE(BC) 00 00 43
onPacket: SW_STATE(BC) 00 00 43
onPacket: SW_STATE(BC) 00 00 43

Any idea how i get it work?

if i use command station as sniffer (by use a Loconet command station) i get follow serial on pluging the IB Switch:

[I][WiThrottle.cpp:91] begin(): WiThrottleServer::begin
*WM: [3] unloading
onPacket: LONG_ACK(B4) 3C 50 27
onPacket: SW_STATE(BC) 01 00 42
onPacket: LONG_ACK(B4) 3C 30 47
onPacket: SW_STATE(BC) 07 00 44
onPacket: LONG_ACK(B4) 3C 30 47

Hi, thanks for the report and sniffer dump.

Please describe what your setup is. What loconet devices are connected to the bus apart from ESP32 and IB Switch? A switch decoder itself? Another command station?

Did it start to work after you fixed the hardware?

Well then, my question still stands. What is your setup? I actually don't know what command station needs to do when your switch controller talks to switch decoder. It is my understanding that it should do nothing, and it is implemented this way. Is your decoder connected via LocoNet or DCC?

The IB Switch is just a board from Uhlenbrock with buttons (to can use as switches for turnouts as example). Thats what you need to know?

Please describe what your setup is. What loconet devices are connected to the bus apart from ESP32 and IB Switch? A switch decoder itself? Another command station?

So, are your turnout decoders connected via DCC? The command station does not forward switch commands from LocoNet to DCC. I have no DCC decoders and so have no way to test if such forwarding works. Also, without decoders I have no need for this feature.

Yes, your other command station answers to LocoNet switch requests (on behalf of DCC decoders that can't talk back). This command station does not process switch commands in any way.

No, it's not that difficult. There is some work already done in the form of turnout roster.
The good thing about open-source is that you can always implement what you need yourself.

Processing of LocoNet messages is done in LocoNetSlotManager in processMessage (there is a big switch on opcodes), you'd need to add case of the messages you need. As you have found, turnout roster is handled by CommandStation, Methods getTurnouts and turnoutToggle and turnoutAction would be needed to react of recieved LocoNet messages.

Closing in favor of #16