kubtss / Mbed 2 deprecated BIRD2017

Dependencies:   mbed-rtos mbed

Revision:
8:ca92cb674004
Parent:
7:6f7bd18ce796
Child:
9:d1fc0805ec7d
--- a/main.cpp	Sat Oct 10 22:53:05 2015 +0000
+++ b/main.cpp	Tue Oct 13 13:10:21 2015 +0000
@@ -1,3 +1,11 @@
+//@todo trimのパラメータをpcから設定,csvファイルに追加
+//@todo initをクラス化
+
+//@todo androidとの通信
+//@todo xbeeとの通信
+
+//@todo 高度計の追加
+
 #include "mbed.h"
 #include "rtos.h"
 #include "Global.h"
@@ -20,7 +28,7 @@
 
 Display display(p9, p10);
 XBee xbee(p13, p14);
-Trim trim(p16, p17, p15);
+Trim trim(p16, p17);
 ControllerManager controllerManager(p18,p19,p20);
 ServoManager servoManager(p21, p22);
 Airspeed airspeed(p26, NC, NC);
@@ -78,27 +86,75 @@
                         Global::setmaxyawdegree(num);
                     }else if(command == "rudmindeg"){
                         Global::setminyawdegree(num);
+                    
+                    }else if(command == "elemaxplay"){
+                        Global::setmaxpitchplayratio(num);
+                    }else if(command == "eleminplay"){
+                        Global::setminpitchplayratio(num);                        
+                    }else if(command == "rudmaxplay"){
+                        Global::setmaxyawplayratio(num);
+                    }else if(command == "rudminplay"){
+                        Global::setminyawplayratio(num);
                         
                     }else{
                         pc.printf("Invalid Input\n");
                     }
                     
-                    //ここで,ニュートラル情報をLocalFileに保存
-                    Global::filewrite();    
                 }else{//数値データがないコマンド(" "がない場合)
+                
                     std::string command = strbuf.substr(0,strbuf.size()-2);
-                    if(command == "show"){
+                    if(command == "eleneu"){
+                        Global::setneutralpitch(Global::getpitch());
+                    }else if(command == "elemax"){
+                        Global::setmaxpitch(Global::getpitch());
+                    }else if(command == "elemin"){
+                        Global::setminpitch(Global::getpitch());
+                    }else if(command == "rudneu"){
+                        Global::setneutralyaw(Global::getyaw());
+                    }else if(command == "rudmax"){
+                        Global::setmaxyaw(Global::getyaw());
+                    }else if(command == "rudmin"){
+                        Global::setminyaw(Global::getyaw());
+                        
+                    }else if(command == "eleneudeg"){
+                        Global::setneutralpitchdegree(Global::getpitchdegree());
+                    }else if(command == "elemaxdeg"){
+                        Global::setmaxpitchdegree(Global::getpitchdegree());
+                    }else if(command == "elemindeg"){
+                        Global::setminpitchdegree(Global::getpitchdegree());
+                    }else if(command == "rudneudeg"){
+                        Global::setneutralyawdegree(Global::getyawdegree());
+                    }else if(command == "rudmaxdeg"){
+                        Global::setmaxyawdegree(Global::getyawdegree());
+                    }else if(command == "rudmindeg"){
+                        Global::setminyawdegree(Global::getyawdegree());
+                        
+                    }else if(command == "show"){
+                        pc.printf("------Servo Parameter------\n");
                         pc.printf("elevatorNeutral = %f\n", Global::getneutralpitch());
                         pc.printf("elevatorMax     = %f\n", Global::getmaxpitch());
                         pc.printf("elevatorMin     = %f\n", Global::getminpitch());
                         pc.printf("rudderNeutral   = %f\n", Global::getneutralyaw());
                         pc.printf("rudderMax       = %f\n", Global::getmaxyaw());
                         pc.printf("rudderMin       = %f\n", Global::getminyaw());
-                    }else if(command == "reset"){
-                    
+                        pc.printf("----Controller Parameter----\n");
+                        pc.printf("elevatorNeutral = %f\n", Global::getneutralpitchdegree());
+                        pc.printf("elevatorMax     = %f\n", Global::getmaxpitchdegree());
+                        pc.printf("elevatorMin     = %f\n", Global::getminpitchdegree());
+                        pc.printf("rudderNeutral   = %f\n", Global::getneutralyawdegree());
+                        pc.printf("rudderMax       = %f\n", Global::getmaxyawdegree());
+                        pc.printf("rudderMin       = %f\n", Global::getminyawdegree());
+                        pc.printf("------Controller Play------\n");
+                        pc.printf("elevatorMaxPlay = %f\n", Global::getmaxpitchplayratio());
+                        pc.printf("elevatorMinPlay = %f\n", Global::getminpitchplayratio());
+                        pc.printf("rudderMaxPlay   = %f\n", Global::getmaxyawplayratio());
+                        pc.printf("rudderMinPlay   = %f\n", Global::getminyawplayratio());
+                        
                     }else{
                         pc.printf("Invalid Input\n");
                     }
+                    //ここで,ニュートラル情報をLocalFileに保存
+                    Global::filewrite();    
                 }
                 strbuf.clear();
             }