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: userTask.cpp
- Revision:
- 26:732bc37fbefd
- Parent:
- 25:f3a6e7eec9c3
- Child:
- 27:ff63c23bc689
--- a/userTask.cpp Wed Dec 12 23:52:22 2018 +0000
+++ b/userTask.cpp Thu Dec 13 12:15:35 2018 +0000
@@ -156,19 +156,44 @@
//SWのチェック
//離陸ボタン押下
//とりあえず、YawCtrlで代用
- if(hb.chkSWUserOpe(HbUserOpe::YAW_CTRL))
- {
- // TODO IMU Cal
- hb.calAtt();
- setState(TAKE_OFF);
+ //if(hb.chkSWUserOpe(HbUserOpe::YAW_CTRL))
+ //{
+ // // TODO IMU Cal
+ // hb.calAtt();
+ // setState(TAKE_OFF);
+ //}
+ if(hb.chkSWUserOpe(HbUserOpe::F_L)){
+ // Front Left
+ hb.addMotOfs(HbUserOpe::F_L);
+ }
+ if(hb.chkSWUserOpe(HbUserOpe::F_R)){
+ // Front Right
+ hb.addMotOfs(HbUserOpe::F_R);
}
+ if(hb.chkSWUserOpe(HbUserOpe::R_L)){
+ // Rear Left
+ hb.addMotOfs(HbUserOpe::R_L);
+ }
+ if(hb.chkSWUserOpe(HbUserOpe::R_R)){
+ // Rear Right
+ hb.addMotOfs(HbUserOpe::R_R);
+ }
+ if(hb.chkSWUserOpeRE(HbUserOpe::EMG_STOP)){
+ // EMG STOP だが、テスト用のため、モーターのオフセットを0にして回転を止める
+ //sp.printf("RisingEdge!\r\n");
+ for(int i = 0; i < 4; ++i){
+ gf_MtReq[i].bf.req = true;
+ gf_MtReq[i].bf.val = 0;
+ }
+ }
+
//else if(hb.chkSWUserOpe(HbUserOpe::ENG_STOP))
//{
// setState(SLEEP);
//}
- if(hb.chkSWUserOpeAny()){
- sp.printf("SW :[%X]\r\n",hb.getUserSw());
- }
+ //if(hb.chkSWUserOpeAny()){
+ // sp.printf("SW :[%X]\r\n",hb.getUserSw());
+ //}
bDoCtrlMot = true;
break;
case TAKE_OFF:
@@ -240,6 +265,10 @@
gf_Print.flg=gf_Mon.flg;
sp.printf("\r\n");
}
+ if(gf_DbgPrint.flg != 0){
+ gf_DbgPrint.flg = 0;
+ sp.printf("\r\n");
+ }
//次の周期まで待つ
vTaskDelayUntil(&xLastWakeTime, 20 / portTICK_RATE_MS );
@@ -281,11 +310,11 @@
portBASE_TYPE TaskRtn;//タスククリエイトの結果を受け取る型
//タスク0:コマンド解析タスク
- TaskRtn= xTaskCreate(taskCmdParser, (signed portCHAR *)"TaskCmd", 256, NULL, 1, &tskHandle[0]);
+ TaskRtn= xTaskCreate(taskCmdParser, (signed portCHAR *)"TaskCmd", 512, NULL, 1, &tskHandle[0]);
if(TaskRtn==pdTRUE){sp.printf("Task0 Set : Command parser\r\n");}
//タスク1:制御タスク
- TaskRtn= xTaskCreate(taskHbControl, (signed portCHAR *)"TaskHbCont", 512, NULL, 2, &tskHandle[1]);
+ TaskRtn= xTaskCreate(taskHbControl, (signed portCHAR *)"TaskHbCont", 640, NULL, 2, &tskHandle[1]);
if(TaskRtn==pdTRUE){sp.printf("Task1 Set : Hoverbike Control\r\n");}
//タスク2:デバッグタスク