The Code Repository for the REV0 Steering Wheel.
Dependencies: CANBuffer KS0108_fork mbed-rtos mbed CAN Addresses
Fork of REVO_Updated_Steering by
Diff: Steering.cpp
- Revision:
- 13:1f05dcd9ae0e
- Parent:
- 9:e946cafa3cae
- Child:
- 15:da14227cdd1d
diff -r e946cafa3cae -r 1f05dcd9ae0e Steering.cpp --- a/Steering.cpp Sat Oct 18 16:36:44 2014 +0000 +++ b/Steering.cpp Sat Oct 18 17:05:39 2014 +0000 @@ -209,19 +209,29 @@ void request_status_change() { - //drive_status != drive_status; - //wait(0.1); + + char drive_status_request = !drive_status; + char * status_string; - //char status_string = (drive_status == 1 ? "ON" : "OFF"); + if(drive_status_request){ + status_string = "ON"; + } + else{ + status_string = "OFF"; + } + + for(int i = 0; i < 10; i++){ + CAN_Steering.write(Txmsg_drive_status_request); + } display.ClearScreen(); display.SelectFont(Arial12,BLACK,ReadData); display.GotoXY(26,16); - display.PrintString("REQUEST SENT TO CHANGE DRIVE STATUS TO "); - printf("DRIVE STATUS CHANGE Initiated\n\r"); + display.PrintString("REQUEST SENT TO CHANGE DRIVE STATUS TO: "); + display.PrintString(status_string); + display.PrintString(".\n"); - - + printf("DRIVE STATUS CHANGE Initiated\n\r"); return; } @@ -260,6 +270,7 @@ pc.baud(230400); CAN_Steering.frequency(500000); drive_status = 0; + drive_status_request = 1; reset_body = 0; ledstream.write(0); call_ledstream.attach(&Powerstream,0.1);