Railway Challenge
/
challenge
Uncommenting of part that allow supercaps to charge up from the batteries
Diff: main.cpp
- Revision:
- 20:0add93a69df5
- Parent:
- 19:a4afd3a6bdfb
- Child:
- 21:0cc8e3ee53f6
diff -r a4afd3a6bdfb -r 0add93a69df5 main.cpp --- a/main.cpp Tue May 17 10:32:46 2022 +0000 +++ b/main.cpp Tue May 17 10:43:19 2022 +0000 @@ -30,8 +30,8 @@ void DisplaySerial(){ std::stringstream displayline; displayline << "Blackbox# " << " Motor Accelerator: " << motorAccelerator << " Brake 3/2: " << brakeValve32 << " Brake 2/2: " << brakeValve22 << " Speed: " << dashboard.currentSpeed << " Distance: " << dashboard.currentDistance << " Drive Mode: " << driveMode << "\n"; - string disp=displayline.str(); - pc.printf("%s \n",disp); + string disp = displayline.str(); + pc.printf("%s \n", disp.c_str()); } //Emergency Stop @@ -367,7 +367,12 @@ /////////////////////////Innovation braking end //normal throttle control else { + if (remote.throttle == 0 and dashboard.currentSpeed == 0){ + brakeControl(2); + } + else { speedControl(remote.throttle); + } pc.printf("Throttling: %d\r\n", remote.throttle); } } // remote.throttle