This project is a Client for Rocrail that controls locos. It is designed to work on a standard "Wemos ESP8266 Battery OLED board".
The code Uses the new Rocrail 'lcprops' command to get the Loco list. so must be used with Rocrail after version 13870 2018-04-17
The code is available at http://github.com/dagnall53/RocClientThrottle
After the unit has found the wifi router and connected to the MQTT broker the screen will show an image of a loco and the words "press to refresh Loco List".
Press the 5 way button "in" and the list should populate with your list of locos from Rocrail. Press the button "up" or "down" to select the loco you want to use.
Press "right" (Away from the OLED) and the screen will show the selected loco name, and "Speed:0 STOP".
The throttle uses the Rocrail loco speeds V_min, V_Mid, V_Cru and V_Max as set for the loco in Rocrail.
You can select these speeds in forwards and reverse by selecting Up and down. If you press the button "in" when moving, the speed is set to 0.
Pressing the button in when the sped is 0 will send F2 to the loco, which on most is a toot.
From Speed, press "right" to access a screen where Fn 1-8 can be momentarily triggered. This screen also allows the lights to be toggled on and off in position "F0".
From the Fn selection screen, press right again to scroll to the loco selection screen.
Pressing "Left" at any time will reboot the code. (Do not blame me, the switch is hardwired to reset!).
If you use the Rotary Switch code option, the up and down will move the speed by "1" per click
The up and down move by "10" per click
This code allows for up to 126 locos. Above this the code gets unstable. If you have >100 locos you should be considering another "proper" throttle! Code is at https://github.com/dagnall53/RocClientThrottle
For reference: My ESProcnetsound (https://github.com/dagnall53/ESPMQTTRocnetSound) modules use ROCNET protocol sent over a MQTT "wiring". Rocnet uses a very specific protocol described in (https://wiki.rocrail.net/doku.php?id=rocnet:rocnet-prot-en).
The Throttle and Switch use what Rocrail calls a "Client Service", sent over MQTT. This sends ASCII type messages and not "rocnet" messages see: (https://wiki.rocrail.net/doku.php?id=rocrailini-service-en).