I have now got the "mobile" version of the code working.
Key features are:
- The code acts as a single slot "Command Station".
It responds with a Slot number equating to the Locomotive address, which is set in CV
CV's can be set and read using the RocRail programmer.
CV's 5 and 2 set the upper and lower limts of the Servo for forwards speed.
CV's 9 and 6 set the upper and lower limits of the Servo for backwards speed
CV[29} bit 0 controls direction normal or reversed.
Acceleration is controlled by CV
Lights on NodeMCU ports D0 and D3 are "forward and "backwards" lights, switched on by f0. (connect LED to 3.3V!!. )
D8 is a servo output that controls the locomotive motor.
I use the servo motor BECC interface as a 5V source powered by the LIPO used to power the motors.
MFRC522 reader uses D1,D2 D5,D6 D7
The RFID reader speed is the main issue I would like to improve. It takes 21ms to do a read, largely independent of the SPI clock speed. hopefully some collaborators will take up the challenge of finding where the time is spent..