Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: main.cpp
- Revision:
- 7:6f7bd18ce796
- Parent:
- 6:0d9fa7152934
- Child:
- 8:ca92cb674004
--- a/main.cpp Sat Oct 10 20:16:31 2015 +0000 +++ b/main.cpp Sat Oct 10 22:53:05 2015 +0000 @@ -46,14 +46,13 @@ if(temp == '\n'){ std::string::size_type spaceIndex = strbuf.find(" "); - if (spaceIndex != std::string::npos) { + if (spaceIndex != std::string::npos) {//数値データがあるコマンド(" "がある場合) char *gomi; std::string command = strbuf.substr(0, spaceIndex); - double num = strtod(strbuf.substr(spaceIndex+1, strbuf.size()-1).c_str(), &gomi); + double num = strtod(strbuf.substr(spaceIndex+1, strbuf.size()-2).c_str(), &gomi);//strbuf.size()-1には'\n'が入っている pc.printf("coms=%s, num=%f\n", command.c_str(), num); - if(command == "eleneu"){ Global::setneutralpitch(num); }else if(command == "elemax"){ @@ -66,12 +65,42 @@ Global::setmaxyaw(num); }else if(command == "rudmin"){ Global::setminyaw(num); + + }else if(command == "eleneudeg"){ + Global::setneutralpitchdegree(num); + }else if(command == "elemaxdeg"){ + Global::setmaxpitchdegree(num); + }else if(command == "elemindeg"){ + Global::setminpitchdegree(num); + }else if(command == "rudneudeg"){ + Global::setneutralyawdegree(num); + }else if(command == "rudmaxdeg"){ + Global::setmaxyawdegree(num); + }else if(command == "rudmindeg"){ + Global::setminyawdegree(num); + + }else{ + pc.printf("Invalid Input\n"); } - strbuf.clear(); //ここで,ニュートラル情報をLocalFileに保存 Global::filewrite(); + }else{//数値データがないコマンド(" "がない場合) + std::string command = strbuf.substr(0,strbuf.size()-2); + if(command == "show"){ + 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"){ + + }else{ + pc.printf("Invalid Input\n"); + } } + strbuf.clear(); } Thread::wait(10); if(strbuf.size() >= BUFMAX){