Various code fixes. TrainCtrl works on the Pi now.