diff --git a/MDK-ARM/.vscode/keil-assistant.log b/MDK-ARM/.vscode/keil-assistant.log index b06872f..62df037 100644 --- a/MDK-ARM/.vscode/keil-assistant.log +++ b/MDK-ARM/.vscode/keil-assistant.log @@ -152,3 +152,7 @@ [info] Log at : 2025/7/13|16:42:25|GMT+0800 +[info] Log at : 2025/7/13|22:38:15|GMT+0800 + +[info] Log at : 2025/7/14|07:52:29|GMT+0800 + diff --git a/MDK-ARM/.vscode/uv4.log b/MDK-ARM/.vscode/uv4.log index 85b4dd4..ed37286 100644 --- a/MDK-ARM/.vscode/uv4.log +++ b/MDK-ARM/.vscode/uv4.log @@ -1,18 +1,8 @@ *** Using Compiler 'V5.06 update 7 (build 960)', folder: 'D:\keil\ARM\ARMCC\Bin' Build target 'R1' -compiling userTask.c... -compiling remote_control.c... -compiling initTask.c... -compiling main.c... -compiling shootTask.cpp... -compiling djiMotor.c... -compiling nucTask.cpp... -compiling encodeCan.cpp... -compiling ballTask.cpp... compiling ball.cpp... -compiling shoot.cpp... linking... -Program Size: Code=32032 RO-data=1832 RW-data=284 ZI-data=32268 +Program Size: Code=32056 RO-data=1832 RW-data=284 ZI-data=32268 FromELF: creating hex file... "R1\R1.axf" - 0 Error(s), 0 Warning(s). -Build Time Elapsed: 00:00:09 +Build Time Elapsed: 00:00:05 diff --git a/MDK-ARM/.vscode/uv4.log.lock b/MDK-ARM/.vscode/uv4.log.lock index c28d343..0bfbb9d 100644 --- a/MDK-ARM/.vscode/uv4.log.lock +++ b/MDK-ARM/.vscode/uv4.log.lock @@ -1 +1 @@ -2025/7/13 17:07:34 \ No newline at end of file +2025/7/14 7:54:12 \ No newline at end of file diff --git a/MDK-ARM/R1.uvoptx b/MDK-ARM/R1.uvoptx index 0d9928a..43f788a 100644 --- a/MDK-ARM/R1.uvoptx +++ b/MDK-ARM/R1.uvoptx @@ -154,6 +154,33 @@ + + + 0 + 1 + rc_ctrl,0x0A + + + 1 + 1 + shoot,0x0A + + + 2 + 1 + ball + + + 3 + 1 + and1 + + + 4 + 1 + and1 + + 4 diff --git a/User/bsp/TopDefine.h b/User/bsp/TopDefine.h index 9d74009..9524760 100644 --- a/User/bsp/TopDefine.h +++ b/User/bsp/TopDefine.h @@ -16,7 +16,7 @@ #endif -#define ONE_CONTROL 0 +#define ONE_CONTROL 1 //是否使用大疆DT7遥控器 #ifndef DT7 diff --git a/User/module/shoot.cpp b/User/module/shoot.cpp index 0246bbc..584e51c 100644 --- a/User/module/shoot.cpp +++ b/User/module/shoot.cpp @@ -171,6 +171,9 @@ int Shoot::GO_SendData(float pos, float limit) // sw[5] 👆 200 👇1800 // 左旋 sw[7] 200 --1800 + +float and1=0.0f; + void Shoot::rc_mode() { // 底部光电检测(假设0为到位,1为未到位,根据实际硬件调整) @@ -222,23 +225,44 @@ void Shoot::rc_mode() { ready_key = DEFENSE; } + //400--640为1 730--860为2 900到1200为3档中间 1300--1500为4 + if(rc_ctrl.sw[7]<=300) + { + and1=0.0f; + } + if(rc_ctrl.sw[7]>=400&&rc_ctrl.sw[7]<=640) + { + and1=-2.0f; + } + if(rc_ctrl.sw[7]>=730&&rc_ctrl.sw[7]<=860) + { + and1=-1.0f; + } + if(rc_ctrl.sw[7]>=900&&rc_ctrl.sw[7]<=1200) + { + and1=0.0f; + } + if(rc_ctrl.sw[7]>=1300&&rc_ctrl.sw[7]<=1500) + { + and1=1.0f; + } - // 旋钮映射部分不变 - const int knob_min = 200; - const int knob_max = 1800; - const float map_min = 130.0f; - const float map_max = -60.0f; - int current_knob_value = rc_ctrl.sw[7]; - if (current_knob_value < knob_min) - current_knob_value = knob_min; - if (current_knob_value > knob_max) - current_knob_value = knob_max; - knob_increment = map_min + (map_max - map_min) * (current_knob_value - knob_min) / (knob_max - knob_min); + // // 旋钮映射部分不变 + // const int knob_min = 200; + // const int knob_max = 1800; + // const float map_min = 130.0f; + // const float map_max = -60.0f; + // int current_knob_value = rc_ctrl.sw[7]; + // if (current_knob_value < knob_min) + // current_knob_value = knob_min; + // if (current_knob_value > knob_max) + // current_knob_value = knob_max; + // knob_increment = map_min + (map_max - map_min) * (current_knob_value - knob_min) / (knob_max - knob_min); } #if ONE_CONTROL == 0 -float and1=0.0f; + void Shoot::shoot_control() { @@ -415,8 +439,6 @@ void Shoot::RemoveError() #if ONE_CONTROL -//float and1=-1.5f; -float and1=0; float and2=0; void Shoot::shoot_control() @@ -618,7 +640,7 @@ void Shoot ::ball_receive() break; case BAKC: control_pos = BOTTOM_POS; - limit_speed = TO_BOTTOM; // 慢速下来 + limit_speed = 8.0f; // 慢速下来 if (feedback.fd_gopos >= BOTTOM_POS - 1.0f && feedback.fd_gopos <= BOTTOM_POS + 1.0f) {