SwitchMode
Dependencies: BEAR_Protocol InverseLeg iSerial mbed
Diff: main.cpp
- Revision:
- 1:183e6088a1fa
- Parent:
- 0:f73c80b36c20
- Child:
- 2:d6be1c49d9d5
--- a/main.cpp Fri Jan 22 07:46:51 2016 +0000 +++ b/main.cpp Fri Jan 22 08:03:29 2016 +0000 @@ -26,7 +26,7 @@ }; max_ang Lmax,Lmin; min_ang Rmax,Rmin; - Lmax.Knee = Lmax.knee = Lmin.Knee = Lmin.knee = Rmax.Knee = Rmax.knee = Rmin.Knee = Rmin.knee = 0; + Lmax.Knee = Lmax.Hip = Lmin.Knee = Lmin.Hip = Rmax.Knee = Rmax.Hip = Rmin.Knee = Rmin.Hip = 0; bool a,b,c,d; a = b = c = d = false; float temp_LH=0,temp_LK=0,temp_RH=0,temp_RK=0; @@ -57,17 +57,13 @@ pc.printf("*\t22) Set Left Knee Margin\n"); pc.printf("*\t23) Set Right Hip Margin\n"); pc.printf("*\t24) Set Right Knee Margin\n"); - /*pc.printf("*\t25) Set Lenght of Left Link Hip\n"); - pc.printf("*\t26) Set Lenght of Left Link Knee\n"); - pc.printf("*\t27) Set Lenght of Right Link Hip\n"); - pc.printf("*\t28) Set Lenght of Right Link Knee\n");*/ - pc.printf("*\t29) Set Offset\n"); - pc.printf("*\t30) Set Body Lenght of Left Side\n"); - pc.printf("*\t31) Set Body Lenght of Right Side\n"); - pc.printf("*\t32) Set Maximum Hip Angle Range\n"); - pc.printf("*\t33) Set Minimum Hip Angle Range\n"); - pc.printf("*\t34) Set Maximum Knee Angle Range\n"); - pc.printf("*\t35) Set Minimum Knee Angle Range\n"); + pc.printf("*\t25) Set Offset\n"); + pc.printf("*\t26) Set Body Lenght of Left Side\n"); + pc.printf("*\t27) Set Body Lenght of Right Side\n"); + pc.printf("*\t28) Set Maximum Hip Angle Range\n"); + pc.printf("*\t29) Set Minimum Hip Angle Range\n"); + pc.printf("*\t30) Set Maximum Knee Angle Range\n"); + pc.printf("*\t31) Set Minimum Knee Angle Range\n"); pc.printf("*\t40) Exit Program \t\t\t*\n"); pc.printf("************Don't Forget to Save Data************\n"); @@ -391,59 +387,7 @@ } else bcom.saveDataToEEPROM(RIGHT_SIDE,LOW_MARGIN); } - /*else if(option == 25) { //Lenght of Left Link Hip - pc.printf("\nType 9999 to Exit to Main Menu\n"); - pc.printf("Input Lenght of Left Link Hip\n"); - pc.scanf("%f",&temp); - - if(temp != 9999) { - pc.printf("\nLenght of Left Link Hip = %f\n",temp); - LLink[0] = temp; - a = true; - bcom.setUpAngleRange(LEFT_SIDE,temp); - } else bcom.saveDataToEEPROM(LEFT_SIDE,UP_LINK_LENGTH); - } - - else if(option == 26) { //Lenght of Left Link Knee - pc.printf("\nType 9999 to Exit to Main Menu\n"); - pc.printf("Input Lenght of Left Link Knee\n"); - pc.scanf("%f",&temp); - - if(temp != 9999) { - pc.printf("\nLenght of Left Link Knee = %f\n",temp); - LLink[1] = temp; - b = true; - bcom.setLowAngleRange(LEFT_SIDE,temp); - } else bcom.saveDataToEEPROM(LEFT_SIDE,LOW_LINK_LENGTH); - } - - else if(option == 27) { //Lenght of Right Link Hip - pc.printf("\nType 9999 to Exit to Main Menu\n"); - pc.printf("Input Lenght of Right Link Hip\n"); - pc.scanf("%f",&temp); - - if(temp != 9999) { - pc.printf("\nLenght of Right Link Hip = %f\n",temp); - RLink[0] = temp; - c = true; - bcom.setUpAngleRange(RIGHT_SIDE,temp); - } else bcom.saveDataToEEPROM(RIGHT_SIDE,UP_LINK_LENGTH); - } - - else if(option == 29) { //Lenght of Right Link Knee - pc.printf("\nType 9999 to Exit to Main Menu\n"); - pc.printf("Input Lenght of Right Link Knee\n"); - pc.scanf("%f",&temp); - - if(temp != 9999) { - pc.printf("\nLenght of Right Link Knee = %f\n",temp); - RLink[1] = temp; - d = true; - bcom.setLowAngleRange(RIGHT_SIDE,temp); - } else bcom.saveDataToEEPROM(RIGHT_SIDE,LOW_LINK_LENGTH); - }*/ - - else if(option == 29) { //Offset + else if(option == 25) { //Offset if(a == true && b == true && c == true && d == true) { //float HipAngle[2],KneeAngle[2]; float LHipAngle,LKneeAngle; @@ -467,7 +411,7 @@ } else pc.printf("\nYou have to do choice 25-28 first\n\n"); } - else if(option == 30) { //Body Lenght of Left Side + else if(option == 26) { //Body Lenght of Left Side do { pc.printf("\nType 9999 to Exit to Main Menu\n"); pc.printf("Input Body Lenght of Left Side\n"); @@ -481,7 +425,7 @@ } while(temp!=9999); } - else if(option == 31) { //Body Lenght of Right Side + else if(option == 27) { //Body Lenght of Right Side do { pc.printf("\nType 9999 to Exit to Main Menu\n"); pc.printf("Input Body Lenght of Right Side\n"); @@ -495,7 +439,7 @@ } while(temp!=9999); } - else if(option == 32) { //Set Maximum Hip Angle Range + else if(option == 28) { //Set Maximum Hip Angle Range do { pc.printf("\nType 9999 to Exit to Main Menu\n"); pc.printf("1) Left Side\n"); @@ -525,7 +469,7 @@ } while(temp!=9999); } - else if(option == 33) { //Set Minumum Hip Angle Range + else if(option == 29) { //Set Minumum Hip Angle Range do { pc.printf("\nType 9999 to Exit to Main Menu\n"); pc.printf("1) Left Side\n"); @@ -556,7 +500,7 @@ } - else if(option == 34) { //Set Maximum Knee Angle Range + else if(option == 30) { //Set Maximum Knee Angle Range do { pc.printf("\nType 9999 to Exit to Main Menu\n"); pc.printf("1) Left Side\n"); @@ -586,7 +530,7 @@ } while(temp!=9999); } - else if(option == 32) { //Set Minumum Knee Angle Range + else if(option == 28) { //Set Minumum Knee Angle Range do { pc.printf("\nType 9999 to Exit to Main Menu\n"); pc.printf("1) Left Side\n"); @@ -621,14 +565,14 @@ - else if(option == 33) { + else if(option == 40) { pc.printf("Are You Sure ?\n"); pc.printf("\n1) Yes\n"); pc.printf("2) No\n"); pc.scanf("%d",&option); if(option==1) { - option = 23; + option = 40; pc.printf("Please Push Button Restart\n"); } else pc.printf("Return to Main Menu\n"); @@ -637,7 +581,7 @@ else { // if user has entered invalid choice (other than 1,2,3 or 4) // Displaying error message - pc.printf("Invalid Option entered\n"); + pc.printf("\nInvalid Option entered\n"); } } while(option != 40); // condition of do-while loop @@ -646,9 +590,13 @@ int main() { pc.baud(115200); + pc.printf("Start\n"); - if(button==1) + if(!button) { + while(!button); SwMode(); + } + } /*int main()