diff --git a/APP/mymain.c b/APP/mymain.c index 14a8eeb..2fb0794 100644 --- a/APP/mymain.c +++ b/APP/mymain.c @@ -23,6 +23,7 @@ void mymain() Angel_closed_loop(motory,&FOCStruct_Y,2.3); i++; } + i=0; LED_ON; while(1) { @@ -32,8 +33,8 @@ void mymain() y = Angle.roll ; Zitai_closed_loop(motorx,&FOCStruct_X,x); Zitai_closed_loop(motory,&FOCStruct_Y,-y); - x = getAngle(motorx); - y = getAngle(motory); +// x = getAngle(motorx); +// y = getAngle(motory); // printf("%fY%f\n",x,y); // speed_closed_loop(motorx,&FOCStruct_X,_2PI*5); // speed_closed_loop(motory,&FOCStruct_Y,_2PI*2); @@ -44,7 +45,7 @@ void mymain() // } // i++; // -// Data_send(x,y,0,0); + Data_send(x,y); // HAL_Delay(3); } } \ No newline at end of file diff --git a/APP/usart_ano.c b/APP/usart_ano.c index 4d3b6a9..1706a76 100644 --- a/APP/usart_ano.c +++ b/APP/usart_ano.c @@ -5,11 +5,12 @@ #include "usart_ano.h" unsigned char Data_Buff[32] ={0XAA,0XFF,0XF1}; //AA FF F1 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 AA 37 -void Data_send(int32_t _a,int32_t _b,int32_t _c,int32_t _d) +void Data_send(int32_t _a,int32_t _b) { unsigned char i,cnt=4; unsigned char sc=0,ac=0; + Data_Buff[3]=0x08; Data_Buff[cnt++] = BYTE0(_a); Data_Buff[cnt++] = BYTE1(_a); Data_Buff[cnt++] = BYTE2(_a); @@ -20,19 +21,6 @@ void Data_send(int32_t _a,int32_t _b,int32_t _c,int32_t _d) Data_Buff[cnt++] = BYTE2(_b); Data_Buff[cnt++] = BYTE3(_b); - Data_Buff[cnt++] = BYTE0(_c); - Data_Buff[cnt++] = BYTE1(_c); - Data_Buff[cnt++] = BYTE2(_c); - Data_Buff[cnt++] = BYTE3(_c); - - Data_Buff[cnt++] = BYTE0(_d); - Data_Buff[cnt++] = BYTE1(_d); - Data_Buff[cnt++] = BYTE2(_d); - Data_Buff[cnt++] = BYTE3(_d); - - - Data_Buff[3]=cnt-4; - for(i=0;i:-x$assembler-with-cpp>) + +if ("$${CMAKE_BUILD_TYPE}" STREQUAL "Release") + message(STATUS "Maximum optimization for speed") + add_compile_options(-Ofast) +elseif ("$${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo") + message(STATUS "Maximum optimization for speed, debug info included") + add_compile_options(-Ofast -g) +elseif ("$${CMAKE_BUILD_TYPE}" STREQUAL "MinSizeRel") + message(STATUS "Maximum optimization for size") + add_compile_options(-Os) +else () + message(STATUS "Minimal optimization, debug info included") + add_compile_options(-Og -g) +endif () + +include_directories(${includes}) + +add_definitions(${defines}) + +file(GLOB_RECURSE SOURCES ${sources}) + +set(LINKER_SCRIPT $${CMAKE_SOURCE_DIR}/${linkerScript}) + +add_link_options(-Wl,-gc-sections,--print-memory-usage,-Map=$${PROJECT_BINARY_DIR}/$${PROJECT_NAME}.map) +add_link_options(-mcpu=${mcpu} -mthumb -mthumb-interwork) +add_link_options(-T $${LINKER_SCRIPT}) + +add_executable($${PROJECT_NAME}.elf $${SOURCES} $${LINKER_SCRIPT}) + +set(HEX_FILE $${PROJECT_BINARY_DIR}/$${PROJECT_NAME}.hex) +set(BIN_FILE $${PROJECT_BINARY_DIR}/$${PROJECT_NAME}.bin) + +add_custom_command(TARGET $${PROJECT_NAME}.elf POST_BUILD + COMMAND $${CMAKE_OBJCOPY} -Oihex $ $${HEX_FILE} + COMMAND $${CMAKE_OBJCOPY} -Obinary $ $${BIN_FILE} + COMMENT "Building $${HEX_FILE} +Building $${BIN_FILE}") diff --git a/IMU/icm42688.c b/IMU/icm42688.c index c9a26c9..f2c7e13 100644 --- a/IMU/icm42688.c +++ b/IMU/icm42688.c @@ -396,7 +396,6 @@ uint8_t MpuGetData(void) pMpu[i] = tBuff[k] = tBuff[k] * (1 - factor) + pMpu[i] * factor; } } - return 0; }