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:
- 9:e946cafa3cae
- Parent:
- 7:df257df56363
- Child:
- 10:493f2151d5f1
- Child:
- 13:1f05dcd9ae0e
diff -r 57f279f486d9 -r e946cafa3cae Steering.cpp --- a/Steering.cpp Thu Oct 16 22:37:28 2014 +0000 +++ b/Steering.cpp Sat Oct 18 16:36:44 2014 +0000 @@ -1,6 +1,5 @@ #include "Steering.h" - void HomeScreen() { CANMessage Rxmsg; @@ -208,25 +207,26 @@ } -void ON() +void request_status_change() { - Txmsg_Drive.data[0]|=(1<<0); - wait(0.1); + //drive_status != drive_status; + //wait(0.1); + + //char status_string = (drive_status == 1 ? "ON" : "OFF"); display.ClearScreen(); display.SelectFont(Arial12,BLACK,ReadData); display.GotoXY(26,16); - display.PrintString(" ON INITIATED"); - printf("ON Initiated\n\r"); - //screen=0; + display.PrintString("REQUEST SENT TO CHANGE DRIVE STATUS TO "); + printf("DRIVE STATUS CHANGE Initiated\n\r"); + + + return; } -void ResetCommand() +void reset() { - Txmsg_Drive.data[0]&=~(1<<0); - wait(0.1); - display.ClearScreen(); display.SelectFont(Arial12,BLACK,ReadData); display.GotoXY(16,16); @@ -259,9 +259,8 @@ { pc.baud(230400); CAN_Steering.frequency(500000); - for(int i = 0; i<4; i++){ - drive[i] = (0x00); - } + drive_status = 0; + reset_body = 0; ledstream.write(0); call_ledstream.attach(&Powerstream,0.1); } @@ -278,26 +277,19 @@ display.PrintString("Penn Electric Racing"); wait(1); - - Thread thread(display_speed_data); // Start to read buttons on main thread - screen=0; - wait(1); while(1) { if(biSWBL.read()) { - ON(); - //wait(1); - // HomeScreen(); + request_status_change(); } if(biSWBR.read()) { - ResetCommand(); + reset(); } - CAN_Steering.write(Txmsg_Drive); - wait(0.3); + } }