/* * take off -> landing -> take off -> go home */ void basic_test_cmd(bool &is_init) { static int cnt; unsigned char send_data = 0; if(!is_init) { cnt = 0; is_init= true; } else { if(test_cmd_send_flag) { if(test_cmd_is_resend) { cnt--; test_cmd_is_resend = 0; } if(cnt % 4 == 0) { test_cmd_send_flag = 0; send_data = 4; } else if(cnt % 4 == 1) { test_cmd_send_flag = 0; send_data = 6; } else if(cnt % 4 == 2) { test_cmd_send_flag = 0; send_data = 4; } else if(cnt % 4 == 3) { test_cmd_send_flag = 0; send_data = 1; } App_Complex_Send_Cmd(send_data, cmd_callback_test_fun); printf("[TEST_CMD] send %d \n",send_data); cnt++; } } }
void DJI_Onboard_API_UAV_Control(unsigned char arg) { unsigned char send_data = arg; if( !(arg == 1 || arg == 4 || arg == 6) ) { printf("Parameter [ERROR]\n"); } if(cmd_send_flag) { App_Complex_Send_Cmd(send_data, cmd_callback_fun); cmd_send_flag = 0; } else { printf("Previous Command not finish [ERROR]\n"); } }
void DJI_Onboard_API_UAV_Control(unsigned char arg) { unsigned char send_data = arg; App_Complex_Send_Cmd(send_data); }
void test_all(bool &is_init) { static int cnt; if(!is_init) { cnt = 0; is_init= true; } else { static bool init_flag = false; if(cnt < 1) { uint8_t send_data = 4; App_Complex_Send_Cmd(send_data, cmd_callback_fun); cnt ++; } else if(cnt < 50 * 12) { /* wait for takeoff finish */ cnt ++; } else if(cnt < 50 * (40 + 12)) { if(cnt == 50 * 12) printf("Debug info: start mode2\n"); basic_test_mode2(init_flag); cnt ++; } else if(cnt < 50 * (40 + 12) + 1) { init_flag = false; cnt ++; } else if(cnt < 50 * 40 * 2 + 50 * 12) { if(cnt == (50 *(40 + 12) + 1)) printf("Debug info: start mode4\n"); basic_test_mode4(init_flag); cnt ++; } else if(cnt < 50 * 40 * 2 + 50 * 12 + 1) { init_flag = false; uint8_t send_data = 1; App_Complex_Send_Cmd(send_data, cmd_callback_fun); cnt ++; } else if(cnt < 50 * (40 + 12) * 2 + 50 * 15) { //wait landing cnt ++; } else { printf("Test_all finished !\n"); cnt = 0; simple_task_num = -1; } } }