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:
- 14:3e21d6c764a5
- Parent:
- 12:e99a0f23e91a
- Child:
- 15:da14227cdd1d
- Child:
- 27:3a6d5243e5e7
diff -r e99a0f23e91a -r 3e21d6c764a5 Steering.cpp --- a/Steering.cpp Sat Oct 18 17:05:45 2014 +0000 +++ b/Steering.cpp Sat Oct 18 17:17:02 2014 +0000 @@ -209,32 +209,39 @@ 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; } void reset() { - txWriteDirect(Txmsg_reset); - mbed_reset(); - -// display.ClearScreen(); -// display.SelectFont(Arial12,BLACK,ReadData); -// display.GotoXY(16,16); -// display.PrintString(" RESET INITIATED"); -// printf("Reset Initiated\n\r"); + display.ClearScreen(); + display.SelectFont(Arial12,BLACK,ReadData); + display.GotoXY(16,16); + display.PrintString(" RESET INITIATED"); + printf("Reset Initiated\n\r"); return; } @@ -263,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);